Hi,
I want to exec text code on SDRAM,but fail!
Import SDK emwin example from Mcuxpresso IDE, modify MIMXRT1052xxxxx_flexspi_nor.ld:
//relocate text code to sdram
/* MAIN TEXT SECTION */
.text : ALIGN(4)
{
FILL(0xff)
__vectors_start__ = ABSOLUTE(.) ;
KEEP(*(.isr_vector))
/* Global Section Table */
. = ALIGN(4) ;
__section_table_start = .;
__data_section_table = .;
LONG(LOADADDR(.data));
LONG( ADDR(.data));
LONG( SIZEOF(.data));
LONG(LOADADDR(.data_non_cache_init));
LONG( ADDR(.data_non_cache_init));
LONG( SIZEOF(.data_non_cache_init));
LONG(LOADADDR(.data_RAM2));
LONG( ADDR(.data_RAM2));
LONG( SIZEOF(.data_RAM2));
LONG(LOADADDR(.data_RAM3));
LONG( ADDR(.data_RAM3));
LONG( SIZEOF(.data_RAM3));
LONG(LOADADDR(.data_RAM4));
LONG( ADDR(.data_RAM4));
LONG( SIZEOF(.data_RAM4));
LONG(LOADADDR(.TEXT_MOVE));
LONG( ADDR(.TEXT_MOVE));
LONG( SIZEOF(.TEXT_MOVE));
__data_section_table_end = .;
__bss_section_table = .;
LONG( ADDR(.bss));
LONG( SIZEOF(.bss));
LONG( ADDR(.bss_non_cache));
LONG( SIZEOF(.bss_non_cache));
LONG( ADDR(.bss_RAM2));
LONG( SIZEOF(.bss_RAM2));
LONG( ADDR(.bss_RAM3));
LONG( SIZEOF(.bss_RAM3));
LONG( ADDR(.bss_RAM4));
LONG( SIZEOF(.bss_RAM4));
__bss_section_table_end = .;
__section_table_end = . ;
/* End of Global Section Table */
*(.after_vectors*)
} >BOARD_FLASH
......
.TEXT_MOVE : ALIGN(4)
{
FILL(0xff)
PROVIDE(__start_text_section = .) ;
*(.text*)
*(.rodata .rodata.* .constdata .constdata.*)
. = ALIGN(4) ;
PROVIDE(__end_text_section = .) ;
} > BOARD_SDRAM_LOWER AT>BOARD_FLASH
......
Modify Startup_mimxrt1052.c ResetISR function:
Cut blow codes and paste them after line "__asm volatile ("cpsid i");" :
//
// Copy the data sections from flash to SRAM.
//
unsigned int LoadAddr, ExeAddr, SectionLen;
unsigned int *SectionTableAddr;
// Load base address of Global Section Table
SectionTableAddr = &__data_section_table;
// Copy the data sections from flash to SRAM.
while (SectionTableAddr < &__data_section_table_end) {
LoadAddr = *SectionTableAddr++;
ExeAddr = *SectionTableAddr++;
SectionLen = *SectionTableAddr++;
data_init(LoadAddr, ExeAddr, SectionLen);
}
// At this point, SectionTableAddr = &__bss_section_table;
// Zero fill the bss segment
while (SectionTableAddr < &__bss_section_table_end) {
ExeAddr = *SectionTableAddr++;
SectionLen = *SectionTableAddr++;
bss_init(ExeAddr, SectionLen);
}
download app to hyper flash and run it, application puased(halted) automatically when execute to function BOARD_ConfigMPU() which is first executed function in function main.