AnsweredAssumed Answered

How to split M0 code in multicore project between external SDRAM and internal SRAM using linker scripts

Question asked by Manlio Zanotti on Jul 27, 2016

Hi All,

     I'm working on device based on LPC4350 and use multicore M4F and M0 settings.

I have external SPIFI where all firmware is stored (M0+M4) and external 16MB SDRAM.

I was able to use linker scripts to place some M4 data in external SDRAM and some (most used) in internal 128KB SDRAM.Some code is left on SPIFI.

Actually M0 code/data is completely placed in 72Kbytes internal SRAM butI have few bytes left and I need to free up some bytes moving outside from internal SRAM function/data less used (like initialization functions).

In MCU settings for M0 I have this memory mapping:

So as default the whole code is placed in RamLoc72 but I want to move some functions/data to SDRAM.

Here I encountered big troubles trying to do the above since the M0 axf.o file is then included in M4 axf and thus there's not direct control of where the final code if M0 is stored.

I tryed hard to find a good and clean way to do that using scripts (main_data.ld,text.ldt,etc..) since it doesn't seem to be doable solution.

I tried the below:

1) the first thing I tried was to use __RAMFUNC(RAM2) in front of functions and looking at generated map file I correctly see this function placed in SDRAM. However this doesn't solve the problem since the code is placed in two places: in SDRAM (as wanted) and also in RAM (default places all code there) and startup code of M0 just copy the function data from RAM to SDRAM

2) I flipped SDRAM and RamLoc72 in memory configuration so the default place where LPCxPresso places the M0 code/data is in SDRAM. Then I moved almost all the code to SRAM (using scipts attached) apart startup and main code.

It worked! At least it seemed so...but after some changes to fw I had strange malfunction in the code and I concluded that some memory initialization fails using this method.

So my question is: how to spli code/data of M0 firmware either in internal SRAM and in SDRAM in a clean way?

Thank you for any help!!

Original Attachment has been moved to: main_text_section.ldt.zip

Original Attachment has been moved to: main_text.ldt.zip

Original Attachment has been moved to: main_rodata.ldt.zip

Original Attachment has been moved to: main_data.ldt.zip

Original Attachment has been moved to: bss.ldt.zip

Original Attachment has been moved to: global_section_table.ldt.zip

Original Attachment has been moved to: data_section.ldt.zip

Original Attachment has been moved to: bss_section.ldt.zip

Original Attachment has been moved to: main_bss_section.ldt.zip

Outcomes