Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 8 months ago.
Offsetting the load region
Is there any way to offset the load region? I want to have a secondary bootloader stored in the first few sectors and have my main program starting at 0x00005000. I was hoping it would simply be a case of modifying the scatter file to:
LR_IROM1 0x00005000 0x7B000 { ; load region size_region ER_IROM1 0x00005000 0x7B000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } ; 8_byte_aligned(49 vect * 4 bytes) = 8_byte_aligned(0xC4) = 0xC8 ; 32KB - 0xC8 = 0x7F38 RW_IRAM1 0x100000C8 0x7F38 { .ANY (+RW +ZI) } RW_IRAM2 0x2007C000 0x4000 { ; RW data, ETH RAM .ANY (AHBSRAM0) } RW_IRAM3 0x20080000 0x4000 { ; RW data, ETH RAM .ANY (AHBSRAM1) } RW_IRAM4 0x40038000 0x0800 { ; RW data, CAN RAM .ANY (CANRAM) } }
but the compiler doesn't like this. I should point out that I'm using the mbed to develop the software, but I just need the binary file for the offset version as I'm loading this onto a bare metal board.
Any suggestions much appreciated.
Tim
Can you be more specific on how the compiler doesn't like it? And which compiler do you use?
posted by Erik - 04 Oct 2014I'm using the online compiler. The errors I get are:
Internal Error (0) Compile Task Failed (-242)
or sometimes, without any changes to the program I get:
The build system API returned an empty response (-240).
I've posted the project here: http://developer.mbed.org/users/timbobazza/code/mbed_blinky_offset/
posted by Tim Barry 04 Oct 2014I think the size isn't correct in your sct file, still I wouldn't expect that to matter, and also with another size I get the same errors.
posted by Erik - 04 Oct 2014I've figured it out. In startup_LPC176x.s the following lines of code set the CRP at address 0x02FC. The compiler doesn't like this as the address doesn't fall in the load region. If I comment it out, everything compiles fine and runs correctly.