【简介】
S32DS 在创建工程时可以选择使用多个核心,这样就会给每个核创建一个工程。本地使用的S32K324 平台。多核启动的管理在CORE0 的启动文件中配置,启动文件每个核心使用的为同一个文件只是每个核心编译配置中使用的配置不同,以下启动core1 的核心代码。
/******************************************************************************/ /* MSCM initialization process */ /* Only Master core can initialize clock for MSCM module in multicore testing */ /******************************************************************************/ #ifndef NO_MSCM_CLOCK_INIT InitMSCMClock: /* If the MSCM clock is enabled, skip this sequence */ ldr r0, =MCME_PRTN1_COFB0_STAT ldr r1, [r0] ldr r2, =MCME_MSCM_REQ and r1, r1, r2 cmp r1, 0 bne EndInitMSCMClock /* Step1: Enable clock in PRTN1 */ ldr r0, =MCME_PRTN1_COFB0_CLKEN ldr r1, [r0] ldr r2, =MCME_MSCM_REQ orr r1, r2 str r1, [r0] /* Step2: Set PUPD field */ ldr r0, =MCME_PRTN1_PUPD ldr r1, [r0] ldr r2, =1 orr r1, r2 str r1, [r0] /* Step3: Trigger update by writing valid key */ ldr r0, =MCME_CTL_KEY ldr r1, =MCME_KEY str r1, [r0] ldr r1, =MCME_INV_KEY str r1, [r0] /* Step4: Wait for process to complete */ WaitForInitProcess: ldr r0, =MCME_PRTN1_PUPD ldr r1, [r0] ldr r2, =1 and r1, r1, r2 cmp r1, 1 beq WaitForInitProcess #endif /* Step5: Check if the MSCM clock is enabled */ #ifndef SIM_TYPE_VDK WaitForClock: ldr r0, =MCME_PRTN1_COFB0_STAT ldr r1, [r0] ldr r2, =MCME_MSCM_REQ and r1, r1, r2 cmp r1, 0 beq WaitForClock #endif #ifndef NO_MSCM_CLOCK_INIT EndInitMSCMClock: #endif
上述代码为配置其他核的时钟配置,配置好之后就已经将core1 启动了。 NO_MSCM_CLOCK_INIT 宏定义是根据是否是主核的镜像来配置。

辅核在启动后等待时钟配置完成后继续运行。上述代码时钟使能流程和RM 文档中的以下流程保持一致。

基于上述流程,我们可以创建两个核心的镜像在两个核上添加打印,两个核都按照预期的启动成功。

我要赚赏金
