Enabling Memory Protection with MPU on MPC5775E

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

Enabling Memory Protection with MPU on MPC5775E

跳至解决方案
1,712 次查看
WeoWang
NXP Employee
NXP Employee

Hi Dear Colleagues,

My customer got a requirement from their end customer, 

WeoWang_0-1676615954982.pngWeoWang_0-1676615954982.png

Such a lib(.a file should be integrated into a specific RAM address and be protected by MPU.)

I create an MPC5775E example project, and modify the linker file like this:

WeoWang_0-1676616437918.pngWeoWang_0-1676616437918.png

WeoWang_1-1676616497384.pngWeoWang_1-1676616497384.png

Then I build the project and check the .map file, it shows that the .a file has been compiled into the expected address:

WeoWang_2-1676616640652.pngWeoWang_2-1676616640652.pngWeoWang_3-1676616697593.pngWeoWang_3-1676616697593.png

Then, I modify the region address in S32DS:

WeoWang_4-1676616799618.pngWeoWang_4-1676616799618.pngWeoWang_5-1676616854271.pngWeoWang_5-1676616854271.png

After that, I build the project again, with no errors or warnings.

Then I try to debug the project in the EVB, and the code will stack here:

WeoWang_6-1676617177156.pngWeoWang_6-1676617177156.png

It seems that the issue occurs when copying the data from rom to ram.

Then I remove all the changes that I made in the linker file, and change the test address in the mpu memory protection demo:

WeoWang_0-1676621316215.pngWeoWang_0-1676621316215.png

 Set a breakpoint in the IVOR handle:

WeoWang_1-1676621454564.pngWeoWang_1-1676621454564.png

Retry to debug the demo, once I press the sw1 button on EVB, the code will stop in the IVOR handler, which shows that the mpu memory protection feature works at the region that I defined in S32DS.

Do you have any suggestions?

 

Best Regards

Weiyou

 

 

0 项奖励
回复
1 解答
1,686 次查看
Fang_Chen
NXP Employee
NXP Employee

Hello Weo,

I did same thing on my side, and found maybe you missed something. It is not enough to modify the data section in the linker file, the text section is also required. It means you also need to specify a flash address to store the library file. Similarly, the startup file also needs to be modified accordingly so that the system can copy the library file from flash to SRAM. Just like the following pictures show. I verified it on my side and it works. If you have questions, pls contact me. Thanks.

Fang_Chen_0-1676877866219.pngFang_Chen_0-1676877866219.pngFang_Chen_1-1676877918476.pngFang_Chen_1-1676877918476.pngFang_Chen_2-1676877982552.pngFang_Chen_2-1676877982552.png

 

在原帖中查看解决方案

0 项奖励
回复
1 回复
1,687 次查看
Fang_Chen
NXP Employee
NXP Employee

Hello Weo,

I did same thing on my side, and found maybe you missed something. It is not enough to modify the data section in the linker file, the text section is also required. It means you also need to specify a flash address to store the library file. Similarly, the startup file also needs to be modified accordingly so that the system can copy the library file from flash to SRAM. Just like the following pictures show. I verified it on my side and it works. If you have questions, pls contact me. Thanks.

Fang_Chen_0-1676877866219.pngFang_Chen_0-1676877866219.pngFang_Chen_1-1676877918476.pngFang_Chen_1-1676877918476.pngFang_Chen_2-1676877982552.pngFang_Chen_2-1676877982552.png

 

0 项奖励
回复