Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
# Copyright (C) 2020 NANDO authors
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3.
PROG_NAME=bootloader_fw
SRC_DIR=./
OBJ_DIR=obj
LIB_DIR=../libs/
TOOLCHAIN=arm-none-eabi-
PROG=$(OBJ_DIR)/$(PROG_NAME)
SPL_PATH=$(LIB_DIR)spl/
SPL_DEVICE_SUPPORT_PATH=$(SPL_PATH)CMSIS/CM3/DeviceSupport/ST/STM32F10x/
SPL_CORE_SUPPORT=$(SPL_PATH)CMSIS/CM3/CoreSupport/
SPL_PERIPH_PATH=$(SPL_PATH)STM32F10x_StdPeriph_Driver/
SPL_LIB=stm32f10x
SPL_CONFIG_FILE=$(SPL_PATH)stm32f10x_conf.h
SPL_FLAGS=-DSTM32F10X_HD -DCONFIG_BOOTLOADER
CC=$(TOOLCHAIN)gcc.exe
OBJCOPY=$(TOOLCHAIN)objcopy.exe
OBJDUMP=$(TOOLCHAIN)objdump.exe
SIZE=$(TOOLCHAIN)size.exe
INCLUDES=-include$(SPL_CONFIG_FILE)
INCLUDES+=-I$(SPL_CORE_SUPPORT)
INCLUDES+=-I$(SPL_DEVICE_SUPPORT_PATH)
INCLUDES+=-I$(SPL_PATH)
INCLUDES+=-I$(SPL_PERIPH_PATH)inc
INCLUDES+=-I$(SRC_DIR)
CFLAGS=-g -Wall -Werror -O3
CFLAGS+=$(INCLUDES) -MMD -MP
CFLAGS+=-ffunction-sections -fdata-sections
CFLAGS+=-mcpu=cortex-m3 -mthumb
CFLAGS+=$(SPL_FLAGS)
LDFLAGS=-mcpu=cortex-m3 -mthumb -Wl,--gc-sections -Wl,-Map=$(PROG).map
vpath %.c $(SRC_DIR) $(SPL_DEVICE_SUPPORT_PATH) $(SRC_BSP_DIR)
vpath %.s $(SRC_DIR)
STARTUP=startup_stm32f10x_hd.s
SRCS=main.c system_stm32f10x.c syscalls.c uart.c
OBJS=$(addprefix $(OBJ_DIR)/,$(SRCS:.c=.o)) \
$(addprefix $(OBJ_DIR)/,$(STARTUP:.s=.o))
DEPS=$(OBJS:%.o=%.d)
LINKER_SCRIPT=$(SRC_DIR)stm32_flash.ld
all: lib dirs $(PROG).elf
lib:
$(MAKE) -C $(SPL_PATH)
dirs:
if not exist $(OBJ_DIR) mkdir $(OBJ_DIR)
$(PROG).elf: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $^ -L$(SPL_PATH) -l$(SPL_LIB) -T$(LINKER_SCRIPT)
$(OBJCOPY) --pad-to 0x8003800 -O ihex $(PROG).elf $(PROG).hex
$(OBJCOPY) -O binary $(PROG).elf $(PROG).bin
$(OBJDUMP) -St $(PROG).elf > $(PROG).lst
$(SIZE) $(PROG).elf
$(OBJ_DIR)/%.o: %.c
$(CC) -c $(CFLAGS) $< -o $@
$(OBJ_DIR)/%.o: %.s
$(CC) -c $(CFLAGS) $< -o $@
-include $(DEPS)
clean:
if exist $(OBJ_DIR) rd /s /q $(OBJ_DIR)
distclean: clean
$(MAKE) -C $(SPL_PATH) clean
4d840b7afThis file is pinned to the selected release. Download the original to open it in your design tool.