Configure AUTOSAR swAddrMethod for global variables automatically generated
13 ビュー (過去 30 日間)
古いコメントを表示
In our Simulink model mapped to AUTOSAR I could mapped each Function to the specific swAddrMethod and I get the code I expected:
/* SwAddrMethod QM_PERIODICAL_CODE for Runnable */
#define MySWComponent_START_SEC_QM_PERIODICAL_CODE
#include "MySWComponent_MemMap.h"
void MyFunc(void)
{
/*****/
}
#define MySWComponent_STOP_SEC_QM_PERIODICAL_CODE
#include "MySWComponent_MemMap.h"
I also create a swAddrMethod = QM_VAR_INIT (sectionType = var)
but how can I map the global variable automatically created after code generation in a specific memory section?
For example after code generation I found the following global struct
/* PublicStructure Variables for Internal Data */
ARID_DEF_CtApOutputSignal_T CtApOutputSignal_ARID_DEF;
and I would like to get something like:
/* SwAddrMethod QM_RTE_VAR_INIT for Internal Data */
#define MySWComponent_START_SEC_QM_VAR_INIT
#include "MySWComponent_MemMap.h"
ARID_DEF_CtApOutputSignal_T CtApOutputSignal_ARID_DEF;
#define MySWComponent_STOP_SEC_QM_VAR_INIT
#include "MySWComponent_MemMap.h"
0 件のコメント
回答 (1 件)
R
2023 年 12 月 28 日
Hi Elisa,
Enabling the 'Generate separate internal data per entry-point function' in the model's config settings allows for assigning memory sections to internal data:
This separation results in distinct structures for the internal data of each runnable. By specifying the SwAddrMethod for internal data of individual runnables as needed, you can generate the desired pragmas/memory sections for internal data.
Please see below screenshots for detailed steps:
Hope this helps!
2 件のコメント
Samim
2024 年 1 月 29 日
Hello, I have the same issue. I tryed the described configurations in Code generation settings for Interface. But I get still the same result.
All functions and variables are mapped correctlictly. But the only chart inside of a subsystem is defined as a publicstructure variable for internal data in the generated c-code, which is not mapped (memory section) at all.
Is there any specific configuration parameter for stateflow logics in code generation section?
#include "CtAp_EMES.h"
#include "Platform_Types.h"
#include "Rte_Type.h"
/* Named constants for Chart: '<S1>/Chart' */
#define CtAp_EMES_IN_InitMode ((uint8)1U)
#define CtAp_EMES_IN_NotReadyMode ((uint8)2U)
*****************************************************************************
*****************************************************************************
/* PublicStructure Variables for Internal Data */
ARID_DEF_CtAp_EMES_T CtAp_EMES_ARID_DEF;/* '<S1>/Chart' */
*****************************************************************************
*****************************************************************************
*** This part is not mapped in memory section.
/* Model step function for TID1 */
/* SwAddrMethod OSCORE1_CODE_1MS for Runnable */
#define CtAp_EMES_START_SEC_OSCORE1_CODE_1MS
#include "CtAp_EMES_MemMap.h"
void EMES_1ms(void) /* Explicit Task: EMES_1ms */
{
float32 tmp;
uint8 EMES_ECUSt;
/* RootInportFunctionCallGenerator generated from: '<Root>/EMES_1ms' incorporates:
* SubSystem: '<Root>/EMES_1ms_sys'
*/
/* Chart: '<S1>/Chart' incorporates:
* Inport: '<Root>/R_IIAL_IDcMeasd_IIAL_IDcMeasd'
* Inport: '<Root>/R_IIAL_bAcvBusWup_IIAL_bAcvBusWup'
* Sum: '<S3>/Add'
*/
if (CtAp_EMES_ARID_DEF.is_active_c3_CtAp_EMES == 0U) {
CtAp_EMES_ARID_DEF.is_active_c3_CtAp_EMES = 1U;
CtAp_EMES_ARID_DEF.is_c3_CtAp_EMES = CtAp_EMES_IN_InitMode;
CtAp_EMES_ARID_DEF.Tick = 0.0F;
CtAp_EMES_ARID_DEF.Time = 4.0F;
CtAp_EMES_ARID_DEF.b = 0U;
EMES_ECUSt = SMECU_Init;
} else if (CtAp_EMES_ARID_DEF.is_c3_CtAp_EMES == CtAp_EMES_IN_InitMode) {
EMES_ECUSt = SMECU_Init;
/* Outputs for Atomic SubSystem: '<S1>/Subsystem' */
/* Sum: '<S3>/Add' incorporates:
* Inport: '<Root>/R_IIAL_IDcMeasd_IIAL_IDcMeasd'
*/
tmp = Rte_IRead_EMES_1ms_R_IIAL_IDcMeasd_IIAL_IDcMeasd();
if ((Rte_IRead_EMES_1ms_R_IIAL_bAcvBusWup_IIAL_bAcvBusWup() == 1) &&
(CtAp_EMES_ARID_DEF.b == 1) && (tmp + tmp > tmp)) {
CtAp_EMES_ARID_DEF.is_c3_CtAp_EMES = CtAp_EMES_IN_NotReadyMode;
CtAp_EMES_ARID_DEF.Tick = 0.0F;
CtAp_EMES_ARID_DEF.b = 0U;
EMES_ECUSt = SMECU_NotReady;
} else {
if (CtAp_EMES_ARID_DEF.Time <= CtAp_EMES_ARID_DEF.Tick) {
CtAp_EMES_ARID_DEF.b = 1U;
}
CtAp_EMES_ARID_DEF.Tick += 0.001F;
}
/* End of Outputs for SubSystem: '<S1>/Subsystem' */
} else {
/* case IN_NotReadyMode: */
EMES_ECUSt = SMECU_NotReady;
if ((Rte_IRead_EMES_1ms_R_IIAL_bAcvBusWup_IIAL_bAcvBusWup() == 0) &&
(CtAp_EMES_ARID_DEF.b == 1)) {
CtAp_EMES_ARID_DEF.is_c3_CtAp_EMES = CtAp_EMES_IN_InitMode;
CtAp_EMES_ARID_DEF.Tick = 0.0F;
CtAp_EMES_ARID_DEF.Time = 4.0F;
CtAp_EMES_ARID_DEF.b = 0U;
EMES_ECUSt = SMECU_Init;
} else {
if (CtAp_EMES_ARID_DEF.Time <= CtAp_EMES_ARID_DEF.Tick) {
CtAp_EMES_ARID_DEF.b = 1U;
}
CtAp_EMES_ARID_DEF.Tick += 0.001F;
}
}
/* End of Chart: '<S1>/Chart' */
/* End of Outputs for RootInportFunctionCallGenerator generated from: '<Root>/EMES_1ms' */
/* Outport: '<Root>/P_EMES_CtrlMode_EMES_CtrlMode' */
Rte_IWrite_EMES_1ms_P_EMES_CtrlMode_EMES_CtrlMode(U_CONTROL);
/* Outport: '<Root>/P_EMES_ECUSt_EMES_ECUSt' */
Rte_IWrite_EMES_1ms_P_EMES_ECUSt_EMES_ECUSt(EMES_ECUSt);
/* Outport: '<Root>/P_EMES_EnControl_EMES_EnControl' */
Rte_IWrite_EMES_1ms_P_EMES_EnControl_EMES_EnControl(Disabled);
/* Outport: '<Root>/P_EMES_RespSst_EMES_RespSst' */
Rte_IWrite_EMES_1ms_P_EMES_RespSst_EMES_RespSst(0U);
/* Outport: '<Root>/P_EMES_StBswShtdnReq_EMES_StBswShtdnReq' */
Rte_IWrite_EMES_1ms_P_EMES_StBswShtdnReq_EMES_StBswShtdnReq(0U);
/* Outport: '<Root>/P_EMES_StCanRdy_EMES_StCanRdy' */
Rte_IWrite_EMES_1ms_P_EMES_StCanRdy_EMES_StCanRdy(0U);
/* Outport: '<Root>/P_EMES_StInin_EMES_StInin' */
Rte_IWrite_EMES_1ms_P_EMES_StInin_EMES_StInin(0U);
/* Outport: '<Root>/P_EMES_StOperModeForCus_EMES_StOperModeForCus' */
Rte_IWrite_EMES_1ms_P_EMES_StOperModeForCus_EMES_StOperModeForCus(0U);
/* Outport: '<Root>/P_EMES_SwRst_EMES_SwRst' */
Rte_IWrite_EMES_1ms_P_EMES_SwRst_EMES_SwRst(0U);
/* Outport: '<Root>/P_EMES_TempWarnSts_EMES_TempWarnSts' */
Rte_IWrite_EMES_1ms_P_EMES_TempWarnSts_EMES_TempWarnSts(0U);
}
#define CtAp_EMES_STOP_SEC_OSCORE1_CODE_1MS
#include "CtAp_EMES_MemMap.h"
/* Model initialize function */
/* SwAddrMethod OSCORE1_CODE_INIT for Runnable */
#define CtAp_EMES_START_SEC_OSCORE1_CODE_INIT
#include "CtAp_EMES_MemMap.h"
void EMES_Init(void)
{
/* SystemInitialize for RootInportFunctionCallGenerator generated from: '<Root>/EMES_1ms' incorporates:
* SubSystem: '<Root>/EMES_1ms_sys'
*/
/* SystemInitialize for Outport: '<Root>/P_EMES_ECUSt_EMES_ECUSt' incorporates:
* Chart: '<S1>/Chart'
*/
Rte_IWrite_EMES_Init_P_EMES_ECUSt_EMES_ECUSt(SMECU_Init);
/* End of SystemInitialize for RootInportFunctionCallGenerator generated from: '<Root>/EMES_1ms' */
}
#define CtAp_EMES_STOP_SEC_OSCORE1_CODE_INIT
#include "CtAp_EMES_MemMap.h"
Thanks a lot for any help!
参考
カテゴリ
Help Center および File Exchange で Deployment, Integration, and Supported Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!