Currently I try to use the STM32L0 microcontroller series. I found that ST offers a low-level C program collection called STM32SnippetsL0 too, parallel with their complex STM32CubeMX based HAL API. Unfortunately I can not use the codes under GNU/Linux because it supports only EWARM and MDK-ARM toolchains. Are there any possibilities to run this code with the GCC ARM Embedded toolchain?
Electronic – STM32L0 Snippets with GCC ARM Toolchain
armgcclinuxstm32stm32cubemx
Related Topic
- Linux – How to attach/interface an ARM Cortex SoC with an stm32 processor
- Compiling C++ on EFM32 microcontrollers
- Electronic – ARM startup file attributes vs GCC command line arguments
- Electronic – Accessing stm32 registers via structs in GCC
- Electronic – Atollic STM32H7 + ST-LINK Error writing data to flash with math library
Best Answer
After long experiment I can say it is possible to compile the STM32Snippets with the GCC ARM Embedded toolchain. The Snippets contains itself the necessary files except the linker file. I used a linker file copied from STM32CubeMX (SW4STM32 template) but I think other scripts are also usable.
It is necessary to copy two files from the Snippets template folder (Drivers/CMSIS/Device/ST/STM32L0xx/Source/Templates). The first is system_stm32l0xx.c and the second the appropriate startup assembly file from gcc sub-folder. (Yes it seems to partial support for gcc.) I used startup_stm32l053xx.s because I use Nucleo board. If the downloaded Snippets is extracted to the folder snippets and arm-none-eabi-gcc is in your path you can use the following code:
Finally bin is produced to upload to Nucleo.