I have developed a custom board with the STM32WL5MOC and I am trying to download a dual core STM32 project to it. I now have two ELF files, one for CM4 and one for CM0+. I am doing by connecting the STLINK-V3SET debugger to 3V3, GND, SWDIO, SWCLK, and NRST pins on the STM32WL5MOC IC.
Using CubeIDE, I have successfully downloaded the ELF file for CM4 and verified that it runs correctly (i.e. interacts with peripherals properly, outputs correct debug messages via UART).
However, (still using CubeIDE), I have not been successful in downloading the ELF file to CM0+ irrespective of my run/debug configurations. I investigated why using CubeProgrammer instead and here are some observations I have made:
- I am able to connect to CM4 with no problem, which expected as I can already download to it.
- I am unable to connect to CM0+, except in the "hot plug" mode.
- Every time before downloading the ELF files, I manually perform a full chip erase, which is successful for both cores.
- In hot plug mode, when I try to download my ELF file to CM0+, a download failed error is returned.
- However, if I manually inspect the memory content, I can find that part of my ELF file has actually been written to CM0+'s flash memory (for the first 0x6C80 = 27776 Bytes = 27.125 KiB, from 0x08020000 to 08026C7F inclusive). This exact number of bytes is reproducible in all attempts.
- For memory addresses beyond 0x08026C80 in CM0+, I am able to manually edit it word-by-word.
- While the ELF file starts at 0x08020000 for CM0+, for CM4, it is 0x08000000.
Hopefully the observations I have made will help you answer these questions:
- Is my way of connecting the debugger to the STM32 correct (referring to the physical wiring)?
- Why is it that I cannot properly connect to CM0+, either through CubeIDE or CubeProgrammer?
- Why can I download part of the ELF file for CM0+ for such an arbitrary number of bytes?
- How should I download the (whole) ELF file to CM0+?