2023-01-03 05:46 AM
We have to manually load data to virtual memory adres VMA from Load Memory Adress LMA. But linker also requires the LMA. Look:
.fastcode :
{
. = ALIGN(4);
_sfastcode = .;
*(.fastcode)
. = ALIGN(4);
*(.fastcode*)
. = ALIGN(4);
/* *arm_cortexM7lfdp_math.a:arm_fir_f32.o(.text*)*/
*arm_cortexM7lfdp_math.a:arm_*.o(.text*)
. = ALIGN(4);
_efastcode = .;
} >ITCMRAM AT> FLASH
There you can see FLASH shows the load adress but we must initiate data in the startup:
ldr r0, =_sfastcode
ldr r1, =_efastcode
ldr r2, =_sifastcode
movs r3, #0
b LoopCopyFastcodeInit
CopyFastcodeInit:
ldr r4, [r2, r3]
str r4, [r0, r3]
adds r3, r3, #4
LoopCopyFastcodeInit:
adds r4, r0, r3
cmp r4, r1
bcc CopyFastcodeInit
Then relly there is no action happen by feeding ITCMRAM to LMA?
Solved! Go to Solution.
2023-01-03 09:05 AM
The linker script requires the LMA such that a .bin file can be generated for example. Also in an .elf file must be enough information such that a loader can load that stuff into the flash for persistent storage.
In your above script, a line
_sifastcode = LOADADDR(.fastcode);
is not shown which will provide the .fastcode LMA in a symbol for your copy loop.
The linker itself will not generate code, just may provide symbols for your code.
See also https://sourceware.org/binutils/docs/ld/index.html
hth
KnarfB
2023-01-03 09:05 AM
The linker script requires the LMA such that a .bin file can be generated for example. Also in an .elf file must be enough information such that a loader can load that stuff into the flash for persistent storage.
In your above script, a line
_sifastcode = LOADADDR(.fastcode);
is not shown which will provide the .fastcode LMA in a symbol for your copy loop.
The linker itself will not generate code, just may provide symbols for your code.
See also https://sourceware.org/binutils/docs/ld/index.html
hth
KnarfB