PSoC 6 Dual CPU Linker failure

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
StKr_1203736
Level 3
Level 3
First like received 10 replies posted 10 sign-ins

Build environment: PSoC Creator 4.4, Windoze 7, PDL 3.1.3
Target Hardware: CY8PROTO-063-BLE

I am working on a project that started out as the PSoC 6 BLE Battery Service demo. I moved everything related to BLE to the M0P CPU, because that is how my system will be structured - I have lots of other things for the M4 to do, including making use of the FPU.

I was able to get this to build and run without any particular issues. There was nothing running on the M4 except the default code to put it to sleep.

I have now started to implement the M4 code, which includes some hardware that will be dedicated to the M4. But so far, no actual code that does anything. There is some shared source code, but it is not called on the M4.. yet.

Now the linker step of the build fails, indicating that something went wrong during the process of merging the code for the two CPUs.

There are no errors reported up to this point:
\Debug\cy_ble_event_handler.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_ancs.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_ans.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_aios.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_bas.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_bcs.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_bls.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_bms.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_bts.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_cgms.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_cps.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_cscs.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_cts.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_custom.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_dis.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_ess.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_gls.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_hids.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_hps.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_hrs.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_hts.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_ias.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_ips.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_lls.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_lns.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_ndcs.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_plxs.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_pass.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_rscs.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_rtus.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_scps.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_tps.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_uds.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_wpts.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_wss.o .\CortexM0p\ARM_GCC_541\Debug\cy_ble_clk.o .\CortexM0p\ARM_GCC_541\Debug\timer.o .\CortexM0p\ARM_GCC_541\Debug\I2C.o .\CortexM0p\ARM_GCC_541\Debug\ADC.o .\CortexM0p\ARM_GCC_541\Debug\ADC_INT.o .\CortexM0p\ARM_GCC_541\Debug\ADC_INIT.o .\CortexM0p\ARM_GCC_541\Debug\ADC_PM.o .\CortexM0p\ARM_GCC_541\Debug\SPI.o -mcpu=cortex-m0plus -mthumb -L Generated_Source\PSoC6 -Wl,-Map,.\CortexM0p\ARM_GCC_541\Debug/PSoC6_BLE_UI.map -T cy8c6xx7_cm0plus.ld -specs=nano.specs -Wl,--gc-sections -g -ffunction-sections -Og -ffat-lto-objects -Wl,--end-group
.\CortexM0p\ARM_GCC_541\Debug\startup_psoc6_01_cm4.o: In function `__StackTop':
(.stack+0x1000): multiple definition of `__StackTop'
.\CortexM0p\ARM_GCC_541\Debug\startup_psoc6_01_cm0plus.o:(.stack+0x1000): first defined here
.\CortexM0p\ARM_GCC_541\Debug\startup_psoc6_01_cm4.o: In function `__StackLimit':
C:\projects\ib\Roadkill\05_PSoC6\PSoC6_BLE_UI\PSoC6_BLE_UI.cydsn/gcc/startup_psoc6_01_cm4.S:273: multiple definition of `__StackLimit'
.\CortexM0p\ARM_GCC_541\Debug\startup_psoc6_01_cm0plus.o:C:\projects\ib\Roadkill\05_PSoC6\PSoC6_BLE_UI\PSoC6_BLE_UI.cydsn/gcc/startup_psoc6_01_cm0plus.S:157: first defined here
.\CortexM0p\ARM_GCC_541\Debug\startup_psoc6_01_cm4.o: In function `__HeapBase':
C:\projects\ib\Roadkill\05_PSoC6\PSoC6_BLE_UI\PSoC6_BLE_UI.cydsn/gcc/startup_psoc6_01_cm4.S:273: multiple definition of `__HeapBase'
.\CortexM0p\ARM_GCC_541\Debug\startup_psoc6_01_cm0plus.o:C:\projects\ib\Roadkill\05_PSoC6\PSoC6_BLE_UI\PSoC6_BLE_UI.cydsn/gcc/startup_psoc6_01_cm0plus.S:157: first defined here
.\CortexM0p\ARM_GCC_541\Debug\startup_psoc6_01_cm4.o: In function `__HeapLimit':
(.heap+0x400): multiple definition of `__HeapLimit'
.\CortexM0p\ARM_GCC_541\Debug\startup_psoc6_01_cm0plus.o:(.heap+0x400): first defined here
.\CortexM0p\ARM_GCC_541\Debug\startup_psoc6_01_cm4.o: In function `__Vectors':
C:\projects\ib\Roadkill\05_PSoC6\PSoC6_BLE_UI\PSoC6_BLE_UI.cydsn/gcc/startup_psoc6_01_cm4.S:273: multiple definition of `__Vectors'
.\CortexM0p\ARM_GCC_541\Debug\startup_psoc6_01_cm0plus.o:C:\projects\ib\Roadkill\05_PSoC6\PSoC6_BLE_UI\PSoC6_BLE_UI.cydsn/gcc/startup_psoc6_01_cm0plus.S:157: first defined here
ERROR: Warning: size of symbol `__Vectors' changed from 192 in .\CortexM0p\ARM_GCC_541\Debug\startup_psoc6_01_cm0plus.o to 652 in .\CortexM0p\ARM_GCC_541\Debug\startup_psoc6_01_cm4.o
.\CortexM0p\ARM_GCC_541\Debug\startup_psoc6_01_cm4.o: In function `__ramVectors':
C:\projects\ib\Roadkill\05_PSoC6\PSoC6_BLE_UI\PSoC6_BLE_UI.cydsn/gcc/startup_psoc6_01_cm4.S:273: multiple definition of `__ramVectors'
.\CortexM0p\ARM_GCC_541\Debug\startup_psoc6_01_cm0plus.o:C:\projects\ib\Roadkill\05_PSoC6\PSoC6_BLE_UI\PSoC6_BLE_UI.cydsn/gcc/startup_psoc6_01_cm0plus.S:157: first defined here
ERROR: Warning: size of symbol `__ramVectors' changed from 192 in .\CortexM0p\ARM_GCC_541\Debug\startup_psoc6_01_cm0plus.o to 652 in .\CortexM0p\ARM_GCC_541\Debug\startup_psoc6_01_cm4.o
.\CortexM0p\ARM_GCC_541\Debug\main_cm4.o: In function `main':
C:\projects\ib\Roadkill\05_PSoC6\PSoC6_BLE_UI\PSoC6_BLE_UI.cydsn/main_cm4.c:55: multiple definition of `main'
.\CortexM0p\ARM_GCC_541\Debug\main_cm0p.o:C:\projects\ib\Roadkill\05_PSoC6\PSoC6_BLE_UI\PSoC6_BLE_UI.cydsn/main_cm0p.c:56: first defined here
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm4.o: In function `SystemCoreClockUpdate':
C:\projects\ib\Roadkill\05_PSoC6\PSoC6_BLE_UI\PSoC6_BLE_UI.cydsn/system_psoc6_cm4.c:290: multiple definition of `SystemCoreClockUpdate'
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm0plus.o:C:\projects\ib\Roadkill\05_PSoC6\PSoC6_BLE_UI\PSoC6_BLE_UI.cydsn/system_psoc6_cm0plus.c:295: first defined here
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm4.o: In function `SystemInit':
system_psoc6_cm4.c:(.text.SystemInit+0x0): multiple definition of `SystemInit'
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm0plus.o:system_psoc6_cm0plus.c:(.text.SystemInit+0x0): first defined here
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm4.o:(.data+0x1c): multiple definition of `cy_delay32kMs'
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm0plus.o:(.data+0x1c): first defined here
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm4.o:(.data+0x14): multiple definition of `cy_delayFreqMhz'
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm0plus.o:(.data+0x14): first defined here
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm4.o:(.data+0x18): multiple definition of `cy_delayFreqKhz'
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm0plus.o:(.data+0x18): first defined here
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm4.o:(.data+0x10): multiple definition of `cy_delayFreqHz'
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm0plus.o:(.data+0x10): first defined here
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm4.o:(.data+0x0): multiple definition of `cy_BleEcoClockFreqHz'
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm0plus.o:(.data+0x0): first defined here
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm4.o:(.data+0x8): multiple definition of `cy_PeriClkFreqHz'
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm0plus.o:(.data+0x8): first defined here
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm4.o:(.data+0x4): multiple definition of `cy_Hfclk0FreqHz'
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm0plus.o:(.data+0x4): first defined here
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm4.o:(.data+0xc): multiple definition of `SystemCoreClock'
.\CortexM0p\ARM_GCC_541\Debug\system_psoc6_cm0plus.o:(.data+0xc): first defined here
collect2.exe: error: ld returned 1 exit status
The command 'arm-none-eabi-gcc.exe' failed with exit code '1'.
--------------- Rebuild Failed: 04/16/2021 10:56:00 ---------------

What happened here? How do I fix this?

0 Likes
1 Solution
StKr_1203736
Level 3
Level 3
First like received 10 replies posted 10 sign-ins

I removed my 'shared' source code, and scattered it to the CPUs in duplicate.
The result is:

StKr_1203736_0-1618855048219.png

I assume this will not get resolved, and the problem lies in some obscure CY file that is damaged.
I went back to a previous version of my code, and incrementally added pieces and checked the build, until it was essentially the same as what I was trying to debug. I am now able to build my code, although I have not (yet) tried to run it. The only remaining error is:
Analog Code Generation...
Digital Placement...
Warning: placer did not place the following components:
\ADC:SARMUX\:SARMUX
Digital Routing...
Bitstream Generation...
Based on other threads where MANY people complained about this error, I assume it will not be resolved, either. See https://community.cypress.com/t5/PSoC-6-MCU/Digital-Placement-Warning-placer-did-not-place-the-follo...

View solution in original post

0 Likes
6 Replies
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @StKr_1203736

The linker is complaining that it is able to find multiple definitions of the start-up code.  

There is some shared source code, but it is not called on the M4.. yet.

Can you please provide more information about the shared source code? How are you sharing the code between the 2 CPUs? From your explanation, it seems that you are getting this error after doing this step. Can you please let us know if it would be possible for you to share your project on this thread?

Thanks and Regards,
Rakshith M B
0 Likes
StKr_1203736
Level 3
Level 3
First like received 10 replies posted 10 sign-ins

There is startup code for both CPUs because.. there are two CPUs. I don't think I can send the entire project, but there is the file list in project explorer. Note that I have added just ONE C file to M4 (micaComms.c) and it is not actually called by M4.

StKr_1203736_0-1618841208031.png

 

0 Likes
StKr_1203736
Level 3
Level 3
First like received 10 replies posted 10 sign-ins

I removed my 'shared' source code, and scattered it to the CPUs in duplicate.
The result is:

StKr_1203736_0-1618855048219.png

I assume this will not get resolved, and the problem lies in some obscure CY file that is damaged.
I went back to a previous version of my code, and incrementally added pieces and checked the build, until it was essentially the same as what I was trying to debug. I am now able to build my code, although I have not (yet) tried to run it. The only remaining error is:
Analog Code Generation...
Digital Placement...
Warning: placer did not place the following components:
\ADC:SARMUX\:SARMUX
Digital Routing...
Bitstream Generation...
Based on other threads where MANY people complained about this error, I assume it will not be resolved, either. See https://community.cypress.com/t5/PSoC-6-MCU/Digital-Placement-Warning-placer-did-not-place-the-follo...

0 Likes
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @StKr_1203736

I checked with the internal team regarding the warning. The warning should not be causing any issues.  The SAR Mux is not a physical instance that gets placed; similar to a normal AMux it gets synthesized by the analog place & route. It is therefore supposed to be filtered out of what is given to the digital placer. But this is not expected to impact the design functionality.

Thanks and Regards,
Rakshith M B
0 Likes
StKr_1203736
Level 3
Level 3
First like received 10 replies posted 10 sign-ins

I did some testing with the ADC, and despite the warnings, the input multiplexer (SAR MUX) does appear to work.
Thank you for making absolutely no effort to resolve the 'duplicate label' issue in a dual CPU system. I have to assume that this will re-appear at some point, and lacking any way to resolve it, I will have to regularly archive my work so that I can easily back up.

I have to say that I am completely underwhelmed by the errors, omissions, inconsistencies, and bugs in the PSoC 6 tools. The PSoC 6 was released in 2018, you have had a few years to fix things, but it does not appear to be a priority.

Today's word is 'broken'. Can you say 'broken', boys and girls?

0 Likes
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @StKr_1203736

The errors indicate that both the CM0+ startup file and the CM4 startup file are compiled for both CPUs. The same goes for the system files. I tried multiple things to recreate the issue. Tried creating copies of the files into the build directory - did not work. Tried adding changing the names and adding them in the same folder - did not work. Tried adding to the PSoC Creator Workspace Explorer - PSoC Creator does not allow. 
I could however recreate the issues by doing the following things - 
1. Including the files in other source files.
2. Changing the file names of the copies of these files and adding them to PSoC Creator Workspace Explorer.
3. Moving the files to Shared location in PSoC Creator Workspace Explorer.

Build log for reference - 

Rakshith_0-1619724065394.png

From the file structure screenshot that you have shared, the files are placed in CPU-specific source files folders. From the logs, the file names in which the functions are placed are not changed. Without the project, it would be difficult to pinpoint the reason for these project-specific errors and these errors generally do not occur unless the Generated Source files are modified or moved.

Either way, the general workaround for such issues would be to create a new project and add the source files to the new project that is created. As the issue is with the Generated Source files/directory, this should be fixed which is why I marked your response as the correct answer.

I have to say that I am completely underwhelmed by the errors, omissions, inconsistencies, and bugs in the PSoC 6 tools. The PSoC 6 was released in 2018, you have had a few years to fix things, but it does not appear to be a priority.

Today's word is 'broken'. Can you say 'broken', boys and girls?

Thank you for your feedback. I agree that the way of adding the files into the PSoC Creator project, the concept of PSoC Creator IDE specific directory structure, and Windows Explorer directory structure can be confusing and sometimes cause issues but this was implemented to ensure that only the right files are added to the project. Unfortunately, newer features will not be added to PSoC Creator.
For PSoC 6 devices, we recommend customers to check out our ModusToolbox tool. It provides a lot more features catered towards PSoC 6 development and we are constantly trying to make it better.

Hope this helps,

Thanks and Regards,
Rakshith M B
0 Likes