Hi All
I have two project that work with a boot loader that requires the code to be linked to a specific address - 0x60020108 (I know it sound like a strange address but it has a specific reason and has been used for some time without any problems).
But today I found that one of the two projects that needed to be configured for this didn't work, but the other did. This although both use the same managed linker scrip setup as follows:
MEMORY
{
/* Define each memory region */
BOARD_FLASH (rx) : ORIGIN = 0x60020108, LENGTH = 0x3dfef8 /* 4062968 bytes (alias Flash) */
SRAM_DTC (rwx) : ORIGIN = 0x20000000, LENGTH = 0x20000 /* 128K bytes (alias RAM) */
SRAM_ITC (rwx) : ORIGIN = 0x300, LENGTH = 0x1fd00 /* 130304 bytes (alias RAM2) */
SRAM_OC (rwx) : ORIGIN = 0x20200000, LENGTH = 0xc0000 /* 768K bytes (alias RAM3) */
BOARD_SDRAM (rwx) : ORIGIN = 0x80000000, LENGTH = 0x2000000 /* 32M bytes (alias RAM4) */
}
/* Define a symbol for the top of each memory region */
__base_BOARD_FLASH = 0x60020108 ; /* BOARD_FLASH */
__base_Flash = 0x60020108 ; /* Flash */
__top_BOARD_FLASH = 0x60020108 + 0x3dfef8 ; /* 4062968 bytes */
__top_Flash = 0x60020108 + 0x3dfef8 ; /* 4062968 bytes */
..
ENTRY(ResetISR)
SECTIONS
{
/* 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 = .;
In the map file of the one that works one finds:
0x60020108 __base_BOARD_FLASH = 0x60020108
0x60020108 __base_Flash = 0x60020108
0x61000000 __top_BOARD_FLASH = 0x61000000
0x61000000 __top_Flash = 0x61000000
0x20000000 __base_SRAM_DTC = 0x20000000
0x20000000 __base_RAM = 0x20000000
0x20008000 __top_SRAM_DTC = 0x20008000
0x20008000 __top_RAM = 0x20008000
0x00000300 __base_SRAM_ITC = 0x300
0x00000300 __base_RAM2 = 0x300
0x00008000 __top_SRAM_ITC = 0x8000
0x00008000 __top_RAM2 = 0x8000
0x20200000 __base_SRAM_OC = 0x20200000
0x20200000 __base_RAM3 = 0x20200000
0x20210000 __top_SRAM_OC = 0x20210000
0x20210000 __top_RAM3 = 0x20210000
0x20210000 __base_NCACHE_REGION = 0x20210000
0x20210000 __base_RAM4 = 0x20210000
0x20210000 __top_NCACHE_REGION = 0x20210000
0x20210000 __top_RAM4 = 0x20210000
.text 0x60020108 0x33c4
FILL mask 0xff
0x60020108 __vectors_start__ = ABSOLUTE (.)
*(SORT_BY_ALIGNMENT(.isr_vector))
.isr_vector 0x60020108 0x188 ./startup/startup_mimxrt1011.o
0x60020108 g_pfnVectors
0x60020108 __Vectors
0x60020290 . = ALIGN (0x4)
0x60020290 __section_table_start = .
As can be seen the reset vectors table is at the expected location.
The other, which is expected to be the same has a different address in the map file:
0x60020108 __base_BOARD_FLASH = 0x60020108
0x60020108 __base_Flash = 0x60020108
0x60400000 __top_BOARD_FLASH = 0x60400000
0x60400000 __top_Flash = 0x60400000
0x20000000 __base_SRAM_DTC = 0x20000000
0x20000000 __base_RAM = 0x20000000
0x20020000 __top_SRAM_DTC = 0x20020000
0x20020000 __top_RAM = 0x20020000
0x00000300 __base_SRAM_ITC = 0x300
0x00000300 __base_RAM2 = 0x300
0x00020000 __top_SRAM_ITC = 0x20000
0x00020000 __top_RAM2 = 0x20000
0x20200000 __base_SRAM_OC = 0x20200000
0x20200000 __base_RAM3 = 0x20200000
0x202c0000 __top_SRAM_OC = 0x202c0000
0x202c0000 __top_RAM3 = 0x202c0000
0x80000000 __base_BOARD_SDRAM = 0x80000000
0x80000000 __base_RAM4 = 0x80000000
0x82000000 __top_BOARD_SDRAM = 0x82000000
0x82000000 __top_RAM4 = 0x82000000
.text 0x60020140 0x18f870
FILL mask 0xff
0x60020140 __vectors_start__ = ABSOLUTE (.)
*(SORT_BY_ALIGNMENT(.isr_vector))
.isr_vector 0x60020140 0x2c0 ./startup_mimxrt1062.o
0x60020140 g_pfnVectors
0x60020140 __Vectors
0x60020400 . = ALIGN (0x4)
0x60020400 __section_table_start = .
That means that, although the linker script file (both managed ones) are set up with the same address for flash one sets the reset vector to this address (as expected) but the other set it to 56 bytes after it.
The shifted one doesn't operate due to this and I am frantically searching for a reason why one project builds as expected and another looks to want to align to 64 bytes.
Any ideas?
Regards
Mark