blob: 028546072ddbb2f0baca20b17ba3efc0e3f50c02 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# Application number and version info are included in the ELF file
# symbol table through two global, asbolute symbols. Use nm(1) on an
# ELF file to figure things out. Example:
# nm entropy.elf | awk '/VERSION/{print $1}'
# Application number:
# - cc20rng: 01
# - entropy: 02
APPLICATION = 0x00000002
# Version info is four octects, from most significant to least:
# - Major version, two bytes: 00..FFFF
# - Minor version, one byte: 00..FF
# - Patch level, one byte: 00..FF
VERSION = 0x00010000
# put your *.o targets here, make should handle the rest!
SRCS = main.c stm_init.c system_stm32f4xx.c stm32f4xx_it.c stm32f4xx_hal_msp.c
# all the files will be generated with this name
PROJ_NAME=entropy
TOPLEVEL=../..
include $(TOPLEVEL)/common.mk
OBJS = $(SRCS:.c=.o)
###################################################
.PHONY: lib proj
all: lib proj
lib:
$(MAKE) -C $(STD_PERIPH_LIB) STDPERIPH_SETTINGS="$(STDPERIPH_SETTINGS)"
proj: $(PROJ_NAME).elf
$(PROJ_NAME).elf: $(SRCS)
$(CC) $(CFLAGS) $^ -o $@ -L$(STD_PERIPH_LIB) -lstmf4 -L$(LDSCRIPT_INC) -T$(MCU_LINKSCRIPT) -g -Wl,--defsym=APPLICATION=$(APPLICATION) -Wl,--defsym=VERSION=$(VERSION)
$(OBJCOPY) -O ihex $(PROJ_NAME).elf $(PROJ_NAME).hex
$(OBJCOPY) -O binary $(PROJ_NAME).elf $(PROJ_NAME).bin
$(OBJDUMP) -St $(PROJ_NAME).elf >$(PROJ_NAME).lst
$(SIZE) $(PROJ_NAME).elf
clean:
rm -f *.o
rm -f $(PROJ_NAME).elf
rm -f $(PROJ_NAME).hex
rm -f $(PROJ_NAME).bin
rm -f $(PROJ_NAME).map
rm -f $(PROJ_NAME).lst
really-clean: clean
$(MAKE) -C $(STD_PERIPH_LIB) clean
debug:
$(GDB) -ex "target remote localhost:3333" \
-ex "set remote hardware-breakpoint-limit 6" \
-ex "set remote hardware-watchpoint-limit 4" $(PROJ_NAME).elf
flash-target:
$(OPENOCD) -f $(OPENOCD_BOARD_DIR)/$(OPENOCD_PROC_FILE) \
-c "program $(PROJ_NAME).elf verify reset"
|