Thursday, 18 May 2017

ARM Toolchain Experience (1)


down voteaccepted
Got it done. I figured I'd share my results so others can use it. Thanks for your time, everyone.

I used this ARM toolchain to build my project, and the texane/stlink library, which comes with the ./st-flash tool, to flash the binary to my STM32L1. While texane/stlink comes with GDB, I found I could get the building+flashing process done without it.
My Makefile ended up looking like this. It isn't very pretty or abstract, but it gets the job done.
all:
    arm-none-eabi-gcc -T stm32l1xx.ld -mthumb -mcpu=cortex-m3 -D STM32L1XX_MD -D USE_STDPERIPH_DRIVER startup_stm32l1xx_md.s system_stm32l1xx.c main.c [ sources ] -lm --specs=nosys.specs -o Project.elf
In which:
  • arm-none-eabi-gcc
    The ARM toolchain
  • -T stm32l1xx.ld
    The linker document
  • -mthumb -mcpu=cortex-m3
    Tell GCC this is for an M3
  • -D STM32L1XX_MD -D USE_STDPERIPH_DRIVER
    Defines for the Standard Peripheral Driver
  • startup_stm32l1xx_md.s
    GCC oriented startup document.
  • system_stm32l1xx.c main.c [ sources ]
    List of my source files
  • -lm
    For Math.h(LibMath)
  • --specs=nosys.specs
    Don't use sytems calls like _exit.
  • -o Project.elf
    Output name


ref:
https://electronics.stackexchange.com/questions/95183/move-embedded-programming-from-keil-to-linux

No comments:

Post a Comment