We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
I am locating executable code at 0x8000 in ROM. The code builds and links fine. However, since the Reset Handler is located at 0x8064 (in memory map) the reset address at 0x0000 is not loaded with the address of the Reset_Handler. I have setup options file to load IROM1 at 0x8000
How can I just place the 4 bytes of the Reset_Handler (0x00008064) at offset 0x00000000 so that I can run test this in the debugger? I have muddled with the scatterfile, but it seems that since the Reset_Handler is embedded in the AREA RESET, CODE, READONLY area I cannot just modify the Load/execution regions because the entire startup code is then located there.
Device is LPC21xx ARM7
Thanks
If just debugging, i.e. testing, then you use a debugger script file that sets PC to the correct address and starts from there. This is done by many of the example programs, when specifying the RAM build.
If creating a "real" application, then you must either write a boot loader that is running at the start of flash, and that jumps to your application. Or you must craete a scatter file that stores all of the application in flash, but scatter-loads the application into RAM before jumping to the code now copied into RAM.
Per,
Thanks for the response. I was looking into creating sort of an alias variable for the Reset_Handler and using its address in a separate AREA declaration. Then I thought I might be able to just load that section with the scatterfile and accomplish what I was trying to do.
The closet I was able to come was having to link the entire startup.o file at offset 0 and the rest of the application where it will ultimately reside:
LR_IROM1 0x00000000 0x00000400 { ; load region size_region ER_IROM1 0x00000000 0x00000400 { ; load address = execution address startup.o (RESET, +First) } } LR_IROM2 0x00008020 0x00017FE0 { ; load region size_region ER_IROM2 0x00008020 0x00017FE0 { ; load address = execution address ; *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_IRAM2 0x40000040 0x00007FC0 { ; RW data .ANY (+RW +ZI) } }
Oh well, I hate losing these types of 'battles'...
Thanks.