stm32w: added ability to upload and reset all connected boards, and login using MOTE=x
This commit is contained in:
parent
95ae5c5d51
commit
946f00bf7b
|
@ -1,6 +1,11 @@
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
|
||||||
|
define \n
|
||||||
|
|
||||||
|
|
||||||
|
endef
|
||||||
|
|
||||||
ifdef IAR
|
ifdef IAR
|
||||||
${info Using IAR...}
|
${info Using IAR...}
|
||||||
#IAR_PATH = C:/Program\ Files/IAR\ Systems/Embedded\ Workbench\ 5.4\ Evaluation
|
#IAR_PATH = C:/Program\ Files/IAR\ Systems/Embedded\ Workbench\ 5.4\ Evaluation
|
||||||
|
@ -18,7 +23,7 @@ CONTIKI_CPU_DIRS = . dev hal simplemac hal/micro/cortexm3 hal/micro/cortexm3/stm
|
||||||
|
|
||||||
STM32W_C = leds-arch.c leds.c clock.c watchdog.c uart1.c uart1-putchar.c slip_uart1.c slip.c\
|
STM32W_C = leds-arch.c leds.c clock.c watchdog.c uart1.c uart1-putchar.c slip_uart1.c slip.c\
|
||||||
stm32w-radio.c stm32w_systick.c uip_arch.c rtimer-arch.c adc.c micro.c sleep.c \
|
stm32w-radio.c stm32w_systick.c uip_arch.c rtimer-arch.c adc.c micro.c sleep.c \
|
||||||
micro-common.c micro-common-internal.c clocks.c mfg-token.c nvm.c flash.c rand.c system-timer.c
|
micro-common.c micro-common-internal.c clocks.c mfg-token.c nvm.c flash.c rand.c system-timer.c mpu.c
|
||||||
|
|
||||||
STM32W_S = spmr.s79 context-switch.s79
|
STM32W_S = spmr.s79 context-switch.s79
|
||||||
|
|
||||||
|
@ -163,7 +168,7 @@ endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FLASHER = $(CONTIKI)/tools/stm32w/stm32w_flasher/stm32w_flasher
|
FLASHER = sudo $(CONTIKI)/tools/stm32w/stm32w_flasher/stm32w_flasher
|
||||||
|
|
||||||
# Check if we are running under Windows
|
# Check if we are running under Windows
|
||||||
ifeq ($(HOST_OS),Windows)
|
ifeq ($(HOST_OS),Windows)
|
||||||
|
@ -250,6 +255,19 @@ endif
|
||||||
|
|
||||||
endif #IAR
|
endif #IAR
|
||||||
|
|
||||||
|
MOTELIST = $(CONTIKI)/tools/stm32w/motelist-linux
|
||||||
|
|
||||||
|
MOTES = $(shell $(MOTELIST) 2>&- | grep USB | \
|
||||||
|
cut -f 4 -d \ | \
|
||||||
|
perl -ne 'print $$1 . " " if(m-(/dev/\w+)-);')
|
||||||
|
|
||||||
|
motelist: stm-motelist
|
||||||
|
|
||||||
|
stm-motelist:
|
||||||
|
$(MOTELIST)
|
||||||
|
stm-motes:
|
||||||
|
@echo $(MOTES)
|
||||||
|
|
||||||
$(OBJECTDIR)/%.o: %.s79
|
$(OBJECTDIR)/%.o: %.s79
|
||||||
$(AS) $(ASFLAGS) -o $@ $<
|
$(AS) $(ASFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
@ -259,6 +277,23 @@ $(OBJECTDIR)/%.o: %.s
|
||||||
%.bin: %.$(TARGET)
|
%.bin: %.$(TARGET)
|
||||||
$(OBJCOPY) $(OBJOPTS) $< $@
|
$(OBJCOPY) $(OBJOPTS) $< $@
|
||||||
|
|
||||||
%.flash: %.bin
|
# reset all stm32w devices sequentially, as stm32w_flasher cannot access different ports in parallel
|
||||||
$(FLASHER) $(FLASHEROPTS) $<
|
stm-reset:
|
||||||
|
$(foreach PORT, $(MOTES), $(FLASHER) -r -p $(PORT);$(\n))
|
||||||
|
@echo Done
|
||||||
|
|
||||||
|
ifdef MOTE
|
||||||
|
%.upload: %.bin
|
||||||
|
$(FLASHER) $(FLASHEROPTS) $< -p $(word $(MOTE), $(MOTES))
|
||||||
|
else # MOTE
|
||||||
|
%.upload: %.bin
|
||||||
|
$(foreach PORT, $(MOTES), $(FLASHER) $(FLASHEROPTS) $< -p $(PORT);$(\n))
|
||||||
|
endif # MOTE
|
||||||
|
|
||||||
|
ifdef MOTE
|
||||||
|
login:
|
||||||
|
$(SERIALDUMP) -b115200 -d10000 $(USBDEVPREFIX)$(word $(MOTE), $(MOTES))
|
||||||
|
else
|
||||||
|
login:
|
||||||
|
$(SERIALDUMP) -b115200 -d10000 $(USBDEVPREFIX)$(firstword $(MOTES))
|
||||||
|
endif
|
||||||
|
|
|
@ -22,8 +22,3 @@ SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-linux
|
||||||
ifeq ($(HOST_OS),Windows)
|
ifeq ($(HOST_OS),Windows)
|
||||||
SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-windows
|
SERIALDUMP = $(CONTIKI)/tools/stm32w/serialdump-windows
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
login:
|
|
||||||
$(SERIALDUMP) -b115200 -d10000 $(PORT)
|
|
||||||
|
|
Loading…
Reference in a new issue