I’ve finally find a way to import a Mbed project to SW4STM32 (as it’s almost complicated to add mbed-dev and all options to the compiler and linker) and build it in debug config.
I’ve switch to debug perspective but debuger doesn’t seems to execute main.cpp (as debuger doesn’t stop on breakpoints).
What I’ve done:
Create a new project on SW4STM32 :
New C++ Project -> Executable -> AC6 STM32 MCU Project (named Test3)
Choose both debug and Realease config
Select the right board (in my case a NUCLEO-F303K8)
Select “No Firmware” and NOT tag the “Don’t generate startup files”
Then, first I import my Mbed project (named GamelTrophy, exported from Mbed website for AC6 SW4STM32) in src folder using Import -> General -> Archive File.
But as Mbed website doesn’t allow me to include the mbed-dev lib to this project, it contains the builtin mbed library that I don’t want to use. So I remove:
- Setting and Mbed subfolders
- All compiled library (.lib files)
- All project files (.cproject, .project, etc.)
Then I import the mbed-dev library (exported from Mbed website with the right board configuration) in src/GamelTrophy folder using Import -> General -> Archive File.
I remove all root file except : mbed.h (ie : Mbed_config.h, .cproject, .project, .mbed, makefile.targets, mbed-dev Debug.launch, etc.)
I also remove the setting folder and the Toolchain GCC folder.
I then move mbed_config.h file from the project root to the mbed-dev directory
End of imports
Now I setup the configuration of the project.
In Project properties -> C/C++ General -> Paths ans Symbols, I add (in this order) for all configurations and all languages:
and finally I add my own libs :
Then I add symbols for all configurations and all languages:
And I add those 2 symbols (with their values) :
- MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE 9600
- MBED_CONF_PLATFORM_STDIO_BAUD_RATE 9600
Now I configure the compiler:
In Project properties -> C/C++ Build -> Settings:
- In section MCU G++ Linker -> Miscellaneous, I add to linker flags: -specs=nosys.specs
- In section MCU GCC Compiler -> Optimization, I choose: Optimize for DEBUG
- In section MCU G++ Compiler -> Optimization, I choose: Optimize for DEBUG
Then I can compile my program (without any error) and program my Nucleo-F303K8 board in debug mode (and switch to debug perspective)
Program is running, but i’m in the infinite loop of defaultHandler (startup_stm32.s) meaning that either I’ve a bad vector table or a weird interrupt or that I’ve missed something...
My first breakpoint is on the first line of main.cpp... Meaning that I never enter the main !
Any help ?