Robert Adsett wrote: >At 12:49 AM 3/14/2006 +0000, Rebekah Moser wrote: > > >>--- In lpc2000@yahoogroups.com, "Rebekah Moser" <moserr@...> wrote: >> >> >>>I disassembled the code it jumps to for _start, >>>which looks like so: >>> >>>0x00000258 E3A00016 MOV R0,#0x00000016 >>>0x0000025C E28F10E8 ADD R1,PC,#0x000000E8 >>>0x00000260 EF123456 SWI 0x00123456 >>> >>> >>More info on this - this code comes from crt0.o. It appears that gcc >>version 4.0.2 has several crt0 options: crt0.o, rdimon-crt0.o, >>rdpmon-crt0.o, and redboot-crt0.o. Not all of them have the offending >>SWI instruction in them. What is the difference between these? >> >> > >Those are all for different boards (some with built-in monitors) and since >you are asking in an LPC group it's likely that none are appropriate. You >need startup specific to the LPC to deal with its memory map and any other >init you want to occur before the main C code, just as you would for any >other microcontroller. > > > You are also going to need a makefile to build your code. You want to disable certain default behaviors of gcc and replace it with your own. For example, my gcc compile line looks like this to compile (not link) main2106.c : =================== begin ===================== arm-elf-gcc -c -O0 -mthumb -mcpu=arm7tdmi -march=armv4t -DTOPLEVEL=/home/tom/Mu3Devel/CommCPU/../ -I. -gstabs -DROM_RUN -I/home/tom/Mu3Devel/CommCPU/../include -I/home/tom/MuxPad3Devel/CommCPU/../libs/include -Wall -Wstrict-prototypes -Wcast-align -Wcast-qual -Wimplicit -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wstrict-prototypes -Wunused -Wa,-adhlns=main2106.lst -std=gnu99 -nostdlib -nodefaultlibs -L/home/tom/devtools/armThumb-4.0.2/arm-elf/lib/thumb/interwork/ -L/home/tom/devtools/armThumb-4.0.2/lib/gcc/arm-elf/4.0.2/interwork/ -MD -MP -MF .dep/main2106.o.d -DLPC2106 -I/home/tom/Mu3Devel/CommCPU//include -DLPC2106 main2106.c -o main2106.o ================== snip ======================== Just doing a "arm-elf-gcc -c main2106.c -o main2106.o" just won't work. As to the linking, this is what the linker line looks like: ================== begin ======================== arm-elf-gcc -O0 -mcpu=arm7tdmi -march=armv4t -DTOPLEVEL=/home/tom/Mu3Devel/CommCPU/../ -I. -gstabs -DROM_RUN -I/home/tom/Mu3Devel/CommCPU/../include -I/home/tom/Mu3Devel/CommCPU/../libs/include -Wall -Wstrict-prototypes -Wcast-align -Wcast-qual -Wimplicit -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wstrict-prototypes -Wunused -Wa,-adhlns=main2106.o -std=gnu99 -nostdlib -nodefaultlibs -L/home/tom/devtools/armThumb-4.0.2/arm-elf/lib/thumb/interwork/ -L/home/tom/devtools/armThumb-4.0.2/lib/gcc/arm-elf/4.0.2/interwork/ -MD -MP -MF .dep/main2106.elf.d -DLPC2106 -I/home/tom/Mu3Devel/CommCPU//include -DLPC2106 main2106.o globals.o crt0.o --output /home/tom/Mu3Devel/CommCPU/main2106.elf -nostartfiles -Wl,-Map=/home/tom/Mu3Devel/CommCPU/main2106.map,--cref -TLPC2106-ROM.ld `cat .linkobjs` ==================== snip ======================= Granted, the above examples are a mouthful! But, each statement / switch in the compile & link have a specific purpose. I suggest that you get yourself one of the project examples, like blinky, from the Yahoo files section and start building it up from there. Regards, TomW -- Tom Walsh - WN3L - Embedded Systems Consultant http://openhardware.net, http://cyberiansoftware.com "Windows? No thanks, I have work to do..." ----------------------------------------------------
Message
Re: [lpc2000] Re: _start code crashes
2006-03-14 by Tom Walsh
Attachments
- No local attachments were found for this message.