MPC5748G Shared Memory Accross Core Only Works in Debug

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MPC5748G Shared Memory Accross Core Only Works in Debug

跳至解决方案
1,507 次查看
EmbeddedS
Contributor I

Hi All,

I've created a project, that specifies a shared memory section in the flash across Core 0 (Z4_0) and Core 1 (Z4_1) of the MPC5748G development board.

I've configured LEDs PA10 and DS11 to represent Core 0 running properly. I've also configured LEDs PA7 and DS10 to represent Core 1 running properly. In Debug, there's no issue.

When i terminate the debug session and reconnect the board - my project fails.

If I comment out any shared memory section access, everything works in debug or standard.

What am i missing ? I've attached the project in this post.

0 项奖励
回复
1 解答
1,448 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Ok, I expected that the elf files are up to date.

Anyway, it's caused by missing RAM initialization.

Core Z4_0 initializes first 256KB by its startup file:

lukaszadrapa_0-1743409795175.png

Core Z4_1 initializes  next 256KB:

lukaszadrapa_1-1743409825998.png

Remaining 256KB is usually initialized by Z2 core which is not present in your project... even if it is defined in project properties:

lukaszadrapa_2-1743409933768.png

 

So, you put shared_memory to those last 256KB:

lukaszadrapa_3-1743410041809.png

 But it's not initialized:

lukaszadrapa_4-1743410088327.png

If you use debugger in S32DS, it initializes whole RAM explicitly. If you run without debugger, it will crash on bus error when accessing uninitialized RAM.

You need to ensure that also this RAM is initialized.

Regards,

Lukas

 

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,492 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @EmbeddedS 

Was this code really working in debug mode?

I just load your elf files to my board (I didn't compile the projects again) and I can see that rxCAN is optimized out and it looks like the code in main.c does not correspond to elf file in the Z4_1 project.

Regards,

Lukas

0 项奖励
回复
1,480 次查看
EmbeddedS
Contributor I

This code definitely compiles and runs in debug mode.

Under "Z4_0 / Sources / shared_mem.c" rxCAN is defined as volatile. I may of commented out "rxCAN" the last time I compiled, for testing purposes. 

I've linked Z4_0's compiled shared_func and shared_mem ".o" files under Z4_1's project properties. This was a hardcoded path on my machine, so will need to be changed for another machine. 

When you reference the code in main.c, is this for Z4_0 or Z4_1? I've changed my boot order to Z4_0 first if this is what's causing confusion. 

0 项奖励
回复
1,449 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Ok, I expected that the elf files are up to date.

Anyway, it's caused by missing RAM initialization.

Core Z4_0 initializes first 256KB by its startup file:

lukaszadrapa_0-1743409795175.png

Core Z4_1 initializes  next 256KB:

lukaszadrapa_1-1743409825998.png

Remaining 256KB is usually initialized by Z2 core which is not present in your project... even if it is defined in project properties:

lukaszadrapa_2-1743409933768.png

 

So, you put shared_memory to those last 256KB:

lukaszadrapa_3-1743410041809.png

 But it's not initialized:

lukaszadrapa_4-1743410088327.png

If you use debugger in S32DS, it initializes whole RAM explicitly. If you run without debugger, it will crash on bus error when accessing uninitialized RAM.

You need to ensure that also this RAM is initialized.

Regards,

Lukas

 

0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-2070249%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EMPC5748G%20%E8%B7%A8%E6%A0%B8%E5%BF%83%E5%85%B1%E4%BA%AB%E5%86%85%E5%AD%98%E4%BB%85%E5%9C%A8%E8%B0%83%E8%AF%95%E4%B8%AD%E6%9C%89%E6%95%88%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2070249%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E5%A4%A7%E5%AE%B6%E5%A5%BD%EF%BC%8C%3C%2FP%3E%3CP%3E%E6%88%91%E5%88%9B%E5%BB%BA%E4%BA%86%E4%B8%80%E4%B8%AA%E9%A1%B9%E7%9B%AE%EF%BC%8C%E5%AE%83%E6%8C%87%E5%AE%9A%E4%BA%86%20MPC5748G%20%E5%BC%80%E5%8F%91%E6%9D%BF%E7%9A%84%E6%A0%B8%E5%BF%83%200%EF%BC%88Z4_0%EF%BC%89%E5%92%8C%E6%A0%B8%E5%BF%83%201%EF%BC%88Z4_1%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%B7%A5%E4%BD%9C%E3%80%82%3C%2FP%3E%3CP%3E%E6%88%91%E9%94%99%E8%BF%87%E4%BA%86%E4%BB%80%E4%B9%88%EF%BC%9F%E6%88%91%E5%B7%B2%E5%B0%86%E8%AF%A5%E9%A1%B9%E7%9B%AE%E9%99%84%E5%8A%A0%E5%88%B0%E6%AD%A4%E5%B8%96%E5%AD%90%E4%B8%AD%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2070612%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9AMPC5748G%20%E8%B7%A8%E6%A0%B8%E5%BF%83%E5%85%B1%E4%BA%AB%E5%86%85%E5%AD%98%E4%BB%85%E5%9C%A8%E8%B0%83%E8%AF%95%E4%B8%AD%E6%9C%89%E6%95%88%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2070612%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E8%AF%A5%E4%BB%A3%E7%A0%81%E8%82%AF%E5%AE%9A%E5%8F%AF%E4%BB%A5%E5%9C%A8%E8%B0%83%E8%AF%95%E6%A8%A1%E5%BC%8F%E4%B8%8B%E7%BC%96%E8%AF%91%E5%92%8C%E8%BF%90%E8%A1%8C%E3%80%82%3C%2FP%3E%3CP%3E%E5%9C%A8%E2%80%9CZ4_0%20%2F%20Sources%20%2F%20shared_mem.c%E2%80%9D%E4%B8%8BrxCAN%20%E8%A2%AB%E5%AE%9A%E4%B9%89%E4%B8%BA%E6%98%93%E5%A4%B1%E6%80%A7%E7%9A%84%E3%80%82%E4%B8%BA%E4%BA%86%E6%B5%8B%E8%AF%95%E7%9B%AE%E7%9A%84%EF%BC%8C%E6%88%91%E4%B8%8A%E6%AC%A1%E7%BC%96%E8%AF%91%E6%97%B6%E5%8F%AF%E8%83%BD%E6%B3%A8%E9%87%8A%E6%8E%89%E4%BA%86%E2%80%9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