Tools für ASM richtig einsetzen.
-
hallo Leute.
ich habe nun alle Tools die ich brauche um für ARM entwickeln zu können. (Momnetan unter Win)
Quelle : http://www.double.co.nz/nintendo_ds/nds_tutorial2.htmlNun habe ich folgendes probiert:
cd C:\devkitPro\examples\nds\Graphics\3D\BoxTest make
habe ich in die Console also Eingabeauforderung geschrieben, darauf hin wurde das kompieliert.
Das verzeichnnis Boxtest hat folgenden Inhalt:
- build (ordner)
--- BoxTest.map
--- main.d
--- main.o- source (ordner)
--- main.cpp- BoxTest.arm9
- BoxTest.elf
- BoxTest.nds
- boxtest.pnproj
- MakefileFragen:
wer kann mir erklären wozu eine d datei und eine cpp datei hier benötigt werden und zwar gleichzeitig.die d datei enthält das hier :
main.o: c:/devkitPro/examples/nds/Graphics/3D/BoxTest/source/main.cpp \ c:/devkitPro/libnds/include/nds.h \ c:/devkitPro/libnds/include/nds/libversion.h \ c:/devkitPro/libnds/include/nds/ndstypes.h \ c:/devkitPro/libnds/include/nds/bios.h \ c:/devkitPro/libnds/include/nds/ndstypes.h \ c:/devkitPro/libnds/include/nds/card.h \ c:/devkitPro/libnds/include/nds/ndstypes.h \ c:/devkitPro/libnds/include/nds/debug.h \ c:/devkitPro/libnds/include/nds/dma.h \ c:/devkitPro/libnds/include/nds/interrupts.h \ c:/devkitPro/libnds/include/nds/ipc.h \ c:/devkitPro/libnds/include/nds/memory.h \ c:/devkitPro/libnds/include/nds/system.h \ c:/devkitPro/libnds/include/nds/timers.h \ c:/devkitPro/libnds/include/nds/linkedlist.h \ c:/devkitPro/libnds/include/nds/fifocommon.h \ c:/devkitPro/libnds/include/nds/touch.h \ c:/devkitPro/libnds/include/nds/arm9/background.h \ c:/devkitPro/libnds/include/nds/arm9/video.h \ c:/devkitPro/libnds/include/nds/arm9/sassert.h \ c:/devkitPro/libnds/include/nds/memory.h \ c:/devkitPro/libnds/include/nds/dma.h \ c:/devkitPro/libnds/include/nds/arm9/boxtest.h \ c:/devkitPro/libnds/include/nds/arm9/videoGL.h \ c:/devkitPro/libnds/include/nds/arm9/cache.h \ c:/devkitPro/libnds/include/nds/arm9/trig_lut.h \ c:/devkitPro/libnds/include/nds/arm9/math.h \ c:/devkitPro/libnds/include/nds/dynamicArray.h \ c:/devkitPro/libnds/include/nds/arm9/cache.h \ c:/devkitPro/libnds/include/nds/arm9/console.h \ c:/devkitPro/libnds/include/nds/arm9/background.h \ c:/devkitPro/libnds/include/nds/arm9/keyboard.h \ c:/devkitPro/libnds/include/nds/arm9/exceptions.h \ c:/devkitPro/libnds/include/nds/arm9/image.h \ c:/devkitPro/libnds/include/nds/arm9/pcx.h \ c:/devkitPro/libnds/include/nds/arm9/input.h \ c:/devkitPro/libnds/include/nds/touch.h \ c:/devkitPro/libnds/include/nds/arm9/math.h \ c:/devkitPro/libnds/include/nds/arm9/pcx.h \ c:/devkitPro/libnds/include/nds/arm9/rumble.h \ c:/devkitPro/libnds/include/nds/arm9/sound.h \ c:/devkitPro/libnds/include/nds/arm9/trig_lut.h \ c:/devkitPro/libnds/include/nds/arm9/video.h \ c:/devkitPro/libnds/include/nds/arm9/videoGL.h \ c:/devkitPro/libnds/include/nds/arm9/sprite.h \ c:/devkitPro/libnds/include/nds/system.h \ c:/devkitPro/libnds/include/nds/arm9/decompress.h c:/devkitPro/libnds/include/nds.h: c:/devkitPro/libnds/include/nds/libversion.h: c:/devkitPro/libnds/include/nds/ndstypes.h: c:/devkitPro/libnds/include/nds/bios.h: c:/devkitPro/libnds/include/nds/ndstypes.h: c:/devkitPro/libnds/include/nds/card.h: c:/devkitPro/libnds/include/nds/ndstypes.h: c:/devkitPro/libnds/include/nds/debug.h: c:/devkitPro/libnds/include/nds/dma.h: c:/devkitPro/libnds/include/nds/interrupts.h: c:/devkitPro/libnds/include/nds/ipc.h: c:/devkitPro/libnds/include/nds/memory.h: c:/devkitPro/libnds/include/nds/system.h: c:/devkitPro/libnds/include/nds/timers.h: c:/devkitPro/libnds/include/nds/linkedlist.h: c:/devkitPro/libnds/include/nds/fifocommon.h: c:/devkitPro/libnds/include/nds/touch.h: c:/devkitPro/libnds/include/nds/arm9/background.h: c:/devkitPro/libnds/include/nds/arm9/video.h: c:/devkitPro/libnds/include/nds/arm9/sassert.h: c:/devkitPro/libnds/include/nds/memory.h: c:/devkitPro/libnds/include/nds/dma.h: c:/devkitPro/libnds/include/nds/arm9/boxtest.h: c:/devkitPro/libnds/include/nds/arm9/videoGL.h: c:/devkitPro/libnds/include/nds/arm9/cache.h: c:/devkitPro/libnds/include/nds/arm9/trig_lut.h: c:/devkitPro/libnds/include/nds/arm9/math.h: c:/devkitPro/libnds/include/nds/dynamicArray.h: c:/devkitPro/libnds/include/nds/arm9/cache.h: c:/devkitPro/libnds/include/nds/arm9/console.h: c:/devkitPro/libnds/include/nds/arm9/background.h: c:/devkitPro/libnds/include/nds/arm9/keyboard.h: c:/devkitPro/libnds/include/nds/arm9/exceptions.h: c:/devkitPro/libnds/include/nds/arm9/image.h: c:/devkitPro/libnds/include/nds/arm9/pcx.h: c:/devkitPro/libnds/include/nds/arm9/input.h: c:/devkitPro/libnds/include/nds/touch.h: c:/devkitPro/libnds/include/nds/arm9/math.h: c:/devkitPro/libnds/include/nds/arm9/pcx.h: c:/devkitPro/libnds/include/nds/arm9/rumble.h: c:/devkitPro/libnds/include/nds/arm9/sound.h: c:/devkitPro/libnds/include/nds/arm9/trig_lut.h: c:/devkitPro/libnds/include/nds/arm9/video.h: c:/devkitPro/libnds/include/nds/arm9/videoGL.h: c:/devkitPro/libnds/include/nds/arm9/sprite.h: c:/devkitPro/libnds/include/nds/system.h: c:/devkitPro/libnds/include/nds/arm9/decompress.h:
/*--------------------------------------------------------------------------------- Box test to demonstrate 3D bounding box es. also shows the effect of culling and clipping on vertex usage *--------------------------------------------------------------------------------*/ #include <nds.h> #include <stdio.h> //some code for profiling //--------------------------------------------------------------------------------- u16 startTimer(int timer) { //--------------------------------------------------------------------------------- TIMER_CR(timer) = 0; TIMER_DATA(0) = 0; TIMER_CR(timer) = TIMER_DIV_1 | TIMER_ENABLE; return TIMER_DATA(0); } #define getTimer(timer) (TIMER_DATA(timer)) //--------------------------------------------------------------------------------- //draws a box...same signature as boxTest //--------------------------------------------------------------------------------- void DrawBox(float x, float y, float z, float width, float height, float depth) { //--------------------------------------------------------------------------------- glBegin(GL_QUADS); //z face glColor3f(1,0,0); glVertex3f(x , y , z ); glVertex3f(x + width, y , z ); glVertex3f(x + width, y + height, z ); glVertex3f(x , y + height, z ); //z + depth face glColor3f(1,0,1); glVertex3f(x , y , z + depth); glVertex3f(x , y + height, z + depth); glVertex3f(x + width, y + height, z + depth); glVertex3f(x + width, y , z + depth); //x face glColor3f(1,1,0); glVertex3f(x , y , z ); glVertex3f(x , y + height, z ); glVertex3f(x , y + height, z + depth); glVertex3f(x , y , z + depth); //x + width face glColor3f(1,1,1); glVertex3f(x + width, y , z ); glVertex3f(x + width, y , z + depth); glVertex3f(x + width, y + height, z + depth); glVertex3f(x + width, y + height, z ); //y face glColor3f(0,1,0); glVertex3f(x , y , z ); glVertex3f(x , y , z + depth); glVertex3f(x + width, y , z + depth); glVertex3f(x + width, y , z ); //y + height face glColor3f(0,1,1); glVertex3f(x , y + height, z ); glVertex3f(x + width, y + height, z ); glVertex3f(x + width, y + height, z + depth); glVertex3f(x , y + height, z + depth); glEnd(); } //--------------------------------------------------------------------------------- int main() { //--------------------------------------------------------------------------------- touchPosition touchXY; //put 3D on top lcdMainOnTop(); //setup the sub screen for basic printing consoleDemoInit(); // Setup the Main screen for 3D videoSetMode(MODE_0_3D); // initialize gl glInit(); // enable antialiasing glEnable(GL_ANTIALIAS); // setup the rear plane glClearColor(0,0,0,31); // BG must be opaque for AA to work glClearPolyID(63); // BG must have a unique polygon ID for AA to work glClearDepth(0x7FFF); // Set our view port to be the same size as the screen glViewport(0,0,255,191); //camera float rotX = 0, rotY = 0; float translate = -5; //some profiling code u16 time; //keep track of vertex ram usage int polygon_count; int vertex_count; //object int rx = 50, ry = 15; int oldx = 0, oldy = 0; printf("\x1b[10;0HPress A to change culling"); printf("\n\nPress B to change Ortho vs Persp"); printf("\nLeft/Right/Up/Down to rotate"); printf("\nPress L and R to zoom"); printf("\nTouch screen to rotate cube"); //main loop while (1) { //process input scanKeys(); touchRead(&touchXY); int held = keysHeld(); int pressed = keysDown(); if( held & KEY_LEFT) rotY++; if( held & KEY_RIGHT) rotY--; if( held & KEY_UP) rotX ++; if( held & KEY_DOWN) rotX --; if( held & KEY_L) translate += .1; if( held & KEY_R) translate -= .1; //reset x and y when user touches screen if( pressed & KEY_TOUCH) { oldx = touchXY.px; oldy = touchXY.py; } //if user drags then grab the delta if( held & KEY_TOUCH) { rx += touchXY.px - oldx; ry += touchXY.py - oldy; oldx = touchXY.px; oldy = touchXY.py; } //change ortho vs perspective glMatrixMode(GL_PROJECTION); glLoadIdentity(); if(keysHeld() & KEY_B) glOrtho(-4,4,-3,3,0.1,10); else { gluPerspective(70, 256.0 / 192.0, 0.1, 10); } //change cull mode if( held & KEY_A) glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE ); else glPolyFmt(POLY_ALPHA(31) | POLY_CULL_FRONT ); // Set the current matrix to be the model matrix glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //handle camera glRotateY(rotY); glRotateX(rotX); glTranslatef(0,0,translate); //move the cube glRotateX(ry); glRotateY(rx); DrawBox(-1,-1,-1,2,2,2); swiWaitForVBlank(); printf("\x1b[0;0HBox test cycle count"); time = startTimer(0); int hit = BoxTestf(-1,-1,-1,2,2,2); printf("\nSingle test (float): %i", 2*(getTimer(0) - time)); time = startTimer(0); BoxTest(inttov16(-1),inttov16(-1),inttov16(-1),inttov16(2),inttov16(2),inttov16(2)); printf("\nSingle test (fixed): %i", 2*(getTimer(0) - time)); time = startTimer(0); for(int i = 0; i < 64; i++) BoxTest(inttov16(-1),inttov16(-1),inttov16(-1),inttov16(2),inttov16(2),inttov16(2)); printf("\n64 tests avg. (fixed): %i", (getTimer(0) - time) / 32); printf("\nBox Test result: %s", hit ? "hit" : "miss"); while (GFX_STATUS & (1<<27)); // wait until the geometry engine is not busy glGetInt(GL_GET_VERTEX_RAM_COUNT, &vertex_count); glGetInt(GL_GET_POLYGON_RAM_COUNT, &polygon_count); printf("\n\nRam usage: Culling %s", ( held & KEY_A) ? "none" : "back faces" ); printf("\nVertex ram: %i", vertex_count); printf("\nPolygon ram: %i", polygon_count); // flush to the screen glFlush(0); } return 0; }
der inhalt sieht eher nach c++ aus als nach asm glaub das is egal, welcher compiler benutzt werden soll steht im makefile , aber wozu das d file und sonstiges vllt. noch was wichtig währe zu wissn?
Aber ich denke mal die eingabe in die konsole funktioniert, weil er in dem pfad diese makefile findet ne?
dazu folgende fragen:
1.) muss es immer makefile heißen?
2.) wie muss ich das aufbauen, wo kann ich makefiles schreiben lernen?was sollte ich noch zur benutzung wissen?
Mfg Wikinger75!
-
.d files geben der make.exe an von welchen Headern der Quelltext abhängig ist
das makefile muss nicht immer makefile heißen, aber wenn es makefile heißt, findet make.exe es automatisch
wie du die makefiles schreibst:
http://www.gnu.org/software/make/manual/make.html
ist zwar für gnumake (läuft auch unter win)
der Grundaufbau eines makefiles ist aber immer gleich
-
Ah okay gut das tutoril werd ich mir mal snehen,
ja in welcher weise dagt es dem compiler welche header er nehmen soll, was gehört immer da rein?
hier au mal der code von dem makefile :
#--------------------------------------------------------------------------------- .SUFFIXES: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITARM)),) $(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM") endif include $(DEVKITARM)/ds_rules #--------------------------------------------------------------------------------- # TARGET is the name of the output # BUILD is the directory where object files & intermediate files will be placed # SOURCES is a list of directories containing source code # DATA is a list of directories containing data files # INCLUDES is a list of directories containing header files #--------------------------------------------------------------------------------- TARGET := $(shell basename $(CURDIR)) BUILD := build SOURCES := source DATA := data INCLUDES := include #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- ARCH := -mthumb -mthumb-interwork CFLAGS := -g -Wall -O2\ -march=armv5te -mtune=arm946e-s -fomit-frame-pointer\ -ffast-math \ $(ARCH) CFLAGS += $(INCLUDE) -DARM9 CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions ASFLAGS := -g $(ARCH) LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- LIBS := -lnds9 #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- LIBDIRS := $(LIBNDS) #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional # rules for different file extensions #--------------------------------------------------------------------------------- ifneq ($(BUILD),$(notdir $(CURDIR))) #--------------------------------------------------------------------------------- export OUTPUT := $(CURDIR)/$(TARGET) export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ $(foreach dir,$(DATA),$(CURDIR)/$(dir)) export DEPSDIR := $(CURDIR)/$(BUILD) CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) #--------------------------------------------------------------------------------- # use CXX for linking C++ projects, CC for standard C #--------------------------------------------------------------------------------- ifeq ($(strip $(CPPFILES)),) #--------------------------------------------------------------------------------- export LD := $(CC) #--------------------------------------------------------------------------------- else #--------------------------------------------------------------------------------- export LD := $(CXX) #--------------------------------------------------------------------------------- endif #--------------------------------------------------------------------------------- export OFILES := $(addsuffix .o,$(BINFILES)) \ $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ -I$(CURDIR)/$(BUILD) export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) .PHONY: $(BUILD) clean all #--------------------------------------------------------------------------------- all: $(BUILD) $(BUILD): @[ -d $@ ] || mkdir -p $@ @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile #--------------------------------------------------------------------------------- clean: @echo clean ... @rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).arm9 $(TARGET).ds.gba #--------------------------------------------------------------------------------- else DEPENDS := $(OFILES:.o=.d) #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- $(OUTPUT).nds : $(OUTPUT).arm9 $(OUTPUT).arm9 : $(OUTPUT).elf $(OUTPUT).elf : $(OFILES) #--------------------------------------------------------------------------------- %.bin.o : %.bin #--------------------------------------------------------------------------------- @echo $(notdir $<) @$(bin2o) -include $(DEPENDS) #--------------------------------------------------------------------------------------- endif #---------------------------------------------------------------------------------------
Mfg Wikinger75!
-
Das makefile ist schon relativ komplex, deshalb hier mal der allgemeine Aufbau
#leitet Kommentare ein #Variablen (nicht jeder benutzt den selben Compiler #dann werden die Ziele angegeben #Aufbau: #Zielname: wovon es abhängt #"TAB-Taste" der Befehl der ausgeführt werden soll
naja lerne makefiles grade selber
auf jeden Fall: das Ziel muss ja nur compiliert werden, wennn sich eine Datei, von der es abhängt, ändert.
In größen Projekten werden die Abhängigkeiten schnell unübersichtlich, deshalb lässt man sich automatisch die *.d Dateien erzeugen.Ob sich eine Datei verändert hat, erkennt make am "zu letzt geändert am" Datum, welches, wenn keine Änderung vorliegt, ja nicht "jünger" sein kann als die Zieldatei.
Also ich sag mal so, in der Documentation ist es schöner erklärt
-
Okay, danke werd mir also dne mal das tut durchlesen.
Mfg Wikinger75!
-
Google: "Makefile" -> Eine Einführung in Makefiles
Der Bezug zu Assembler ist gering. Bei konkreten Fragen werden Dir im C-Unterforum mehr Leute weiterhelfen koennen.
-
warum nimmste nicht das: http://www.animationmagazine.net/article/2872
garantiert kein gefummel mit makefiles.
-
hmm is aufjedenfall wert sich anzukucken, bin bis http://www.freescale.com/webapp/sps/site/overview.jsp?nodeId=0127260061 gekommen, in dem unterpunkten finde ich nicht das richtige pack für win, mein linux is grad wech
Mfg Wikinger75!
-
^^such mal bei rapidshare. es gibt 'nen download+crack. ob der funzt weiss ich aber nicht.
ich selbst verwende codewarriors für hcs12x und coldfires. das zeug ist schon nicht schlecht. kein gcc und erste recht kein makefile-gefrickel.
btw, wie ich's so einschätze: 'n simulator für DS wird wohl auch dabei sein.
falls alle stricke reissen: versuch's mit 'nem ARM ADS (ältere tolchain für ARMs), oder dem nachfolger (keil µvision für ARM). allerdings gibt's da wohl nix spezielles für'n DS. in dem fall wirst du um einiges an konfigurationsarbeit nicht herumkommen. die compiler sind jedenfalls ziemlich gut (hochoptimierend, sehr schlanker und schneller code, kein vergleich zum GCC).
-
Wie kann das sein, für die als angebliche bessere als x86 Architektur gibt es Probleme beim Tools-Zusammenstellen?
-
abc.w schrieb:
Wie kann das sein, für die als angebliche bessere als x86 Architektur gibt es Probleme beim Tools-Zusammenstellen?
es gibt nun mal unglaublich viele ARM-derivate, chips mit ARM-core usw. auserdem: 'ne einstiegshürde haste doch immer. aber auf länge sicht lohnt es sich, zeit in das erlernen einer guten toolchain zu investieren, als ewig mit GCC und 'make' rumzustokeln.
-
Aber es würde auch funktionieren wenn ich ein z.b c++ projekt mit eclipse machen würde und dan dem asm vorwerfen würde oder asm in c++ eibetten würde, dass geht ja auch, könnte ich so arm asm machen? ich sehe das nur als gute dirketive für x86, da deas ein x86 asm ist der bei gcc dabei ist hab ich recht?
ja gut kuck mir das mal an, sonst bleib ich halt beim von Hand schreiben
Mfg Wikinger75!
-
Hmm ne das Studio ist nichts für mich, ich bleib lieber bei den tools, außerdem denke ich ist das wissen über makefiles auch nützlich
Mfg Wikinger75!