Reputation: 565
I am trying to use CMSIS-pack with my new F103 project. Until now, I was using auto-generated project structure, just moving some files elsewhere and everything worked fine. Now with CMSIS-pack, although the code is successfully compiled, I get some "Load Failed" error during downloading the .elf into the MCU. I run auto-generated debug configuration, same as for all of my previous projects. I am using ST-link and with GDB-server. Here's the error:
Failure at line:13 in 'Target Software Startup Scripts'. Please edit the debug configuration settings.
Load Failed
Debug logs:
[0.000] init(): Atollic TrueSTUDIO gdbserver for ST-Link. Version 4.2.2 (WIN32 2018-02-26 16:20:21 15675)
[1.229] reset_hw_wtchpt_module(): Hardware watchpoint supported by the target
[1.233] createFlashParams(): STM32 device: Flash size =1024
[1.335] STM32_AppReset(): Enter STM32_AppReset() function
[1.440] STM32_AppReset(): NVIC_DFSR_REG = 0x00000009
[1.441] STM32_AppReset(): NVIC_CFGFSR_REG = 0x00000000
[1.442] STM32_AppReset(): XPSR = 0x01000000
[1.442] Device_Initialise(): ST_LINK Major version =2 Jtag version =27
[1.442] Device_Initialise(): ST_LINK VID=1155 PID=14155
[1.442] Device_Initialise(): ST_LINK device status: HALT_MODE
[1.442] Device_Initialise(): ST_LINK detects target voltage =3.26 Volt
[1.443] initServerContext(): ST-Link device initialization OK
[1.445] WaitConnection(): Waiting for connection on port 61234...
[2.028] WaitConnection(): Accepted connection on port 61234...
[2.028] Device_GetStatus(): ST_LINK device status: HALT_MODE
[2.045] handlePacket(): Reading 0x4 bytes of memory from addr 0x8006b54
[2.045] handlePacket(): Reading 0x2 bytes of memory from addr 0x8006b54
[2.069] handlePacket(): Reading 0x20 bytes of memory from addr 0xe00fffd0
[2.071] handlePacket(): Reading 0x2 bytes of memory from addr 0x807a
[2.071] handlePacket(): Reading 0x2 bytes of memory from addr 0x807e
[2.084] STM32_AppReset(): Enter STM32_AppReset() function
[2.189] STM32_AppReset(): NVIC_DFSR_REG = 0x00000009
[2.190] STM32_AppReset(): NVIC_CFGFSR_REG = 0x00000000
[2.191] STM32_AppReset(): XPSR = 0x01000000
[2.755] handlePacket(): Reading 0x4 bytes of memory from addr 0xffffffff
[2.755] handlePacket(): Reading 0x4 bytes of memory from addr 0xffffffff
[2.930] handlePacket(): Reading 0x40 bytes of memory from addr 0x8006b40
[2.932] handlePacket(): Reading 0x40 bytes of memory from addr 0x8006b80
[6.065] STM32_AppReset(): Enter STM32_AppReset() function
[6.170] STM32_AppReset(): NVIC_DFSR_REG = 0x00000009
[6.171] STM32_AppReset(): NVIC_CFGFSR_REG = 0x00000000
[6.172] STM32_AppReset(): XPSR = 0x01000000
Any ideas why can't it download the code, while the same configurations work for all my projects without Components/CMSIS-pack?
Regards, Patryk
Upvotes: 1
Views: 3306
Reputation: 11
There is only one solution that i found since 3 days: uninstall 9.3.0 Atollic true studio version and install Version 9.0.1. After that you can not receive like that error. Some versions have problem with some boards...
Upvotes: 1
Reputation: 83
Looking at the differences in the build generated files of a CMSIS auto-generated project file and a CubeMx generated project I noticed that there are differences in the .list file. The isr_vector is not listed.
If you check this section You will notice that there is something that is missing in the new auto-generated project. It is the startup files for your device.
In the RTEconfig object within your project tree there is a way to include the device startup files by ticking:
Device>Startup
After adding this to the RTE Components selector and saving the changes, you will find in your project tree the files
the "CMSIS system and clock configuration file" RTE>Device>STM32F103C8>system_stm32f10x.c
the "CMSIS Device Peripheral Access header" stm32f10x.h will be included
and so the "CMSIS System and clock configuration header" file startup_stm32f10x.h
I am afraid that in the initial and the only available version nowadays, v1.0.0, the "CMSIS Device Startup Interrupt Vectors" file startup_stm32f10x.s is not added in any way to the project.
The way I fixed it was by adding the startup_stm32f10x.s and STM32F103C8_FLASH.ld files from a CubeMx Generated project.
The STM32F103C8_FLASH.ld location has to be added to project>C/C++ Build>Settings>C Linker>General>Linker script
I copied the startup_stm32f10x.s file to the RTE>Device>STM32F103C8 folder
Doing so, recompiling the code and starting a debug session you will get as expected a normal debugging session. This is only a provisional solution but I hope that I may help someone.
Upvotes: 0