Linkscripts and how to put all data from a specific object file into a specific part of memory

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Linkscripts and how to put all data from a specific object file into a specific part of memory

ソリューションへジャンプ
3,174件の閲覧回数
nxp16
Contributor III

Hi,

I have at least two object files whose data (.data and .bss) needs to go into SRAM_DTC, and not just their globals.  I have an app that uses USDHC.  If I build a version of this app with all data put in SRAM_DTC by default (using C/C++ Build >Settings > Linker > Managed Linker Script settings), it works perfectly.  However, if I build a version that puts all data into SRAM_OC by default, it doesn't work at all.  I think it's due to some things being accessed via DMA that need to be in DTC.  I know I can use __attribute__ section tags inside my code, but this is not helping.  I need to be able to be able to tell the linker to put an entire .o file of .data/.bss into DTC using a linker file (unless there is another way).  I tried this using the flexspi nor example as a base and modifying it thusly:

linkscripts/bss.ldt:

<#if memory.name=="SRAM_DTC">
*esp_sdio.o(.bss*)
*esp_slave.o(.bss*)
</#if>

data.ldt:

<#if memory.name=="SRAM_DTC">
*esp_sdio.o(.data*)
*esp_slave.o(.data*)
</#if>

main_bss.ldt:

*(EXCLUDE_FILE(*esp_sdio.o *esp_slave.o) .bss*)

main_data.ldt:

*(EXCLUDE_FILE(*esp_sdio.o *esp_slave.o) .data*)

But unfortunately, this causes problems with any other data where I've specifically used __attribute__ section to put things into DTC (they end up in OC instead!) in other object modules.

Can anyone help me with this?

Thanks!

0 件の賞賛
返信
1 解決策
3,169件の閲覧回数
nxp16
Contributor III

It turns out, that it's not just my code.  The sdmmc drivers provided with the sdk do NOT work at all if you default global data placement to SRAM_OC (which I have to do because my full app uses too much ram for DTC).  I was somewhat able to get this working by adding sections to the link settings but not fully yet:

sdio-ram-stuff-10-22-2020 6-14-02 PM.jpg

I will update here when I've figured it out fully.  I wonder if the same problem happens using SDRAM as the default?

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
3,153件の閲覧回数
nxp16
Contributor III

I also had to add fsl_usdhc.o to the list.  Now I just have problems in my own code (well, ESP32's code).  Some of this code uses "buffers" on the stack/heap (uint32_ts and such).  I just have to figure out a good way to make those end up in DTC (because the stack/heap is in OC by default).

0 件の賞賛
返信
3,170件の閲覧回数
nxp16
Contributor III

It turns out, that it's not just my code.  The sdmmc drivers provided with the sdk do NOT work at all if you default global data placement to SRAM_OC (which I have to do because my full app uses too much ram for DTC).  I was somewhat able to get this working by adding sections to the link settings but not fully yet:

sdio-ram-stuff-10-22-2020 6-14-02 PM.jpg

I will update here when I've figured it out fully.  I wonder if the same problem happens using SDRAM as the default?

0 件の賞賛
返信