How to solve the RAM resource is not enough on S32K312 ?

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

How to solve the RAM resource is not enough on S32K312 ?

ソリューションへジャンプ
2,720件の閲覧回数
xianlong
Contributor I

Hi,all


If the RAM resource of S32K312 running autosar is not enough and the program dies, Is there any good way to solve the problem?

There are ways we can think of

1. Directly define functions and variables to TCM for execution. This involves modifying the startup file and remapping variables and functions to the specified address

2, it is best to directly turn TCM into RAM. We read about it in the S32K3 Memories Guide, but that chapter is for dual-core. I don't know if the single core S32K312 can also be set to RAM, is there anything to pay attention to?

0 件の賞賛
返信
1 解決策
2,652件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

Yes, TCM can be used as system RAM. In case of S32K312 no configuration is necessary. Mentioned section says something different:

lukaszadrapa_0-1666070959858.png

It makes accessible TCM of disabled core. S32K312 is single core device which is running all the time, so this section does not apply here.

There’s no mechanism which would force variables to another section while current section is full. This is up to user. You need to force selected objects to new section explicitly.

Regards,

Lukas

元の投稿で解決策を見る

0 件の賞賛
返信
8 返答(返信)
2,653件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

Yes, TCM can be used as system RAM. In case of S32K312 no configuration is necessary. Mentioned section says something different:

lukaszadrapa_0-1666070959858.png

It makes accessible TCM of disabled core. S32K312 is single core device which is running all the time, so this section does not apply here.

There’s no mechanism which would force variables to another section while current section is full. This is up to user. You need to force selected objects to new section explicitly.

Regards,

Lukas

0 件の賞賛
返信
2,625件の閲覧回数
xianlong
Contributor I

Hi@lukaszadrapa @ValTek 


    It is too cumbersome to add keywords to each variable, if I define part of the system default sections to dtcm, is it feasible?
1.png
Regards,
xianlong

0 件の賞賛
返信
2,644件の閲覧回数
xianlong
Contributor I

Hi,@lukaszadrapa

   Thank you for your answer .I still have some doubts, If I need to add the section attributes for all the code, it will be a nightmare...
 

Regards,
xianlong

0 件の賞賛
返信
2,634件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

In case of Autosar, please create new ticket here:

https://support.nxp.com/s/?language=en_US

Maybe there's better way but I'm not sure, this is out of my scope.

Regards,

Lukas

0 件の賞賛
返信
2,706件の閲覧回数
ValTek
Contributor III

Hi,

I was posting a similar question.

I also checkout this post:
https://community.nxp.com/t5/S32K/Would-you-share-the-s32k3-RTOS-sample-code-for-refer/m-p/1457368#M...

And download the code, but it is not helping.

I need to configure the TCM as system RAM, as according to the Reference Manual.

I tried some configuration but with no luck...in the AN13388 is contained some code. Particularly:

// Example 5. TCM Configured as System RAM
/********************************** START TCM_Configured as System RAM *****************************/
MC_ME->PRTN2_COFB1_CLKEN |= MC_ME_PRTN2_COFB1_CLKEN_REQ62(1); /* PRTN2_COFB1_CLKEN_[REQ62] = 1 */
/* Enable clock for TCM for CM7_0 */
MC_ME->PRTN2_COFB1_CLKEN |= MC_ME_PRTN2_COFB1_CLKEN_REQ63(1); /* PRTN2_COFB1_CLKEN_[REQ63] = 1 */
/* Enable clock for TCM for CM7_1 */
DCM_GPR->DCMRWF4 |= DCM_GPR_DCMRWF4_cm7_0_cpuwait(1); /* DCMRWF4[CM7_0_CPUWAIT] = 1 */
/* Wait Mode for CM7_0 */
DCM_GPR->DCMRWF4 |= DCM_GPR_DCMRWF4_cm7_1_cpuwait(1); /* DCMRWF4[CM7_1_CPUWAIT] = 1 */
/* Wait Mode for CM7_1 */
MC_ME->PRTN0_CORE0_PCONF |= MC_ME_PRTN0_CORE0_PCONF_CCE(1); /* PRTN0_CORE0_PCONF[CCE] = 1 */
/* Enable Clock for CM7_0 */
MC_ME->PRTN0_CORE1_PCONF |= MC_ME_PRTN0_CORE1_PCONF_CCE(1); /* PRTN0_CORE1_PCONF[CCE] = 1 */
/* Enable Clock for CM7_1 */
/********************************** END TCM_Configured as System RAM *******************************/

 

But this is not for a S32K31x. My question:

1. Is it possible to configure TCM as system RAM with a monocore micro?

2. Is there a demo or a tutorial for that? The Reference manual provide a general description for it.

 

0 件の賞賛
返信
2,699件の閲覧回数
xianlong
Contributor I

Hi, ValTek
Thank you very much for sharing, I have a very bad guess

1. Using TCM as system RAM only allows DMA, EMAC, HSE and other masters to access. (otherwise Kernel-specific access only)

2, As we imagine the way: TCM as extended RAM, when the compiler allocated RAM resources insufficient, automatically allocate part of the data to the TCM address. This method is impossible to implement. If this idea can be realized, can you provide some information?

3. When RAM resources run low, we can only manually add __attribute__ ((section(") "). .dtcm0_code") Load some resources into TCM? Or is there a better way?

0 件の賞賛
返信
2,695件の閲覧回数
ValTek
Contributor III

Hi Xian,
we are discussing same topics this days. Same bad guess...
My comments regarding your list:
1. My idea is to use HSE in TCM, since I'm close to sys ram limit now (so it could be ok);
2. Totally agree with you: this method is impossible to implement, no idea how this could work. What about the stack also? Is at the end of sys ram. We need clarification from NXP;
3. Same as my doubt. If I need to add the section attributes for all the code, it will be a nightmare...

I'm looking for a demo code that could provide TCM capability examples

0 件の賞賛
返信
2,461件の閲覧回数
lijin_zhang
Contributor I

I had the same problem as you. Did you solve it?

0 件の賞賛
返信