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?
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:
arm-none-eabi-gcc -DSTM32L053xx -Wall -g -mthumb -mcpu=cortex-m0plus -march=armv6-m -mlittle-endian -Isnippets/Drivers/CMSIS/Include -Isnippets/Drivers/CMSIS/Device/ST/STM32L0xx/Include -Wl,--gc-sections,-Map=main.map -Tstm32l053xx.ld -L. system_stm32l0xx.c startup_stm32l053xx.s main.c -o main.elf
Finally bin is produced to upload to Nucleo.
arm-none-eabi-objcopy -O binary main.elf main.bin