1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- PROJECT=main
- # Selecting Core
- CORTEX_M=4
- # Use newlib-nano. To disable it, specify USE_NANO=
- USE_NANO=--specs=nano.specs
- # Use seimhosting or not
- # USE_SEMIHOST=--specs=rdimon.specs
- # USE_SEMIHOST=--specs=nosys.specs
- # Compiler & Linker
- CC=arm-none-eabi-gcc
- AR=arm-none-eabi-ar
- AS=arm-none-eabi-as
- LD=arm-none-eabi-ld
- SIZE=arm-none-eabi-size
- OBJCOPY=arm-none-eabi-objcopy
- OBJDUMP=arm-none-eabi-objdump
- LDSCRIPTS=-L. -T STM32L432KCUx_FLASH.ld
- INCLUDES = \
- -I../Include \
- -I../../../../Include \
- -I../../../../../STM32L4xx_HAL_Driver/Inc
- SOURCES = main.c \
- system_stm32l4xx.c \
- startup_stm32l432xx.s \
- # Options for specific architecture
- ARCH_FLAGS=-mthumb -mcpu=cortex-m$(CORTEX_M)
- # -Os -flto -ffunction-sections -fdata-sections to compile for code size
- # CFLAGS=$(ARCH_FLAGS) $(INCLUDES) -Os -flto -ffunction-sections -fdata-sections
- CFLAGS=$(ARCH_FLAGS) $(INCLUDES) -g -flto -ffunction-sections -fdata-sections
- # Link for code size and create a map file
- LFLAGS=$(USE_NANO) $(USE_SEMIHOST) -nostartfiles -Wl,--gc-sections,-Map=$(PROJECT).map
- # LFLAGS=$(USE_NANO) $(USE_SEMIHOST) -Wl,--gc-sections,-Map=$(PROJECT).map
- all: $(PROJECT).bin $(PROJECT).dis $(PROJECT).axf
- # Build ELF w/ symbols
- $(PROJECT).axf: $(SOURCES)
- $(CC) $^ $(CFLAGS) $(LFLAGS) $(LDSCRIPTS) -o $@
- # Generate binary to flash
- $(PROJECT).bin: $(PROJECT).axf
- $(OBJCOPY) -O binary $< $@
- # Export dissassembly of binary
- $(PROJECT).dis: $(PROJECT).axf
- $(OBJDUMP) -S -d -marm $< -Mforce-thumb > $@
- clean:
- rm -f *.axf *.bin *.map *.dis *.o
|