1 of 1 people found this helpful
As mentioned in your previous thread, ModusToolbox 2.0 doesn't officially support dual core application development.
However, it is doable. But please note that this isn't tested and there might be potention pitfalls since this is not supported in the current implementation of the tool.
Here's how it can be done. You need to create two applications one for the CM0p and other for the CM4 core.
For the CM0p Application:
Using ModuxToolbox 2.0 create the application targeting the BSP of interest. In the BSP (e.g. TARGET_CY8CPROTO-063-BLE) make the following edits.
1. Copy the CM0P linker script from PDL into the BSP.
2. Create the directories COMPONENT_CM0P and COMPONENT_CM4 in the BSP startup code create directories
3. Move the CM4 C startup code from BSP into a COMPONENT_CM4 directory
4. Copy the CM0P C startup code from PDL into the COMPONENT_CM0P directory
5. Create the directories COMPONENT_CM0P and COMPONENT_CM4 in the BSP startup assembly code create directories
6. Move the CM4 assembly startup code into the COMPONENT_CM4 directory
7. Copy the CM0P assembly startup code from PDL into the BSP directory
8. Remove references to HAL, BSP, etc in the main.c. Keep only references to PDL and call init_cycfg_all() to perform configurator based initialization.
9. In the makefile for the BSP, you need to remove the CY_USING_HAL define.
and remove CY_USING_HAL from the defines line.
10.You will need to update the flash size for any CM0 application that does anything useful. This update will need to be in the CM0P linker script. This update must align
with the flash size and location set for the CM4 application.
ram (rwx) : ORIGIN = 0x08000000, LENGTH = 0x2000
flash (rx) : ORIGIN = 0x10000000, LENGTH = 0x2000
11. Now for the build system to use CM0P core specific folders you defined, you need to specify the default core in "defines.mk" in the directory: "libs\psoc6make\make\recipe\"
Change CM4 to CM0p
# Define the default core
For the CM4 Application:
Using ModusToolbox 2.0 create the application targeting the same BSP selected for the CM0P application. In the BSP (e.g. TARGET_CY8CPROTO-063-BLE) make the following edits. The edits here will just remove the default CM0P image from the CM4 build.
11.Edit the linker script to remove the CM0P image.
remove CM0P_SLEEP from the COMPONENTS variable
- the start flash address in the MEMORY section to where the CM4 image will be placed. Keep in mind that this must be aligned on a 1024 byte boundary since this is where the vector table will be placed. I reserved 8K for the CM0 application and used the line below for the CM4 flash in the linker script.
ram (rwx) : ORIGIN = 0x08002000, LENGTH = 0x45800
flash (rx) : ORIGIN = 0x10002000, LENGTH = 0xFE000
- Remove the linker script code in the SECTIONS part of the file related to the CM0P image.
/* Cortex-M0+ application flash image area */
.cy_m0p_image ORIGIN(flash) :
. = ALIGN(4);
__cy_m0p_code_start = . ;
__cy_m0p_code_end = . ;
} > flash
/* Check if .cy_m0p_image size exceeds FLASH_CM0P_SIZE */
ASSERT(__cy_m0p_code_end <= ORIGIN(flash) + FLASH_CM0P_SIZE, "CM0+ flash image overflows with CM4,
Add code to main.c of CM0p Application to enable CM4 and for any other task intended. Both the application should be able to build and program. Note that you need to program CM0p Application first or else the CM4 application won't be able to run.
But again, this is more of a tweak and I would recommend waiting for the next release of ModusToolbox where we plan to re-enable dual core development.
Thanks a lot for the answer, Dheeraj! It is very informative.
As you said, we will wait for official support on this matter. It's best to use tested tools.
I do have a question, though. Why do we need to remove CY_USING_HAL? Is the HAL currently only supporting the CM4?
Thanks a lot!
I think yes, but haven't tested it. A KBA will be published soon which will provide more information on the Dual Core setup.
That should answer your questions. Thank you for your patience.