Hi, experts:
please do me a favor, when I develop a bootloader. I need separate Flash driver with the other parts of bootloader code to different places.
Flash driver, such as FLASH_DRV_Program, should be compiled as a separate .src file and be placed at RAM.
other parts of bootloader code should be placed in the flash.
I have tryed __attribute__((section (".customSection")))
status_t __attribute__((section (".customSection"))) FLASH_DRV_Program(const flash_ssd_config_t * pSSDConfig,
uint32_t dest,
uint32_t size,
const uint8_t * pData)
but in .map the result turn out to be
this means function FLASH_DRV_Program is loaded from address 0x00007acc to address 0x20000000, NOT I want.
I just want FLASH_DRV_Program is directly placed in RAM by compiler, NOT loaded from flash.
If the flash driver which placed in RAM be compiler as a separate .src, that's better.
How can I solve those problem? please help me, much appreciated. my MCU is S32K144.
@all experts
Solved! Go to Solution.
Hi,
I'm not expert of GCC linker scripts, but as I understand it ": AT(xx)" in linker file instructs section to be loaded from xx.
.code : AT(__CODE_ROM)
{
. = ALIGN(4);
__CODE_RAM = .;
__code_start__ = .; /* Create a global symbol at code start. */
*(.code_ram) /* Custom section for storing code in RAM */
. = ALIGN(4);
__code_end__ = .; /* Define a global symbol at code end. */
} > m_data
__CODE_ROM is a location in flash while m_data is RAM. So try removing : AT(xx) and see.
Regards,
Edward
Hello @459021854 ,
Please check the following post, explains how to modify the linker file to add the code allocation regions.
Best Regards,
Alexis Andalon
Hi, Edward
I have tryed your method that's not working.
I think because in c file " startup.c " there is code to copy code from FLASH to RAM,
that's not I wanted. I do not want any COPY happened, because i do not want a copy of flash driver be placed in flash. just want only one flash driver directly be placed in RAM.
PLEASE, still need help.
Hi,
I'm not expert of GCC linker scripts, but as I understand it ": AT(xx)" in linker file instructs section to be loaded from xx.
.code : AT(__CODE_ROM)
{
. = ALIGN(4);
__CODE_RAM = .;
__code_start__ = .; /* Create a global symbol at code start. */
*(.code_ram) /* Custom section for storing code in RAM */
. = ALIGN(4);
__code_end__ = .; /* Define a global symbol at code end. */
} > m_data
__CODE_ROM is a location in flash while m_data is RAM. So try removing : AT(xx) and see.
Regards,
Edward