This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using linker scatter file to 0-pad execution region

Hello,

I am trying to generate a hex file that places 0s in all unused bytes of my defined execution regions. I am having a hard time figuring out how to do this and would really appreciate some guidance.

Here's my scatter file:

LR_STARTUP_CONFIG 0     0x1000 {
   ER_IROM0     0       0x1000{
        *.o (RESET, +First)
        *(InRoot$$Sections)
        LPC2400.o(+RO)
   }
}
LR_RTOS 0x1000 0x2000{
   ER_IROM1     0x1000 0x2000{
        rt_*.o(+RO)
   }
}
DEFAULT_IROM 0x00003000 0x00070000  {    ; load region size_region
  ER_IROM2 0x00003000 0x00070000  {  ; load address = execution address
   .ANY (+RO)

  }
  RW_IRAM1 0x40000000 0x00010000  {  ; RW data   DF00
   .ANY (+RW +ZI)
  }

}

Specifically I want to make sure that all of the remaining bytes in ER_IROM0, ER_IROM1, ER_IROM2 are set to zero (the allocated space is more than is required by the files being placed there).

Is there a option to force the linker to fill these regions with 0s?

(I am using RV MDK 4.01, RL-ARM 4.01, ArmLink 4.0.0.524 [comes with UV4/RVMDK])

Parents
  • Why is it a bad idea to fill in these gaps?

    It's not necessarily a bad idea. But neither is it particularly good. But either way, the linker script is not the place to do it.

    Any utility that takes hex files for input (like that flash tool you're using) really should be prepared for them being non-contiguous, out-of-order or otherwise disorganized. If your tool is broken enough not to be able to cope with such input, you can always normalize it using any of the myriad of hexfile handling tools out there (srecord at SourceForge, e.g.). But do that after you've got a hex file out of Keil.

Reply
  • Why is it a bad idea to fill in these gaps?

    It's not necessarily a bad idea. But neither is it particularly good. But either way, the linker script is not the place to do it.

    Any utility that takes hex files for input (like that flash tool you're using) really should be prepared for them being non-contiguous, out-of-order or otherwise disorganized. If your tool is broken enough not to be able to cope with such input, you can always normalize it using any of the myriad of hexfile handling tools out there (srecord at SourceForge, e.g.). But do that after you've got a hex file out of Keil.

Children
No data