フィルターのクリア

LibSystemO​utputCusto​mCode() return function inlining error

1 回表示 (過去 30 日間)
Sathishkumar Chakarapanai
Sathishkumar Chakarapanai 2023 年 10 月 5 日
Hi,
I am aiming to insert a custom code at the begining of model_step()function in an ert system with CodeFormat as "Embedded-C"
for example;
/* Model step function */
void ARM_R5_step(void)
{
----> /* Here I want to Insert my code */
boolean_T rtb_equal_to_count;
/* Sum: '<S1>/Sum' incorporates:
* Constant: '<S1>/INC'
* UnitDelay: '<S1>/X'
*/
/* End of Switch: '<S1>/Switch' */
}
and I have my custom_file_process.tlc file as follow;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Abstract:
%% Example Embedded Coder custom file processing template.
%%
%% Note: This file can contain any valid TLC code, which Embedded Coder
%% executes just prior to writing the generated source files to disk.
%% Using this template "hook" file, you are able to augment the generated
%% source code and create additional files.
%%
%% Copyright 1994-2021 The MathWorks, Inc.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%selectfile NULL_FILE
%% Uncomment this TLC line to execute the example
%% || ||
%% || ||
%% \/ \/
%assign ERTCustomFileTest = TLC_TRUE
%if EXISTS(ERTCustomFileTest) && ERTCustomFileTest == TLC_TRUE
%assign ss = CompiledModel.System[GetBaseSystemIdx()]
%assign CombineOutputUpdateFcns = 1
%openfile tmpBuf
/************************************/
/*** Custom code from TLC ***/
/************************************/
%closefile tmpBuf
%<LibSystemOutputCustomCode(ss,tmpBuf,"declaration")>
%endif
but this result an error shown below,
My question is,
Do you think I'm using the LibSystemOutputCustomCode() function correctly?
Is there another way I could approach this instead of using the LibSystemOutputCustomCode() function?

回答 (1 件)

Mark McBroom
Mark McBroom 2023 年 10 月 12 日
This block should allow you to insert code into the step() function: https://www.mathworks.com/help/ecoder/ref/systemupdate.html
  1 件のコメント
Sathishkumar Chakarapanai
Sathishkumar Chakarapanai 2023 年 10 月 12 日
Hi,
Thanks for your suggestion !
but the system update block is not solving the problem. As mentioned before I am aiming to insert a piece of code at the begining "header" or "declaration" section in model_step function.
If i use system update block to solve this problem it has inserted the custom code to "trailer" section of model_step function.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeTarget Language Compiler についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by