Adapt the base project to STM32L0xx microcontrollers - Willeby/GNU_ARM_Eclipse GitHub Wiki

The previously generated ARM Cortex-M0+ project needs to be adapted to the STM32L0xx processor familiy standards. ST provides the vendor specific files which can be used to adapt the project.

  • Download the mentioned files from ST's website: STM32CubeL0

  • Replace the generated Application with the code from a blinky example

    • Delete all files in /src and /include
    • Drag main.c and stm32l0xx_it.c from STM32Cube_FW_L0_V1.7.0\Projects\STM32L053R8-Nucleo\Examples\GPIO\GPIO_IOToggle\Src into /src in eclipse and select Copy Files
    • Drag all files from STM32Cube_FW_L0_V1.7.0\Projects\STM32L053R8-Nucleo\Examples\GPIO\GPIO_IOToggle\Inc into /include in eclipse and select Copy Files
  • Add Board Support Package

    • Drag stm32l0xx_nucleo.c from STM32Cube_FW_L0_V1.7.0\Drivers\BSP\STM32L0xx_Nucleo into /src in eclipse and select Copy Files
    • Drag stm32l0xx_nucleo.h from STM32Cube_FW_L0_V1.7.0\Drivers\BSP\STM32L0xx_Nucleo into /include in eclipse and select Copy Files
  • Replace the ARM CMSIS Drivers

    • Delete stm32l0xx.h and system_stm32l0xx.h from /system/include/cmsis
    • Drag stm32l0xx.h, stm32l053xx.h and system_stm32l0xx.h from STM32Cube_FW_L0_V1.7.0\Drivers\CMSIS\Device\ST\STM32L0xx\Include to /system/include/cmsis in eclipse and select Copy Files
    • Delete system_stm32l0xx.c and vectors_stm32l0xx.c from /system/src/cmsis
    • Drag system_stm32l0xx.c from STM32Cube_FW_L0_V1.7.0\Drivers\CMSIS\Device\ST\STM32L0xx\Source\Templates to /system/src/cmsis in eclipse and select Copy Files
    • Drag startup_stm32l053xx.s from STM32Cube_FW_L0_V1.7.0\Drivers\CMSIS\Device\ST\STM32L0xx\Source\Templates\gcc to /system/src/cmsis in eclipse and select Copy Files
      • IMPORTANT Rename startup_stm32l053xx.s to startup_stm32l053xx.S with a capital S
  • Add HAL Drivers

    • Drag all files from STM32Cube_FW_L0_V1.7.0\Drivers\STM32L0xx_HAL_Driver\Src to /system/src/stm32l0xx in eclipse and select Copy Files
    • Drag all files from STM32Cube_FW_L0_V1.7.0\Drivers\STM32L0xx_HAL_Driver\Inc to /system/include/stm32l0xx in eclipse and select Copy Files and Folders
  • Uncomment the #define STM32L053xx in the file stm32l0xx.h in system/include/cmsis on line 92.
    (This could also be done with a C Compiler Preprocessor Symbol)

  • The link-editor file mem.ld in /ldscripts must be changed from
    FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 64K to FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64K

  • The project can be compiled with Project/Build All