Harmonize login, serialdump and serialvew across all platforms
This commit is contained in:
parent
37f14efad5
commit
11f563dc98
18
Makefile.embedded
Normal file
18
Makefile.embedded
Normal file
@ -0,0 +1,18 @@
|
||||
.PHONY: login serialdump serialview
|
||||
|
||||
BAUDRATE ?= 115200
|
||||
TIMESTAMP = $(CONTIKI)/tools/timestamp
|
||||
ifeq ($(HOST_OS),Windows)
|
||||
SERIALDUMP = $(SERIAL_DUMP_BIN)
|
||||
else
|
||||
SERIALDUMP = rlwrap $(SERIAL_DUMP_BIN)
|
||||
endif
|
||||
|
||||
serialdump: $(SERIAL_DUMP_BIN)
|
||||
$(SERIALDUMP) -b$(BAUDRATE) $(PORT) | $(TIMESTAMP) | tee serialdump-`date +%Y%m%d-%H%M`
|
||||
|
||||
serialview: $(SERIAL_DUMP_BIN)
|
||||
$(SERIALDUMP) -b$(BAUDRATE) $(PORT) | $(TIMESTAMP)
|
||||
|
||||
login: $(SERIAL_DUMP_BIN)
|
||||
$(SERIALDUMP) -b$(BAUDRATE) $(PORT)
|
@ -396,7 +396,7 @@ endif
|
||||
|
||||
usage:
|
||||
@echo "Usage:"
|
||||
@echo " make [TARGET=(TARGET)] [BOARD=(BOARD)] [DEFINES=(DEFINES)] [target]"
|
||||
@echo " make [TARGET=(TARGET)] [BOARD=(BOARD)] [DEFINES=(DEFINES)] [PORT=(PORT)] [target]"
|
||||
@echo ""
|
||||
@echo "Typical usage:"
|
||||
@echo " make [TARGET=(TARGET)] [BOARD=(BOARD)] [all]"
|
||||
@ -417,6 +417,9 @@ usage:
|
||||
@echo " %.o Produces an object file from a given source file (e.g. hello-world.o)"
|
||||
@echo " %.e Produces the pre-processed version of a given source file (e.g. hello-world.e)"
|
||||
@echo " %.s Produces an assembly file from a given source file (e.g. hello-world.s)"
|
||||
@echo " login View the serial output of the device connected to PORT"
|
||||
@echo " serialview Same as login, but prepend serial output with a unix timestamp"
|
||||
@echo " serialdump same as serialview, but also save the output to a file"
|
||||
|
||||
help: usage
|
||||
|
||||
@ -462,6 +465,12 @@ endif
|
||||
@echo "To view more Make variables, edit $(CONTIKI)/Makefile.include, rule 'viewconf'"
|
||||
@echo "To view more C variables, edit $(CONTIKI)/tools/viewconf.c"
|
||||
|
||||
### Include Makefile.embedded for relevant platforms, in order to pull in
|
||||
### rules for login, serialview etc
|
||||
ifeq ($(findstring $(TARGET),native cooja),)
|
||||
include $(CONTIKI)/Makefile.embedded
|
||||
endif
|
||||
|
||||
# Don't treat %.$(TARGET) as an intermediate file because it is
|
||||
# in fact the primary target.
|
||||
.PRECIOUS: %.$(TARGET)
|
||||
|
@ -88,21 +88,7 @@ else
|
||||
@echo "This board cannot be programmed through the ROM bootloader and therefore does not support the .upload target."
|
||||
endif
|
||||
|
||||
# Check if we are running under Windows
|
||||
ifeq ($(HOST_OS),Windows)
|
||||
SERIALDUMP ?= $(CONTIKI)/tools/sky/serialdump-windows
|
||||
else
|
||||
ifeq ($(HOST_OS),Darwin)
|
||||
SERIALDUMP ?= rlwrap $(CONTIKI)/tools/sky/serialdump-macos
|
||||
else
|
||||
# Else assume Linux
|
||||
SERIALDUMP ?= rlwrap $(CONTIKI)/tools/sky/serialdump-linux
|
||||
endif
|
||||
endif
|
||||
|
||||
UART_BAUDRATE = 115200
|
||||
|
||||
login:
|
||||
$(SERIALDUMP) -b$(UART_BAUDRATE) $(PORT)
|
||||
### For the login etc targets
|
||||
BAUDRATE = 115200
|
||||
|
||||
include $(CONTIKI)/arch/cpu/arm/cortex-m/cm3/Makefile.cm3
|
||||
|
@ -175,17 +175,14 @@ MOTELIST = python $(CONTIKI)/tools/jn516x/mote-list.py
|
||||
ifeq ($(HOST_OS),Windows)
|
||||
USBDEVPREFIX=/dev/com
|
||||
USBDEVBASENAME=COM
|
||||
SERIALDUMP ?= $(CONTIKI)/tools/jn516x/serialdump-windows
|
||||
else
|
||||
ifeq ($(HOST_OS),Darwin)
|
||||
USBDEVPREFIX=
|
||||
USBDEVBASENAME=/dev/tty.usbserial-
|
||||
SERIALDUMP ?= rlwrap $(CONTIKI)/tools/jn516x/serialdump-macos
|
||||
else
|
||||
# Else we assume Linux
|
||||
USBDEVPREFIX=
|
||||
USBDEVBASENAME=/dev/ttyUSB
|
||||
SERIALDUMP ?= rlwrap $(CONTIKI)/tools/jn516x/serialdump-linux
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -195,7 +192,7 @@ ifndef MOTE
|
||||
$(error MOTE not defined! You must specify which MOTE (serial port) to use)
|
||||
endif
|
||||
endif
|
||||
PORT = $(USBDEVBASENAME)$(MOTE)
|
||||
DEV_PORT = $(USBDEVBASENAME)$(MOTE)
|
||||
|
||||
#### make targets
|
||||
|
||||
@ -255,19 +252,19 @@ endif
|
||||
### Upload target to one jn516x mote specified by MOTE=portNumber
|
||||
ifeq ($(HOST_OS),Windows)
|
||||
%.upload: %.$(TARGET).bin
|
||||
${FLASH_PROGRAMMER} -a -c $(PORT) -B 1000000 -s -w -f $<
|
||||
${FLASH_PROGRAMMER} -a -c $(DEV_PORT) -B 1000000 -s -w -f $<
|
||||
else
|
||||
%.upload: %.$(TARGET).bin
|
||||
${FLASH_PROGRAMMER} -V 10 -v -s $(PORT) -I 38400 -P 1000000 -f $<
|
||||
${FLASH_PROGRAMMER} -V 10 -v -s $(DEV_PORT) -I 38400 -P 1000000 -f $<
|
||||
endif
|
||||
|
||||
### Flash the given file
|
||||
ifeq ($(HOST_OS),Windows)
|
||||
%.flash: ${FLASH_PROGRAMMER}
|
||||
${FLASH_PROGRAMMER} -a -c $(PORT) -B 1000000 -s -w -f $*.$(TARGET).bin
|
||||
${FLASH_PROGRAMMER} -a -c $(DEV_PORT) -B 1000000 -s -w -f $*.$(TARGET).bin
|
||||
else
|
||||
%.flash: ${FLASH_PROGRAMMER}
|
||||
${FLASH_PROGRAMMER} -V 10 -v -s $(PORT) -I 38400 -P 1000000 -s -f $*.$(TARGET).bin
|
||||
${FLASH_PROGRAMMER} -V 10 -v -s $(DEV_PORT) -I 38400 -P 1000000 -s -f $*.$(TARGET).bin
|
||||
endif
|
||||
|
||||
### List the ports with connected jn516x motes
|
||||
@ -297,16 +294,6 @@ serialdumpall:
|
||||
### UART_BAUDRATE: i.e., 115200. default is 1000000
|
||||
### example: make TARGET=jn516x UART_BAUDRATE=115200 login MOTE=1
|
||||
|
||||
UART_BAUDRATE ?= 1000000
|
||||
|
||||
$(SERIALDUMP): $(CONTIKI)/tools/jn516x/serialdump.c
|
||||
(cd $(CONTIKI)/tools/jn516x; ${MAKE} $(notdir $(SERIALDUMP)))
|
||||
|
||||
login: $(SERIALDUMP)
|
||||
$(SERIALDUMP) -b${UART_BAUDRATE} $(USBDEVPREFIX)$(PORT)
|
||||
|
||||
serialview: $(SERIALDUMP)
|
||||
$(SERIALDUMP) -b${UART_BAUDRATE} $(USBDEVPREFIX)$(PORT) | $(CONTIKI)/tools/timestamp
|
||||
|
||||
serialdump: $(SERIALDUMP)
|
||||
$(SERIALDUMP) -b${UART_BAUDRATE} $(USBDEVPREFIX)$(PORT) | $(CONTIKI)/tools/timestamp | tee serialdump-$(notdir $(PORT))-`date +%Y%m%d-%H%M`
|
||||
### For the login etc targets
|
||||
BAUDRATE = 1000000
|
||||
PORT = $(USBDEVPREFIX)$(DEV_PORT)
|
||||
|
@ -54,7 +54,6 @@ else
|
||||
ifeq ($(HOST_OS),Darwin)
|
||||
ifndef MOTELIST
|
||||
USBDEVPREFIX=
|
||||
SERIALDUMP = rlwrap $(CONTIKI)/tools/sky/serialdump-macos
|
||||
MOTELIST = $(CONTIKI)/tools/sky/motelist-macos
|
||||
TMOTE_BSL_FILE = tmote-bsl-linux
|
||||
TMOTE_BSL=$(if $(wildcard $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE)),1,0)
|
||||
@ -75,7 +74,6 @@ else
|
||||
# Else we assume Linux
|
||||
ifndef MOTELIST
|
||||
USBDEVPREFIX=
|
||||
SERIALDUMP = rlwrap $(CONTIKI)/tools/sky/serialdump-linux
|
||||
MOTELIST = $(CONTIKI)/tools/sky/motelist-linux
|
||||
TMOTE_BSL_FILE = tmote-bsl-linux
|
||||
TMOTE_BSL=$(if $(wildcard $(CONTIKI)/tools/sky/$(TMOTE_BSL_FILE)),1,0)
|
||||
@ -171,21 +169,7 @@ $(CONTIKI)/tools/tunslip:
|
||||
(cd $(CONTIKI)/tools; $(MAKE) tunslip)
|
||||
|
||||
ifdef MOTE
|
||||
serialdump:
|
||||
$(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(word $(MOTE), $(CMOTES)) | $(CONTIKI)/tools/timestamp | tee serialdump-`date +%Y%m%d-%H%M`
|
||||
|
||||
serialview:
|
||||
$(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(word $(MOTE), $(CMOTES)) | $(CONTIKI)/tools/timestamp
|
||||
|
||||
login:
|
||||
$(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(word $(MOTE), $(CMOTES))
|
||||
PORT = $(USBDEVPREFIX)$(word $(MOTE), $(CMOTES))
|
||||
else
|
||||
serialdump:
|
||||
$(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(firstword $(CMOTES)) | $(CONTIKI)/tools/timestamp | tee serialdump-`date +%Y%m%d-%H%M`
|
||||
|
||||
serialview:
|
||||
$(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(firstword $(CMOTES)) | $(CONTIKI)/tools/timestamp
|
||||
|
||||
login:
|
||||
$(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(firstword $(CMOTES))
|
||||
PORT = $(USBDEVPREFIX)$(firstword $(CMOTES))
|
||||
endif
|
||||
|
@ -56,11 +56,9 @@ ifeq ($(HOST_OS),Darwin)
|
||||
USBDEVPREFIX=
|
||||
MOTELIST := $(CONTIKI)/tools/zolertia/motelist-zolertia-macos
|
||||
MOTES := $(shell $(MOTELIST) -c 2>&- | cut -f 2 -d ,)
|
||||
SERIALDUMP := rlwrap $(CONTIKI)/tools/sky/serialdump-macos
|
||||
else
|
||||
### If we are not running under Mac, we assume Linux
|
||||
USBDEVPREFIX=
|
||||
SERIALDUMP := rlwrap $(CONTIKI)/tools/sky/serialdump-linux
|
||||
MOTELIST := $(CONTIKI)/tools/zolertia/motelist-zolertia
|
||||
MOTES := $(shell $(MOTELIST) -b $(MOTELIST_ZOLERTIA) -c 2>&- | cut -f 2 -d , | \
|
||||
perl -ne 'print $$1 . " " if(m-(/dev/\w+)-);')
|
||||
@ -103,8 +101,6 @@ zoul-motelist:
|
||||
zoul-motes:
|
||||
@echo $(MOTES)
|
||||
|
||||
serialview:
|
||||
$(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(firstword $(MOTES)) | $(CONTIKI)/tools/timestamp
|
||||
|
||||
login:
|
||||
$(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(firstword $(MOTES))
|
||||
### For the login etc targets
|
||||
BAUDRATE = 115200
|
||||
PORT = $(USBDEVPREFIX)$(firstword $(MOTES))
|
||||
|
Loading…
Reference in New Issue
Block a user