code load of MPC5674 in SRAM

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

code load of MPC5674 in SRAM

1,746 次查看
youngseolee
Contributor III

dear NXP. 

 

recently, i develop a firmware of MPC5674F, and have two-question about object code generation and code load in the SRAM.

 

firstly, i use MPC5674F in internal-FLASH mode. In this mode, Can I load a specific function (function_A) into the SRAM by modifying a Linker Command File and a source code? (only function A is loaded in SRAM, and another functions is loaded in Flash memory)

if it is possible, how to set the LCF and the source code.

 

secondly, i wanna generate a binary that contain only a object code of the function A. this feature is possible?

 

I will wait for your answer. have a nice day.

标签 (1)
3 回复数

1,550 次查看
davidtosenovjan
NXP TechSupport
NXP TechSupport

I am attaching example code. It has been tested with different MCU, but principle is the same. Pay attention to the function “test” and linker command file.

 

1) In linker command file -

Added memory segment ‘my_ram’ and section called ‘my_ram’ as well (not necessarily)

 

2)

All function supposed to be relocated are in the code placed be between following pragmas:

#pragma push

#pragma section code_type ".my_ram" ".my_ram" code_mode=far_abs

 

#pragma pop

 

Regarding second question - in case you would like to generate only code for relocated function you would probably have to create new target only for generating function A code what means new linker command file having just only specified mentioned section and segment. How it could be useful for you?

1,550 次查看
youngseolee
Contributor III

i have an additional problem.

i try to test your method in my project, but a error is occurred. (I applied to my project as you reply me.)

The error is as follows.

"Link Error: Linker command file output section '.my_ram' has a type or input which is incompatible with section '.my_ram' in file 'OOO' change the type or add an input for this section.

I can understand this error report, but do not know how to handle it.

how to solve this problem??

0 项奖励
回复

1,550 次查看
youngseolee
Contributor III

thank you for your reply. it help me a lot.

Why did I ask the second question, i currently implement a firmware with the ability to download and execute separate binary code in SRAM.

I want my firmware to have the following features.

for example In the file you attached, the main function is dowonloaded in internal FLASH, test function and test2 function are dowonloaded in SRAM as separate object codes.

as your reply, 

To implement this feature, test function and test2 function is included in the new target project?

0 项奖励
回复