Questions tagged [embedded-coder]

13 questions
2
votes
0 answers

MatLab Simulink C++ Code Generation error with Bus Selector

I have a Model Predictive Controller for a simulated autonomous vehicle in MatLab. I can currently run simulations using this controller, so I know the model is correct and functional. I am trying to export this model to C++ code using the Embedded…
Cole Newby
  • 21
  • 1
2
votes
1 answer

Matlab Coder force boolean_T to be native C99 bool type

How can I force matlab embedded coder to set "boolean_T" as "bool" C99 type? Without that, I need explicit cast conversion I/O signals mapping for int->boolean_t (not needed for int->bool).
David Bonnin
  • 302
  • 1
  • 13
1
vote
1 answer

Atoi() vulnerability against fault injection

I’m using atoi to convert an string to integer in a embedded c application. However, I could exploit the vulnerability in atoi() using clock glitching fault injection attack. I mean when I have a single or multiple glitch, the processor missed some…
elik1991
  • 73
  • 1
  • 8
0
votes
0 answers

Matlab: Simulink Coder - Generation of header files for every Bus variables

I have added this code snippet to my Simulink Coder project in order to generate a header file for every Bus: % Get all the variables of the workspace vars = evalin('base', 'who'); % Iterate through each variable for i =…
0
votes
1 answer

how to disable Stateflow object eliminated by optimization while code generation?

I have designed a state machine in stateflow. it consists of several variable and states. however, when I am generating code using embedded Coder, multiple states, variables and even transitions are missing from code. on clicking on that particlar…
0
votes
0 answers

Can I make the Parameters Structure public with simulink embedded coder?

I am using Simulink Embedded Coder to generated C++ code of a model block. For my application, I need to access the P, ExtU, and ExtY structures. Simulink Embedded Coder creates all 3 structures as private members of the class. ExtU and ExtY give me…
0
votes
1 answer

Compile a Simulink generated C code using Python (ctypes)

Thanks everyone for your swift replies. I should have mentioned Im not that good with C programming, but from what I got based on Embedded coder (Simulink) documentation is that : ert_main.c (code below) is an example of how to use the model.c In…
0
votes
0 answers

Simulink Coder Error related to path (I believe)

I am learning to use Simulink Coder to convert my models into C++ code. Since I'm starting with this, I am following some Simulink examples. However, I keep getting an error even when following their step-by-step guide. The error is the one in the…
ggpilotto
  • 1
  • 1
0
votes
0 answers

While generating code, the condition (~Input) is converted to ((boolean_T)((int32_T)((Input ? ((int32_T)1) : ((int32_T)0)) ^ 1)))

When I am trying to generate C code with Embedded Coder, the following condition if (~Input) is converted to the following ugly condition if ((boolean_T)((int32_T)((Input ? ((int32_T)1) : ((int32_T)0)) ^ 1))) { Is there any option to change in the…
Mike
  • 1
0
votes
0 answers

I need to build a simulink model that generates this code:

desired code: your textcall_func_init(){ your textINVAR3_sah = INIT_VAL; your text} your textcall_func_mgm(){ your textINVAR3_INCR = INVAR3 - INVAR3_sah; your textINVAR3_sah = INVAR3; your text} I am a beginner and this is just a task my instructor…
0
votes
1 answer

How to configure a coder to generate a constant pointer to a constant variable?

My objective is to configure the Simulink Coder/Embedded Coder to generate for global parameters the following result: extern const real32_T* const globalParameter; Using the Custom Storage Class Designer tool (cscdesigner) I managed to partially…
0
votes
1 answer

Programmatic setting of Argument attribute for parameter in Simulink model workspace

I am using some Matlab m scripts to batch-process a set of Simulink models to produce Autosar software components using Embedded-Coder. I want some of the components to use Port-Parameters defined in a separate Parameter Component rather than…
0
votes
0 answers

Subsystem Parameters Always Mapped to Global Variables in Code Generated by Matlab/Simulink Embedded Coder

For a simple test setup, we want to generate C code from a Simulink subsystem, which has several configuration parameters defined in its block mask. The environment shall be able to modify these parameters and the input signals, and to evaluate the…