mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 23:48:12 +00:00
55 lines
1.4 KiB
Makefile
55 lines
1.4 KiB
Makefile
PREFIX ?= arm-none-eabi
|
|
CC = $(PREFIX)-gcc
|
|
LD = $(PREFIX)-gcc
|
|
OBJCOPY = $(PREFIX)-objcopy
|
|
OBJDUMP = $(PREFIX)-objdump
|
|
FLASH = $(shell which st-flash)
|
|
|
|
TOOLCHAIN_DIR ?= ../../../STM/libopencm3
|
|
|
|
CFLAGS += -Os -g \
|
|
-Wall -Wextra -Wimplicit-function-declaration -Wredundant-decls -Wstrict-prototypes -Wundef -Wshadow \
|
|
-fno-common -mcpu=cortex-m3 -mthumb -msoft-float -MD -DSTM32F2 \
|
|
-I$(TOOLCHAIN_DIR)/include
|
|
LDSCRIPT ?= $(NAME).ld
|
|
LDFLAGS += --static -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group \
|
|
-L$(TOOLCHAIN_DIR)/lib -L$(TOOLCHAIN_DIR)/lib/stm32/f2 \
|
|
-T$(LDSCRIPT) -nostartfiles -Wl,--gc-sections \
|
|
-mthumb -march=armv7 -mfix-cortex-m3-ldrd -msoft-float
|
|
OBJS += $(NAME).o
|
|
|
|
all: images
|
|
|
|
images: $(NAME).bin
|
|
|
|
flash: $(NAME).bin
|
|
$(FLASH) write $(NAME).bin 0x8000000
|
|
|
|
$(NAME).bin: $(NAME).elf
|
|
$(OBJCOPY) -Obinary $(NAME).elf $(NAME).bin
|
|
|
|
$(NAME).hex: $(NAME).elf
|
|
$(OBJCOPY) -Oihex $(NAME).elf $(NAME).hex
|
|
|
|
$(NAME).srec: $(NAME).elf
|
|
$(OBJCOPY) -Osrec $(NAME).elf $(NAME).srec
|
|
|
|
$(NAME).list: $(NAME).elf
|
|
$(OBJDUMP) -S $(NAME).elf > $(NAME).list
|
|
|
|
$(NAME).elf: $(OBJS) $(LDSCRIPT) $(TOOLCHAIN_DIR)/lib/libopencm3_stm32f2.a
|
|
$(LD) -o $(NAME).elf $(OBJS) -lopencm3_stm32f2 $(LDFLAGS)
|
|
|
|
%.o: %.c Makefile
|
|
$(CC) $(CFLAGS) -o $@ -c $<
|
|
|
|
clean:
|
|
rm -f *.o
|
|
rm -f *.d
|
|
rm -f *.elf
|
|
rm -f *.bin
|
|
rm -f *.hex
|
|
rm -f *.srec
|
|
rm -f *.list
|
|
rm -f usb.pb*
|