cancel
Showing results for 
Search instead for 
Did you mean: 

Create an assembly project

SToru.1
Associate

Hi,

For education purpose, I'm trying to create, compile, load and debug assembly projects with STM32Cube. Unfortunately, there are no built in options to do it. I noticed that I can erase on an existing project the main.c and create a main.s instead. It works, but I'd prefer to create an assembly project from scratch. Here are my questions :

  • Even with this solution, I cannot access the external variables (.extern) RCC_BASE, GPIOA_BASE, etc... defined in stm32f446xx.h in order to program easily the registers.

  • Is there a proper way to create an empty assembly project ?

  • I also created a project with Makefile that I imported. I can compile, but in order to load or debug, i don't know how to set a correct configuration. A solution is to import that configuration from a C STM32 project, but that's no satisfying : it works, but I still have error pop ups all the time (Not able to get MCU/Board target).

Thank you if you have answers to my questions !

1 ACCEPTED SOLUTION

Accepted Solutions
Markus GIRDLAND
ST Employee

1. There is no specific "Assembly" type project. You should instead create a standard "STM32 Project" empty project for your device and remove any sources.

2. You can use #include <> in assembly files, but please make sure that the file you include is actually valid to include in an assembly file (stm32f446xx.h is not, since it contains C code). This is because we build all assembly files using GCC with the -x assembler-with-cpp flag which enables preprocessing.

3. Create an empty "STM32 Project", then add your .s files to this project

4. Creating a debug configuration for the "STM32 Cortex-M C/C++ Application" type requires that the project has build configurations that contains the device information. This means that the project needs to be of type "STM32 Project". If you want to write your own makefiles you can do this by first creating your "STM32 Project", then go into Project Properties -> C/C++ Build -> Builder settings, then uncheck the "Generate Makefiles automatically". Now you have full control over the makefiles.

View solution in original post

2 REPLIES 2
Markus GIRDLAND
ST Employee

1. There is no specific "Assembly" type project. You should instead create a standard "STM32 Project" empty project for your device and remove any sources.

2. You can use #include <> in assembly files, but please make sure that the file you include is actually valid to include in an assembly file (stm32f446xx.h is not, since it contains C code). This is because we build all assembly files using GCC with the -x assembler-with-cpp flag which enables preprocessing.

3. Create an empty "STM32 Project", then add your .s files to this project

4. Creating a debug configuration for the "STM32 Cortex-M C/C++ Application" type requires that the project has build configurations that contains the device information. This means that the project needs to be of type "STM32 Project". If you want to write your own makefiles you can do this by first creating your "STM32 Project", then go into Project Properties -> C/C++ Build -> Builder settings, then uncheck the "Generate Makefiles automatically". Now you have full control over the makefiles.

SToru.1
Associate

Thank you very much Markus for your answer, I will look into it!