Hello, I am working with the Realview linker. The source of the issue is likely to be documented but I cannot find it - maybe you can help me. when I'm using the following scatter file:
ER_IROM1 0x28000 0x56000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) }
absolute positioning of a key in flash, at an offset of 0xFF0 from the beginning of the exection region works fine. But, if I change my scatter file to this:
LR_IROM1 0x28000 0x56000 { ; load region size_region ER_IROM1 0x28000 0x56000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } SOFTWARE_EVENT 0x35000 { ; this region is used to export the software event function for quick invocation by the firmware in case of a failure SOFTWARE_EVENT.o (+RO) } ER_IROM2 0x35400 0x48C00 { ; load address = execution address .ANY (+RO) }
hence I absolutely position a section at 0x35000, the flash key is placed at about 0xAD00 from the beginning instead! the scatter file shows the right address for the key, but looking at the generated binary reveals the problem. What is happening here?
Marcus, Can you/anybody explain the following phenomenon? This scatter file
LR_IROM1 0x28000 0x56000 { ; load region size_region ER_IROM1 0x28000 0x10000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } SOFTWARE_EVENT 0x38000 FIXED 0x60 { ; this region is used to export the software event function for quick invocation ; by the firmware in case of a failure SOFTWARE_EVENT.o (+RO) } ER_IROM2 0x38060 FIXED { ; load address = execution address .ANY (+RO) }
Creates a huge hole in my flash:
RESET 0x00028000 Section 380 lpc2400.o(RESET) Undef_Handler 0x00028040 ARM Code 4 lpc2400.o(RESET) PAbt_Handler 0x00028044 ARM Code 4 lpc2400.o(RESET) DAbt_Handler 0x00028048 ARM Code 4 lpc2400.o(RESET) IRQ_Handler 0x0002804c ARM Code 4 lpc2400.o(RESET) FIQ_Handler 0x00028050 ARM Code 4 lpc2400.o(RESET) !!!main 0x0002817c Section 8 __main.o(!!!main) !!!scatter 0x00028184 Section 60 __scatter.o(!!!scatter) !!dczerorl 0x000281c0 Section 68 __dczerorl.o(!!dczerorl) !!handler_zi 0x00028204 Section 44 __scatter_zi.o(!!handler_zi) .ARM.__AT_0x00030010 0x00030010 Section 16 sys_version.o(.ARM.__AT_0x00030010) .ARM.__AT_0x00030020 0x00030020 Section 16 sys_version.o(.ARM.__AT_0x00030020) .ARM.__AT_0x00030030 0x00030030 Section 16 sys_version.o(.ARM.__AT_0x00030030) .ARM.__AT_0x00030040 0x00030040 Section 16 sys_version.o(.ARM.__AT_0x00030040) .ARM.__AT_0x00037FF0 0x00037ff0 Section 16 sys_version.o(.ARM.__AT_0x00037FF0)
Why aren't the regions 0x28204 to 0x30010 and 0x30040 to 0x37FF0 used? How can I coax the linker to fill there regions? sys_version.o contains variables that are absolutely located.
of course I can force the linker by doing something like this:
LR_IROM1 0x28000 0x56000 { ; load region size_region ER_IROM1 0x28000 0x8000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } ER_IROM3 0x30000 0x8000 { ; load address = execution address SYSTEM_TIMER.o .ANY (+RO) } SOFTWARE_EVENT 0x38000 FIXED 0x60 { ; this region is used to export the software event function for quick invocation ; by the firmware in case of a failure SOFTWARE_EVENT.o (+RO) } ER_IROM2 0x38060 FIXED { ; load address = execution address .ANY (+RO) }
But I has hoped that the linker would clever enough (or me less dumb :-) )
Found it. This scatter file seems to handle it better:
LR_IROM1 0x28000 0x56000 { ; load region size_region ER_IROM1 0x28000 0x1000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } SOFTWARE_EVENT 0x29000 FIXED 0x60 { ; this region is used to export the software event function for quick invocation ; by the firmware in case of a failure SOFTWARE_EVENT.o (+RO) } ER_IROM2 0x29060 0X54FA0 { ; load address = execution address .ANY (+RO) } I'm still not sure why...the only difference is that the section SOFTWARE_EVENT is now located before the absolutely positioned stuff.