필터 지우기
필터 지우기

How to change memory section setting by script?

조회 수: 2 (최근 30일)
XX
XX 2022년 6월 15일
답변: XX 2022년 6월 16일
How should i change the below scripts?
i have wrote my code generate script in R2016b, but now it's not working properly.
%% model code/data section settings
set_param(bdroot,'MemSecFuncInitTerm', 'NxpCode'); % 代码分配到ROM
set_param(bdroot,'MemSecFuncExecute', 'NxpCode');
set_param(bdroot,'MemSecFuncSharedUtil', 'NxpCode');
set_param(bdroot,'MemSecDataConstants', 'NxpConst'); % 自动生成的常量分配到ROM
set_param(bdroot,'MemSecDataInternal', 'NxpKam'); % 模块静态变量分配到KAM
  댓글 수: 2
XX
XX 2022년 6월 15일
i'm testing use UI, find that const can't be configrated to ROM.
What's wrong?
Generated code:
/* Kam variables define for NXP-S32K */
__attribute__ ((section(".APP_KAM_DATA")))
const ConstP_testcode_T testcode_ConstP = {
/* Computed Parameter: Constant_Value
* Referenced by: '<S1>/Constant'
*/
{ 1U, 3U, 7U }
};
XX
XX 2022년 6월 16일
PARAMETER's section can't be set to IS CONST, i think it's a bug, because when define Simulink.Parameter, it's section should be set to IS CONST.

댓글을 달려면 로그인하십시오.

채택된 답변

XX
XX 2022년 6월 16일
cm = coder.mapping.api.get(bdroot);
setDataDefault(cm,'InternalData','MemorySection','MpcKam')
setDataDefault(cm,'Constants','MemorySection','MpcKam') % THERE IS BUG: SHOULD BE MpcConst, BUT DON'T SUPPORT!
setFunctionDefault(cm,'InitializeTerminate','MemorySection','MpcCode')
setFunctionDefault(cm,'Execution','MemorySection','MpcCode')
setFunctionDefault(cm,'SharedUtility','MemorySection','MpcCode')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 代码生成에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!