I was running freertos on Infineon’s tc3xx series of chips, and I wanted to run the operating system only on core2, while it is well known that single-core operating systems run on core0 by default. Now that I have an example of core0 running freertos, how do I migrate the rtos to core2? One idea is to modify the port.c file, but I’m not sure what those macro definitions mean or how to assign them.
Hey !!
On a multi-core MCU, each core is supposed to have its own main function. When using an RTOS, this main function is responsible - usually - for task creation and then starting scheduler by calling vTaskStartScheduler()
. If you do it in the main of your second core, the OS will run on it (but the first core will no longer exist from its point of view.)
From what I know the port.c file provided do not contain anything about cores , so I don’t think you’ll require to modify it. (please review your file to confirm)
The steps should be :
- from core 0, clocking the core 1
- Check the reset handler of the core 1 : It’s responsible to branch to the core 1 main function, so you’ll ensure the correct name.
- modify the core 1 main function. It must be the same as core 0 main when FreeRTOS was running on it.
- Core 0 must have instructions to run, But it can’t be the operations to start FreeRTOS. Modify it to run an infinite loop of
nop()
to keep it inactive. You’ll change it later if you find want it do perform some work.
Once it’s done, do not try with complicated tasks. A simple task toggling the state of a GPIO with a timer (basically, a blink demo) is the first thing to do to ensure vital functions of the OS are working.
happy core-1-scheduling
You are probably looking to run FreeRTOS on core2 and not on other cores. How does the core2 start? Depending on that, you may need to partition your memory and update your linker scripts accordingly. This requires deep knowledge about the hardware architecture and your best bet is reaching out to Infineon and ask them.
Thanks for your advice, I am looking for a solution from Infineon.
in ifx_cfg.h, IFX_CFG_TRAP_SYSCALL_CPU0_HOOK(t) should be changed to cpu2.
Thank you for reporting back!