1
0
mirror of https://github.com/rene-dev/stmbl.git synced 2024-12-19 07:02:13 +00:00
stmbl/Makefile

96 lines
3.0 KiB
Makefile
Raw Permalink Normal View History

2013-12-09 22:04:24 +00:00
# put your *.o targets here, make should handle the rest!
2014-12-27 16:00:45 +00:00
#TODO
#dependency files
#ld gcollection
#komische flags
2013-12-09 22:04:24 +00:00
2015-12-03 10:24:30 +00:00
SRCS = main.c stm32f4xx_it.c system_stm32f4xx.c printf.c scanf.c setup.c hal.c misc.c eeprom.c link.c version.c syscalls.c shared/crc8.c shared/crc32.c shared/common.c
2014-07-27 18:11:46 +00:00
#USB
SRCS += ub_lib/stm32_ub_usb_cdc.c ub_lib/usb_cdc_lolevel/usb_core.c ub_lib/usb_cdc_lolevel/usb_dcd_int.c ub_lib/usb_cdc_lolevel/usbd_req.c ub_lib/usb_cdc_lolevel/usbd_cdc_core.c ub_lib/usb_cdc_lolevel/usbd_core.c ub_lib/usb_cdc_lolevel/usb_dcd.c ub_lib/usb_cdc_lolevel/usbd_cdc_vcp.c ub_lib/usb_cdc_lolevel/usbd_desc.c ub_lib/usb_cdc_lolevel/usbd_ioreq.c ub_lib/usb_cdc_lolevel/usb_bsp.c ub_lib/usb_cdc_lolevel/usbd_usr.c
2013-12-09 22:04:24 +00:00
#SRCS = main.c system.c
2014-11-18 18:09:25 +00:00
COMPS = df.c
2013-12-09 22:04:24 +00:00
# all the files will be generated with this name (main.elf, main.bin, main.hex, etc)
PROJ_NAME=main
# Put your stlink folder here so make burn will work.
#STLINK=/mnt/share/Programming/embedded/stm32/stlink
# that's it, no need to change anything below this line!
###################################################
CC=arm-none-eabi-gcc
OBJCOPY=arm-none-eabi-objcopy
#CCDIR = /Users/rene/Downloads/gcc-arm-none-eabi-4_7-2013q3/bin
2015-01-10 23:23:30 +00:00
CFLAGS = -g -Wall -Tstm32_flash.ld -std=gnu99 -fno-builtin -CC -fdiagnostics-color=always
2013-12-09 22:04:24 +00:00
CFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -nostartfiles
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles -fsingle-precision-constant
CFLAGS += -ffunction-sections -fdata-sections -O1
2015-04-04 13:28:01 +00:00
2014-07-27 18:11:46 +00:00
CFLAGS += -Ilib/inc/core -Ilib/inc/peripherals -Isrc/ub_lib -Isrc/ub_lib/usb_cdc_lolevel
2013-12-09 22:04:24 +00:00
###################################################
vpath %.c src
vpath %.a lib
ROOT=$(shell pwd)
CFLAGS += -Iinc -Ilib -Ilib/inc -Ishared
2013-12-09 22:04:24 +00:00
CFLAGS += -Ilib/inc/core -Ilib/inc/peripherals
SRCS += lib/startup_stm32f4xx.s # add startup file to build
OBJS = $(SRCS:.c=.o)
###################################################
.PHONY: lib proj
all: lib proj
again: clean all
# Flash the STM32F4
burn: main.elf
2015-11-23 18:25:45 +00:00
st-flash --reset write $(PROJ_NAME).bin 0x08010000
2013-12-09 22:04:24 +00:00
2015-03-31 17:54:22 +00:00
btburn: main.elf
2015-11-10 12:26:57 +00:00
#change this to your device
2015-11-11 21:20:57 +00:00
printf "bootloader\r" > `ls /dev/cu.usbmodem*` || true
2015-11-22 14:20:25 +00:00
printf "bootloader\r" > `ls /dev/ttyACM*` || true
2015-03-25 11:00:25 +00:00
sleep 1
2015-11-23 18:25:45 +00:00
dfu-util -a 0 -d 0483:df11 -s 0x08010000:leave -D main.bin
2015-03-25 11:00:25 +00:00
2013-12-09 22:04:24 +00:00
# Create tags; assumes ctags exists
ctags:
ctags -R --exclude=*cm0.h --exclude=*cm3.h .
lib:
$(MAKE) -C lib
proj: $(PROJ_NAME).elf
2015-11-30 21:39:58 +00:00
hv_firmware.o: stm32f103/main.bin
arm-none-eabi-objcopy --rename-section .data=.hv_firmware -I binary stm32f103/main.bin -B arm -O elf32-littlearm hv_firmware.o
2014-11-09 21:52:27 +00:00
2015-11-30 21:39:58 +00:00
stm32f103/main.bin:
make -C stm32f103/ all
2013-12-09 22:04:24 +00:00
2015-11-30 21:39:58 +00:00
$(PROJ_NAME).elf: $(SRCS) hv_firmware.o
2014-12-29 12:58:10 +00:00
$(CC) $(CFLAGS) $^ -o $@ -Llib -lstm32f4 -Wl,--gc-sections -Wl,-Map -Wl,$(PROJ_NAME).map
2015-12-03 10:24:30 +00:00
tools/add_version_info.py $(PROJ_NAME).elf
$(OBJCOPY) -O binary --gap-fill 0xFF $(PROJ_NAME).elf $(PROJ_NAME).bin
tools/checkcrc.py $(PROJ_NAME).bin
arm-none-eabi-size $(PROJ_NAME).elf
2013-12-09 22:04:24 +00:00
clean:
rm -f *.o *.i
rm -f $(PROJ_NAME).elf
rm -f $(PROJ_NAME).hex
rm -f $(PROJ_NAME).bin