Skip to content

Commit

Permalink
Fork boards/st-stm32f303re-nucleo/Makefile to boards/st-stm32l432kc-n…
Browse files Browse the repository at this point in the history
…ucleo/Makefile step 3
  • Loading branch information
balazsracz committed Dec 15, 2020
2 parents 6301ee0 + ebbf7e9 commit ce7a434
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions boards/st-stm32l432kc-nucleo/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
APP_PATH ?= $(realpath ../..)
-include $(APP_PATH)/config.mk
-include local_config.mk

OPENMRNPATH ?= $(shell \
sh -c "if [ \"X`printenv OPENMRNPATH`\" != \"X\" ]; then printenv OPENMRNPATH; \
elif [ -d /opt/openmrn/src ]; then echo /opt/openmrn; \
elif [ -d ~/openmrn/src ]; then echo ~/openmrn; \
elif [ -d ../../../src ]; then echo ../../..; \
else echo OPENMRNPATH not found; fi" \
)

# Find STM32CubeF3 libraries
include $(OPENMRNPATH)/etc/stm32cubef3.mk

LDFLAGSEXTRA +=
SYSLIBRARIESEXTRA += -lfreertos_drivers_stm32cubef303xe
OBJEXTRA +=

CFLAGS += -DSTM32F303xE
CXXFLAGS += -DSTM32F303xE
OPENOCDARGS = -f board/st_nucleo_f3.cfg

ifndef TARGET
export TARGET := freertos.armv7m
endif
include $(OPENMRNPATH)/etc/prog.mk

ifndef DEFAULT_ADDRESS
DEFAULT_ADDRESS=0x16
endif

include $(OPENMRNPATH)/etc/node_id.mk

# How to use: make multibin ADDRESS=0x20 ADDRHIGH=0x45 NUM=3
# starting address, high bits (user range), count
multibin:
for i in $$(seq 1 $(NUM)) ; do $(MAKE) $(EXECUTABLE).bin ADDRESS=$$(printf 0x%02x $$(($(ADDRESS)+$$i))) ; cp $(EXECUTABLE).bin $(EXECUTABLE).f303.$$(printf %02x%02x $(ADDRHIGH) $$(($(ADDRESS)+$$i-1))).bin ; done

ifeq ($(call find_missing_deps,OPENOCDPATH OPENOCDSCRIPTSPATH),)
all: $(EXECUTABLE).bin

flash: $(EXECUTABLE)$(EXTENTION) $(EXECUTABLE).lst
@if ps ax -o comm | grep -q openocd ; then echo openocd already running. quit existing first. ; exit 1 ; fi
$(GDB) $< -ex "target remote | $(OPENOCDPATH)/openocd -c \"gdb_port pipe\" --search $(OPENOCDSCRIPTSPATH) $(OPENOCDARGS)" -ex "monitor reset halt" -ex "load" -ex "monitor reset init" -ex "monitor reset run" -ex "detach" -ex "quit"

gdb:
@if ps ax -o comm | grep -q openocd ; then echo openocd already running. quit existing first. ; exit 1 ; fi
$(GDB) $(EXECUTABLE)$(EXTENTION) -ex "target remote | $(OPENOCDPATH)/openocd -c \"gdb_port pipe\" --search $(OPENOCDSCRIPTSPATH) $(OPENOCDARGS)" -ex "continue" # -ex "monitor reset halt"

else

flash gdb:
echo OPENOCD not found ; exit 1

endif

0 comments on commit ce7a434

Please sign in to comment.