Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boards: Makefile cleanup for MSP430 based boards #3866

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions boards/Makefile.include.msp430_common
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# default toolchain prefix
export PREFIX ?= msp430-

# define build specific options
CFLAGS_CPU = -mmcu=$(CPU_MODEL)
CFLAGS_STYLE = -std=gnu99 -Wall -Wstrict-prototypes
CFLAGS_LINK =
CFLAGS_DBG = -gdwarf-2
CFLAGS_OPT ?= -Os
# export compiler flags
export CFLAGS += $(CFLAGS_CPU) $(CFLAGS_STYLE) $(CFLAGS_LINK) $(CFLAGS_DBG) $(CFLAGS_OPT)
# export assmebly flags
export ASFLAGS += $(CFLAGS_CPU) --defsym $(CPU_MODEL)=1 $(CFLAGS_DEBUG)
# export linker flags
export LINKFLAGS += $(CFLAGS_CPU) -lgcc

# Import all toolchain settings
include $(RIOTBOARD)/Makefile.include.gnu

# export board specific includes to the global includes-listing
export INCLUDES += -I$(RIOTBOARD)/$(BOARD)/include
Empty file removed boards/chronos/Makefile.dep
Empty file.
24 changes: 5 additions & 19 deletions boards/chronos/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
export INCLUDES += -I$(RIOTBOARD)/$(BOARD)/include

## the cpu to build for
export CPU = cc430
export MCU = cc430f6137
export CPU_MODEL = cc430f6137

# toolchain config
export PREFIX = msp430-
export CC = $(PREFIX)gcc
export AR = $(PREFIX)ar
export CFLAGS += -Wstrict-prototypes -gdwarf-2 -Os -Wall -mmcu=$(MCU) -D CC430
export ASFLAGS += -mmcu=$(MCU) --defsym $(MCU)=1 --gdwarf-2
export AS = $(PREFIX)as
export LINK = $(PREFIX)gcc
export SIZE = $(PREFIX)size
export OBJCOPY = $(PREFIX)objcopy
export LINKFLAGS += -mmcu=$(MCU) -lgcc $(BINDIR)msp430_common/startup.o
# flasher configuration
export OFLAGS = -O ihex
export FLASHER = mspdebug
export USEMODULE += msp430_common
export FFLAGS = rf2500 "prog $(HEXFILE)"
export OFLAGS = -O ihex

export UNDEF += $(BINDIR)msp430_common/startup.o

include $(RIOTBOARD)/$(BOARD)/Makefile.dep
# include msp430 base makefile
include $(RIOTBOARD)/Makefile.include.msp430_common
41 changes: 18 additions & 23 deletions boards/msb-430-common/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
## the cpu to build for
export CPU = msp430fxyz
export MCU = msp430f1612
export CPU_MODEL = msp430f1612

# toolchain config
export PREFIX = msp430-
export CC = $(PREFIX)gcc
export AR = $(PREFIX)ar
export CFLAGS += -Wstrict-prototypes -gdwarf-2 -Os -Wall -mmcu=$(MCU)
export ASFLAGS += -mmcu=$(MCU) --defsym $(MCU)=1 --gdwarf-2
export AS = $(PREFIX)as
export LINK = $(PREFIX)gcc
export SIZE = $(PREFIX)size
export OBJCOPY = $(PREFIX)objcopy
export LINKFLAGS += -mmcu=$(MCU) -lgcc
TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm
# set default port depending on operating system
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(shell ls -1 /dev/tty.SLAB_USBtoUART* | head -n 1)
# setup serial terminal
include $(RIOTBOARD)/Makefile.include.serial

export FLASHER ?= mspdebug
export PORT ?= /dev/ttyUSB0
# setup flash tool
export OFLAGS = -O ihex
export PROGRAMMER ?= olimex
export MSPDEBUGFLAGS += -j $(PROGRAMMER)
ifeq ($(strip $(PROGRAMMER)),uif)
export MSPDEBUGFLAGS += -d $(PORT)
export MSPDEBUGFLAGS += -d $(PORT)
endif
export FLASHER ?= mspdebug
export FFLAGS = $(MSPDEBUGFLAGS) "prog $(HEXFILE)"

# setup debugger
export DEBUGSERVER = $(FLASHER)
export DEBUGSERVER_FLAGS = $(MSPDEBUGFLAGS) gdb
export DEBUGGER = $(PREFIX)gdb
export DEBUGGER_FLAGS = --tui --ex="target remote localhost:2000" --ex "monitor reset halt" --ex load -ex "monitor reset halt" $(ELFFILE)
export TERMFLAGS += -p "$(PORT)"

export FFLAGS = $(MSPDEBUGFLAGS) "prog $(HEXFILE)"

export USEMODULE += msp430_common
export INCLUDES += -I$(RIOTCPU)/msp430-common/include/ -I$(RIOTBOARD)/msb-430-common/include -I$(RIOTBOARD)/msb-430-common/drivers/include
export OFLAGS = -O ihex
# include msp430 base makefile
include $(RIOTBOARD)/Makefile.include.msp430_common

export UNDEF += $(BINDIR)msp430_common/startup.o
# export msb-430-common includes
export INCLUDES += -I$(RIOTBOARD)/msb-430-common/include
export INCLUDES += -I$(RIOTBOARD)/msb-430-common/drivers/include
1 change: 0 additions & 1 deletion boards/msb-430/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export INCLUDES += -I$(RIOTBOARD)/msb-430/include
include $(RIOTBOARD)/msb-430-common/Makefile.include
Empty file removed boards/msb-430h/Makefile.dep
Empty file.
3 changes: 0 additions & 3 deletions boards/msb-430h/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
export INCLUDES += -I$(RIOTBOARD)/msb-430h/include
include $(RIOTBOARD)/$(BOARD)/Makefile.dep

include $(RIOTBOARD)/msb-430-common/Makefile.include
1 change: 0 additions & 1 deletion boards/telosb/Makefile.dep

This file was deleted.

34 changes: 11 additions & 23 deletions boards/telosb/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
include $(RIOTBOARD)/$(BOARD)/Makefile.dep
## the cpu to build for
export CPU = msp430fxyz
export MCU = msp430f1611
export CPU_MODEL = msp430f1611

# toolchain config
export PREFIX = msp430-
export CC = $(PREFIX)gcc
export AR = $(PREFIX)ar
export CFLAGS += -Wstrict-prototypes -gdwarf-2 -Os -Wall -mmcu=$(MCU)
export ASFLAGS += -mmcu=$(MCU) --defsym $(MCU)=1 --gdwarf-2
export AS = $(PREFIX)as
export LINK = $(PREFIX)gcc
export SIZE = $(PREFIX)size
export OBJCOPY = $(PREFIX)objcopy
export LINKFLAGS += -mmcu=$(MCU) -lgcc $(BINDIR)msp430_common/startup.o
export TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm
export FLASHER = $(RIOTBASE)/dist/tools/goodfet/goodfet.bsl
ifeq ($(strip $(PORT)),)
export PORT = /dev/ttyUSB0
endif
export FFLAGS = --telosb -c $(PORT) -r -e -I -p $(HEXFILE)
export TERMFLAGS += -p "$(PORT)"
# set default port depending on operating system
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(shell ls -1 /dev/tty.SLAB_USBtoUART* | head -n 1)
# setup serial terminal
include $(RIOTBOARD)/Makefile.include.serial

export INCLUDES += -I$(RIOTCPU)/$(CPU)/include/ -I$(RIOTBOARD)/$(BOARD)/include/
export INCLUDES += -I$(RIOTCPU)/msp430-common/include
# flash tool configuration
export OFLAGS = -O ihex
export FLASHER = $(RIOTBASE)/dist/tools/goodfet/goodfet.bsl
export FFLAGS = --telosb -c $(PORT) -r -e -I -p $(HEXFILE)

export UNDEF += $(BINDIR)msp430_common/startup.o
# include msp430 base makefile
include $(RIOTBOARD)/Makefile.include.msp430_common
31 changes: 13 additions & 18 deletions boards/wsn430-common/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
## the cpu to build for
export CPU = msp430fxyz
export MCU = msp430f1611
export CPU_MODEL = msp430f1611

# toolchain config
export PREFIX = msp430-
export CC = $(PREFIX)gcc
export AR = $(PREFIX)ar
export CFLAGS += -Wstrict-prototypes -gdwarf-2 -Os -Wall -mmcu=$(MCU)
export ASFLAGS += -mmcu=$(MCU) --defsym $(MCU)=1 --gdwarf-2
export AS = $(PREFIX)as
export LINK = $(PREFIX)gcc
export SIZE = $(PREFIX)size
export OBJCOPY = $(PREFIX)objcopy
export LINKFLAGS += -mmcu=$(MCU) -lgcc $(BINDIR)msp430_common/startup.o
# set default port depending on operating system
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(shell ls -1 /dev/tty.SLAB_USBtoUART* | head -n 1)
# setup serial terminal
include $(RIOTBOARD)/Makefile.include.serial

# setup flash tool
export OFLAGS = -O ihex
export FLASHER = mspdebug
ifeq ($(strip $(PORT)),)
export PORT = /dev/ttyUSB0
endif
export FFLAGS = -d $(PORT) -j uif "prog $(HEXFILE)"

export INCLUDES += -I$(RIOTBOARD)/wsn430-common/include
export OFLAGS = -O ihex
# include msp430 base makefile
include $(RIOTBOARD)/Makefile.include.msp430_common

export UNDEF += $(BINDIR)msp430_common/startup.o
# include wsn430-common includes
export INCLUDES += -I$(RIOTBOARD)/wsn430-common/include
1 change: 0 additions & 1 deletion boards/wsn430-v1_3b/Makefile.dep

This file was deleted.

3 changes: 0 additions & 3 deletions boards/wsn430-v1_3b/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
export INCLUDES += -I$(RIOTBOARD)/wsn430-v1_3b/include

include $(RIOTBOARD)/$(BOARD)/Makefile.dep
include $(RIOTBOARD)/wsn430-common/Makefile.include
1 change: 0 additions & 1 deletion boards/wsn430-v1_4/Makefile.dep

This file was deleted.

3 changes: 0 additions & 3 deletions boards/wsn430-v1_4/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
export INCLUDES += -I$(RIOTBOARD)/wsn430-v1_4/include -I$(RIOTBOARD)/wsn430-common/include

include $(RIOTBOARD)/$(BOARD)/Makefile.dep
include $(RIOTBOARD)/wsn430-common/Makefile.include
1 change: 0 additions & 1 deletion boards/z1/Makefile.dep

This file was deleted.

36 changes: 12 additions & 24 deletions boards/z1/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
include $(RIOTBOARD)/$(BOARD)/Makefile.dep
## the cpu to build for
# CPU used by this board
export CPU = msp430fxyz
export MCU = msp430f2617
export CPU_MODEL = msp430f2617

# toolchain config
export PREFIX = msp430-
export CC = $(PREFIX)gcc
export AR = $(PREFIX)ar
export CFLAGS += -std=c99 -Wstrict-prototypes -gdwarf-2 -Os -Wall -mmcu=$(MCU)
export ASFLAGS += -mmcu=$(MCU) --defsym $(MCU)=1 --gdwarf-2
export AS = $(PREFIX)as
export LINK = $(PREFIX)gcc
export SIZE = $(PREFIX)size
export OBJCOPY = $(PREFIX)objcopy
export LINKFLAGS += -mmcu=$(MCU) -lgcc $(BINDIR)msp430_common/startup.o
export TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm
export FLASHER = $(RIOTBASE)/dist/tools/goodfet/goodfet.bsl
export FFLAGS = --z1 -I -c $(PORT) -r -e -p $(HEXFILE)
export OFLAGS = -O ihex

export PORT_LINUX ?= /dev/ttyUSB0
export PORT_DARWIN ?= /dev/tty.SLAB_USBtoUART
# set default port depending on operating system
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(shell ls -1 /dev/tty.SLAB_USBtoUART* | head -n 1)
# setup serial terminal
include $(RIOTBOARD)/Makefile.include.serial

export INCLUDES += -I$(RIOTCPU)/$(CPU)/include/ -I$(RIOTBOARD)/$(BOARD)/include/
export INCLUDES += -I $(RIOTCPU)/msp430-common/include
# setup flash tool
export OFLAGS = -O ihex
export FLASHER = $(RIOTBASE)/dist/tools/goodfet/goodfet.bsl
export FFLAGS = --z1 -I -c $(PORT) -r -e -p $(HEXFILE)

export UNDEF += $(BINDIR)msp430_common/startup.o
# include the msp430 common Makefile
include $(RIOTBOARD)/Makefile.include.msp430_common
5 changes: 4 additions & 1 deletion cpu/msp430-common/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
INCLUDES += -I$(RIOTBASE)/cpu/msp430-common/include/
INCLUDES += -I$(RIOTCPU)/msp430-common/include/

export UNDEF += $(BINDIR)msp430_common/startup.o
export USEMODULE += msp430_common

DEFAULT_MODULE += oneway_malloc
4 changes: 1 addition & 3 deletions cpu/msp430fxyz/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ INCLUDES += -I$(RIOTCPU)/msp430fxyz/include/

include $(RIOTCPU)/msp430-common/Makefile.include

USEMODULE += periph

export USEMODULE
export USEMODULE += periph