Created
June 9, 2017 01:54
-
-
Save vdudouyt/429a465b6c321ca8b0dc76c66548ab56 to your computer and use it in GitHub Desktop.
Sample makefile for libopencm3 project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PREFIX=/usr/bin/arm-none-eabi | |
CC=gcc | |
OBJCOPY=objcopy | |
TARGET=STM32F3 | |
STFLASH=st-flash | |
%.o: %.c | |
$(PREFIX)-$(CC) -O0 -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -MD -Wall -Wundef -I../third-party/libopencm3/include -D$(TARGET) -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -gdwarf-2 -g3 -o $@ -c $< | |
%.elf: %.o | |
$(PREFIX)-$(CC) -nostartfiles -L../third-party/libopencm3/lib -Tstm32f3-discovery.ld -Wl,--gc-sections -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 $< -lopencm3_stm32f3 -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group -gdwarf-2 -g3 -lm -o $@ | |
%.bin: %.elf | |
$(PREFIX)-$(OBJCOPY) -O binary $< $@ | |
flash: $(FW) | |
$(STFLASH) write $(FW) 0x08000000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment