add install recipe for stm32f4xx port example
This commit is contained in:
+45
-12
@@ -118,12 +118,14 @@ CSRC += $(STM32_SRC)
|
|||||||
ASRC = $(LIBRARY_CMSIS)/gcc_ride7/startup_stm32f4xx.s
|
ASRC = $(LIBRARY_CMSIS)/gcc_ride7/startup_stm32f4xx.s
|
||||||
|
|
||||||
#Set the toolchain command names (only the ones needed are defined)
|
#Set the toolchain command names (only the ones needed are defined)
|
||||||
|
# sudo apt install gcc-arm-none-eabi
|
||||||
PREFIX ?= arm-none-eabi-
|
PREFIX ?= arm-none-eabi-
|
||||||
|
|
||||||
CC = $(PREFIX)gcc
|
CC = $(PREFIX)gcc
|
||||||
OBJCOPY = $(PREFIX)objcopy
|
OBJCOPY = $(PREFIX)objcopy
|
||||||
OBJDUMP = $(PREFIX)objdump
|
OBJDUMP = $(PREFIX)objdump
|
||||||
AR = $(PREFIX)ar
|
AR = $(PREFIX)ar
|
||||||
|
NM = $(PREFIX)nm
|
||||||
SIZE = $(PREFIX)size
|
SIZE = $(PREFIX)size
|
||||||
|
|
||||||
LDSCRIPT = $(PLATFORM_DIR)/stm32f4xx.ld
|
LDSCRIPT = $(PLATFORM_DIR)/stm32f4xx.ld
|
||||||
@@ -196,18 +198,48 @@ $(TARGET).bin: $(TARGET).elf
|
|||||||
$(TARGET).elf: $(COBJ) $(AOBJ) Makefile
|
$(TARGET).elf: $(COBJ) $(AOBJ) Makefile
|
||||||
$(CC) $(CFLAGS) $(AOBJ) $(COBJ) $(LDFLAGS) -o $@
|
$(CC) $(CFLAGS) $(AOBJ) $(COBJ) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
# allow a single file to be unoptimized for debugging purposes
|
: ram-usage
|
||||||
#dlmstp.o:
|
ram-usage:
|
||||||
# $(CC) -c $(CFLAGS) $*.c -o $@
|
$(NM) -t d -S --size-sort $(TARGET).elf 1> $(TARGET).nm
|
||||||
#
|
|
||||||
#main.o:
|
# GDB using st-util (GDB server for ST Link)
|
||||||
# $(CC) -c $(CFLAGS) $*.c -o $@
|
GDB_PORT = 3333
|
||||||
#
|
.PHONY: debug
|
||||||
#$(BACNET_CORE)/npdu.o:
|
debug:
|
||||||
# $(CC) -c $(CFLAGS) $*.c -o $@
|
st-util --listen $(GDB_PORT)
|
||||||
#
|
|
||||||
#$(BACNET_CORE)/apdu.o:
|
# GDB using openocd (GDB server for ST Link)
|
||||||
# $(CC) -c $(CFLAGS) $*.c -o $@
|
# sudo apt install openocd
|
||||||
|
.PHONY: openocd
|
||||||
|
openocd:
|
||||||
|
openocd -f interface/stlink.cfg -f target/stm32f4x.cfg
|
||||||
|
|
||||||
|
# graphical GDB debugging tool
|
||||||
|
# note: relies on .gdbinit containing:
|
||||||
|
# file "./release/target.elf"
|
||||||
|
# target extended-remote :3333
|
||||||
|
# load
|
||||||
|
# break main
|
||||||
|
# sudo apt install ddd
|
||||||
|
.PHONY: ddd
|
||||||
|
ddd:
|
||||||
|
ddd --debugger $(GDB) $(realpath $(TARGET).elf)
|
||||||
|
|
||||||
|
# web based graphical GDB debugging tool
|
||||||
|
# pip install gdbgui
|
||||||
|
.PHONY: gdbgui
|
||||||
|
gdbgui:
|
||||||
|
gdbgui -g $(GDB) $(realpath $(TARGET).elf)
|
||||||
|
|
||||||
|
# sudo apt install stlink-tools
|
||||||
|
# note: might require adding rule file to /etc/udev/rules.d/
|
||||||
|
# SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", MODE="0666"
|
||||||
|
# SUBSYSTEM=="usb_device", ATTRS{idVendor}=="0483", MODE="0666"
|
||||||
|
# and reloading with
|
||||||
|
# $ sudo udevadm control --reload-rules
|
||||||
|
# or unplug and plugin the stlink after adding the rules file
|
||||||
|
install: $(TARGET).bin
|
||||||
|
st-flash write $(TARGET).bin 0x08000000
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) -c $(OPTIMIZATION) $(CFLAGS) $*.c -o $@
|
$(CC) -c $(OPTIMIZATION) $(CFLAGS) $*.c -o $@
|
||||||
@@ -219,6 +251,7 @@ $(TARGET).elf: $(COBJ) $(AOBJ) Makefile
|
|||||||
clean:
|
clean:
|
||||||
-rm -rf $(COBJ) $(AOBJ) $(COREOBJ)
|
-rm -rf $(COBJ) $(AOBJ) $(COREOBJ)
|
||||||
-rm -rf $(TARGET).elf $(TARGET).bin $(TARGET).dmp $(TARGET).map
|
-rm -rf $(TARGET).elf $(TARGET).bin $(TARGET).dmp $(TARGET).map
|
||||||
|
-rm -rf $(TARGET).su $(TARGET).nm
|
||||||
-rm -rf *.lst
|
-rm -rf *.lst
|
||||||
|
|
||||||
## Other dependencies
|
## Other dependencies
|
||||||
|
|||||||
Reference in New Issue
Block a user