Since I'm not very experienced in working with linker files, can you please have a quick look at what I've "produced"? Note that the rest of the code gets corrupted or throws some kind of segfaults now because I made some rookie mistake.
I added the following:
The Matlab linker file contains some additional lines of code. Do I need them?
Thanks again,
Markus R.
Solved! Go to Solution.
Hi markusransberger,
My recommendation is to start from the MATLAB linker command file and then to integrate your application sections into it.
Nonetheless, if you want to change your custom linker file then i would suggest to:
#1: create a new memory entry to hold all the data related with Flash Programming Algorithm
MEMORY { rbf_section : org = 0x00FA0000, len = 0x0000001F ... }
#2: Place the specific sections related with Flash Programming Algorithm into newly created memory region.
.rchw 0x00FA0000 : { KEEP(*(.rcw)) } > rbf_section .appDelay 0x00FA0008: { KEEP(*(.appDelay)) } > rbf_section .appKeyAddr 0x00FA000C : { KEEP(*(.appKeyAddr)) } > rbf_section
appDelay and appKeyAddr sections are generated from *.c file equivalent code
#pragma section USER ".appDelay" "" far-absolute R #pragma use_section USER appDelay const uint32_t appDelay = 5000000; #pragma section USER2 ".appKeyAddr" "" far-absolute R #pragma use_section USER2 appKeyAddr const uint32_t appKeyAddr = ( uint32_t )&appKey;
rcw section is generated from *.s file equivalent code
;#************************** .rcw reset config section *************************/ .section .rcw, "a" .LONG 0x005A0001 ;# BH conf: IOP Only - Can boot others via ME
The additional linker declaration from MATLAB default LCF must also be kept - especially the .appKey
The additional sections like .ctor and .dtor must also be kept in case you use the GCC compiler
Hope this help!
Daniel
Hi markusransberger,
My recommendation is to start from the MATLAB linker command file and then to integrate your application sections into it.
Nonetheless, if you want to change your custom linker file then i would suggest to:
#1: create a new memory entry to hold all the data related with Flash Programming Algorithm
MEMORY { rbf_section : org = 0x00FA0000, len = 0x0000001F ... }
#2: Place the specific sections related with Flash Programming Algorithm into newly created memory region.
.rchw 0x00FA0000 : { KEEP(*(.rcw)) } > rbf_section .appDelay 0x00FA0008: { KEEP(*(.appDelay)) } > rbf_section .appKeyAddr 0x00FA000C : { KEEP(*(.appKeyAddr)) } > rbf_section
appDelay and appKeyAddr sections are generated from *.c file equivalent code
#pragma section USER ".appDelay" "" far-absolute R #pragma use_section USER appDelay const uint32_t appDelay = 5000000; #pragma section USER2 ".appKeyAddr" "" far-absolute R #pragma use_section USER2 appKeyAddr const uint32_t appKeyAddr = ( uint32_t )&appKey;
rcw section is generated from *.s file equivalent code
;#************************** .rcw reset config section *************************/ .section .rcw, "a" .LONG 0x005A0001 ;# BH conf: IOP Only - Can boot others via ME
The additional linker declaration from MATLAB default LCF must also be kept - especially the .appKey
The additional sections like .ctor and .dtor must also be kept in case you use the GCC compiler
Hope this help!
Daniel
This definitely does help, but I would like to edit the S32DS linker file since its structure looks clearer to me. That's why I asked if I made a rookie mistake there. But so far so good, I encountered no problems with my own solution so far. Thank you nonetheless!
For all readers, since the above question was in another thread before, in addition to the updated linker file, I also added these three lines before my main():
const uint32_t appKey __attribute__((__section__(".appKey"))) = 0x55AA55AA;
const uint32_t appDelay __attribute__((__section__(".appDelay"))) = 5000000;
const uint32_t appKeyAddr __attribute__((__section__(".appKeyAddr"))) = ( uint32_t )&appKey;
But use this version at your own risk, Daniel's solution is probably the better one.
Kind regards,
Markus R.