How to create and debug a single executable project on multiple cores using the SDK on MPC5748G?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to create and debug a single executable project on multiple cores using the SDK on MPC5748G?

707 Views
davidanderle
Contributor II

Hello,

I am struggling to create a project with a single elf output where after my own hardware initialisation, the z4_0 core turns on the z2 core to take over tasks.

I am aware of the SingleElf_MPC5748G and multi-core example projects like the interrupt_control_multicore, however I would need their merger, ideally with the least extra custom code (using the SDK's startup code for example).

Is there a way to do this? I understand that I may need to modify my linker file for this.

Thanks for any help!

 

0 Kudos
4 Replies

695 Views
davidanderle
Contributor II

Hi Peter, 

Thank you for the quick reply. I am using a bare-metal approach which should simplify things on this front.

Due to the legal framework I'm working in, managing multiple executables on a single controller would be far from ideal. Additionally, since there's some coupling between the cores, I would need to duplicate some code between projects which is undesirable.I have written plenty of bare-metal startup codes in IAR for ARM with custom linker scripts, so I have some expertise in this. However, PPC and S32DS is new to me.
If my understanding is correct, this is what I need to do:

  1. Let the SDK's startup script run on Z4_0 without turning on any of the cores. This takes care of watchdog, memory, and vector table initialisation.
  2. Initialise my hardware's internal (Clock, I2C, SPI, CAN, etc..) and external peripherals (DAC, ADC, etc..) on Z4_0
  3. Turn on the desired cores (z2 in my case) and point them to a startup script. This is done though MC_ME[CCTL3], MC_ME[CADDR3]
  4. Issue a mode transition (DRUN -> DRUN) to turn on the extra cores at their startup script through the MC_ME[MCTL].
  5. Do stuff on all cores happily

My gap in knowledge currently is in the startup script as I'm not yet versed in PA assembly. I need to understand what sections to include/modify/update in the GCC linker script and what's the minimum necessary startup code to start the core(s). 

0 Kudos

669 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

Your approach is basically correct.

  1. Let the SDK's startup script run on Z4_0 without turning on any of the cores. This takes care of watchdog, memory, and vector table initialization.

    Yes

  2. Initialize my hardware's internal (Clock, I2C, SPI, CAN, etc..) and external peripherals (DAC, ADC, etc..) on Z4_0

    Not necessarily. This is application specific. But usually you initialize those before going into the safety application execution.

3.Turn on the desired cores (z2 in my case) and point them to a startup script. This is done though MC_ME[CCTL3], MC_ME[CADDR3]

         This also depends. If you do initialization on Z4, as the memories and peripherals  are common. You can start with code execution directly, if they are already configured/initialized.

4. Issue a mode transition (DRUN -> DRUN) to turn on the extra cores at their startup script through the MC_ME[MCTL].

      Yes

Best regards,

Peter

0 Kudos

663 Views
davidanderle
Contributor II

Hi Peter,

Thank you, in the meantime I managed to make it work with minimal extra code. 

David

0 Kudos

699 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

Creating a single elf for multicore project is quite challenging. I am not sure what you want to achieve by it, but it requires good knowledge on compiler and project manager. (no matter which one you use).

I do not expect there is already example code in SDK for such case.

As you are talking  about tasks I expect you are using some OS, this makes things even harder.

Do you really want to use the single output file for multiple cores? What is the reason for that?

Best regards,

Peter

0 Kudos