S32K324 seperate core code

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

S32K324 seperate core code

跳至解决方案
3,795 次查看
FelixR
Contributor III

Hey there,

I am investigating how to enable and use the dual-core functionality on the S32K324. There are two questions I can't get my head around:

  1. How do I unlock the two cores to act independently of each other? As far as I understand, they start in the lockstep configuration by default, and the DCMROF19[LOCKSTEP_EN] bit tells me if they are in lockstep or decoupled. But that bit is read-only, so where is the point in the configuration where I can decouple?
  2. How do the cores know which code flash area to read code from? They need to execute separate functions, so they need different main routines that reside in different code flash areas. Do I have to jump with one core to the specified code area I want to execute code from, or does each core have a specific code start address?

thanks in advance

0 项奖励
回复
1 解答
3,774 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @FelixR 

If you have S32K324, it’s already in decoupled mode. This device is considered as dual core.

If you have S32K344 then it is in lock step mode by default and it can be configured to work in decoupled mode, so it will become S32K324 in fact. The configuration can be changed by programming of corresponding DCF record in UTEST flash. But as I said, this is not necessary in case of S32K324.

When you create new project for S32K324 in S32 Design Studio, two projects are created. One for each core. Each project has own linker file, own startup files etc.

It is possible to define which cores will start automatically after reset in Boot Configuration Word in IVT (see “32.5.1 Boot configuration word” in the S32K3 reference manual). Addresses of entry point are defined in IVT. Each core has specific address. A core which is not started in this way can be started by software like this:
MC_ME->PRTN0_CORE1_ADDR = (uint32_t)(vtor); //vtor is an address of vector table
MC_ME->PRTN0_CORE1_PCONF = MC_ME_PRTN0_CORE1_PCONF_CCE_MASK;
MC_ME->PRTN0_CORE1_PUPD = MC_ME_PRTN0_CORE1_PUPD_CCUPD_MASK;
MC_ME->CTL_KEY = MC_ME_CTL_KEY_KEY( 0x5AF0);
MC_ME->CTL_KEY = MC_ME_CTL_KEY_KEY(~0x5AF0);

Regards,

Lukas

在原帖中查看解决方案

6 回复数
2,264 次查看
slawomir-bb
Contributor II

Hello,

Which part of the software shall enable core1?  I'm working on S32k322 and it seems like the only place in the RTD, where these registers are used EnableCore1 routine in startup_cm7.s . However, this part of code is excluded when both MULTIPLE_CORE && MULTIPLE_IMAGE are defined. 

How to start M7_1 core then if both cores are supposed to run different applications? Is therea any RTD function which can be called from M7_0 to start second core? Perhaps there is some MCAL config needed  in S32DS which should be used to run 2nd core?

Best Regards,
Slawomir

0 项奖励
回复
2,257 次查看
FelixR
Contributor III
You can do the register access @lukaszadrapa described inside the solution.
Lets say you have your main inside the M0 core while M1 is still inactive.
Tell M1 where it`s own main function runs by calling:

voind main_on_core_0()
{
// some normal code here
MC_ME->PRTN0_CORE1_ADDR = (uint32)(&main_function_of_core_1);
}


Then tell Core 1 to start via the registers access:
MC_ME->PRTN0_CORE1_PCONF = MC_ME_PRTN0_CORE1_PCONF_CCE_MASK;
MC_ME->PRTN0_CORE1_PUPD = MC_ME_PRTN0_CORE1_PUPD_CCUPD_MASK;
MC_ME->CTL_KEY = MC_ME_CTL_KEY_KEY( 0x5AF0);
MC_ME->CTL_KEY = MC_ME_CTL_KEY_KEY(~0x5AF0);
0 项奖励
回复
2,250 次查看
slawomir-bb
Contributor II

I know, but I wonder if this is the preffered solution, or is it also configurable somewhere, so later it could be overwritten by accident by some generated code.

0 项奖励
回复
3,775 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @FelixR 

If you have S32K324, it’s already in decoupled mode. This device is considered as dual core.

If you have S32K344 then it is in lock step mode by default and it can be configured to work in decoupled mode, so it will become S32K324 in fact. The configuration can be changed by programming of corresponding DCF record in UTEST flash. But as I said, this is not necessary in case of S32K324.

When you create new project for S32K324 in S32 Design Studio, two projects are created. One for each core. Each project has own linker file, own startup files etc.

It is possible to define which cores will start automatically after reset in Boot Configuration Word in IVT (see “32.5.1 Boot configuration word” in the S32K3 reference manual). Addresses of entry point are defined in IVT. Each core has specific address. A core which is not started in this way can be started by software like this:
MC_ME->PRTN0_CORE1_ADDR = (uint32_t)(vtor); //vtor is an address of vector table
MC_ME->PRTN0_CORE1_PCONF = MC_ME_PRTN0_CORE1_PCONF_CCE_MASK;
MC_ME->PRTN0_CORE1_PUPD = MC_ME_PRTN0_CORE1_PUPD_CCUPD_MASK;
MC_ME->CTL_KEY = MC_ME_CTL_KEY_KEY( 0x5AF0);
MC_ME->CTL_KEY = MC_ME_CTL_KEY_KEY(~0x5AF0);

Regards,

Lukas

822 次查看
x86
Contributor II

Hello there,

this is immensely useful.
I am implementing a bootloader and want to enable multicore-support. With this method, it is possible to start an application on Core 1, from Core 0.

However, I want the bootloader to be able to "boot" its own application.
Is it possible for Core0 to relocate its own vector table and jump to a different application?

I assume that one cannot simply write the new VTOR address to MC_ME->PRTN0_CORE0_ADDR and jump to the application at runtime?

Regards,
Matthew

0 项奖励
回复
3,752 次查看
FelixR
Contributor III

Hey @lukaszadrapa 

Thanks! That really helped me!

0 项奖励
回复