Hi,
I relay a message from my colleague. He will join the discussion thread as soon as possible.
The attachments he indicated are attached to this message; I had to change the extension of "imxrt1062_t41.ld" in order for the forum to allow attaching this file.
I have modified the two indicated files ("imxrt1062_t41.ld" and "startup.c") as you suggested. You can find attached the two modified files. Each indicated modification in this email has as reference the Line form file when the modification was applied.
The modification done in "imxrt1062_t41.ld" are:
- a new SECTION called ".text.extram" is added (Line 42 - Line 47)
NOTE: a similar section to ".text.itcm" is added by with "> ERAM AT> FLASH"
- new sections added: _sExttext, _eExttext, _sExttextload (Line 85 - Line 87)
NOTE: similar sections to _stext, _etext and _stextload are added and they use as address ".text.extram"
- modified section: _flashimagelen (Line 103)
NOTE: SIZEOF(.text.extram) is now included when computing _flashimagelen
The modification done in "startup.c" are:
- add _sExttextload, _sExttext and _eExttext (as extern unsigned long) similar to _stextload, _stext and _etext (Line 13 - Line 15)
- initialize external memory after the call of configure_external_ram():
a) memory_copy(&_sExttext, &_sExttextload, &_eExttext); (Line 138)
b) memory_copy(&_sdata, &_sdataload, &_edata); (Line 139)
- Remove NOEXEC flag for external memory at cache config
NOTE: SCB_MPU_RASR = MEM_CACHE_WBWA | READWRITE | SIZE_16M; (Line 272)
Could you please review the modification and let me know your feedback.
Additionally, could you kindly please confirm if the following code of function "int testFcn(int a)" is specifing the linker to compile it in external RAM?
int testFcn (int a)
__attribute__((section (".text.extram")));
int testFcn (int a)
{
int ErrCode;
if(a%2==0)
{
ErrCode = 0;
}
else
{
ErrCode = 1;
}
return ErrCode;
}
Thank you!
View attachment startup.c
View attachment imxrt1062_t41.ld.txt