Memory mapping in generated Autosar compliant C code with MATLAB

조회 수: 18 (최근 30일)
Adam
Adam 2022년 10월 25일
답변: Tomasz 2024년 9월 6일
I am trying to solve my issue as to generate an AUTOSAR compliant C code form MATLAB. I successfully created memory segments around vars/functions, like this:
#define CAN_START_SEC_VAR_8BIT
#include “MemMap.h”
static uint8 myvar_1;
#define CAN_STOP_SEC_VAR_8BIT
#include “MemMap.h”
#define CAN_START_SEC_VAR_8BIT
#include “MemMap.h”
static uint8 myvar_2;
#define CAN_STOP_SEC_VAR_8BIT
#include “MemMap.h”
What I can not figure out, and I would be really grateful if you could lend a hand here is that: For all the different functions/vars a new memory segment opens and close. Even if the segment is the same. This is bad, because it takes time to read multiply times the same opening and closing segments. Do you know any way to prevent this and group those vars/functions within the same memory segment, which have matching starting and closing segment? so it would be like this:
#define CAN_START_SEC_VAR_8BIT
#include “MemMap.h”
static uint8 myvar_1;
static uint8 myvar_2;
#define CAN_STOP_SEC_VAR_8BIT
#include “MemMap.h”
I looked into:
>> cscdesigner
and
App -> AUTOSAR Component... -> Settings -> C/C++ Code Generation options -> Code generation
But could not find anything for this issue.
Thanks a lot for any advice and have a good day!
  댓글 수: 2
Giosué Carducci
Giosué Carducci 2023년 6월 14일
Hi,
could you share the model?
I have an issue while I try to define that stati variables.
Please, could you help me?
I can find also a way to put both variables in only one memory section.
Thanks
Giosuè
Djordje
Djordje 2024년 7월 17일
Hello,
Could you please explain procedure to create memory segments:
"I successfully created memory segments around vars/functions"
BR,
Djordje

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

답변 (2개)

Riad
Riad 2023년 9월 12일
Hello,
If I understand well, you want that the pragma is written for a group of vars. If so, you should set the property 'PragmaPerVar', in the Simulink.MemorySectionDefn (in the cscdesigner script) to false:
set(h, 'PragmaPerVar', false);

Tomasz
Tomasz 2024년 9월 6일
In cscdesigner in Memory Section there is drop down menu "Statement around" with two options 1. Group of variables. 2. Each variable.

카테고리

Help CenterFile Exchange에서 AUTOSAR Blockset에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by