Merge pull request #9130 from kYc0o/cpu/atmega/unify_stacks
atmega: refactor cpu/board code and build/flash variables
This commit is contained in:
commit
1f9e1857f7
@ -3,16 +3,19 @@ export CPU = atmega328p
|
|||||||
|
|
||||||
USEMODULE += boards_common_arduino-atmega
|
USEMODULE += boards_common_arduino-atmega
|
||||||
|
|
||||||
#export needed for flash rule
|
# configure the terminal program
|
||||||
export PORT_LINUX ?= /dev/ttyUSB0
|
PORT_LINUX ?= /dev/ttyUSB0
|
||||||
export PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
||||||
export PROGRAMMER_SPEED ?= 57600
|
BAUD ?= 9600
|
||||||
|
|
||||||
export FFLAGS += -p m328p
|
# PROGRAMMER defaults to arduino which is the internal flasher via USB
|
||||||
|
# using avrdude. Can be overridden for debugging (which requires changes
|
||||||
# PROGRAMMER defaults to arduino which is the internal flasher via USB. Can be
|
# that require to use an ISP)
|
||||||
# overridden for debugging (which requires changes that require to use an ISP)
|
PROGRAMMER ?= arduino
|
||||||
export PROGRAMMER ?= arduino
|
# set mcu model for avrdude
|
||||||
|
FFLAGS += -p m328p
|
||||||
|
# configure programmer speed in baud
|
||||||
|
FFLAGS_EXTRA += -b 57600
|
||||||
|
|
||||||
BOOTLOADER_SIZE ?= 2K
|
BOOTLOADER_SIZE ?= 2K
|
||||||
ROM_RESERVED ?= $(BOOTLOADER_SIZE)
|
ROM_RESERVED ?= $(BOOTLOADER_SIZE)
|
||||||
|
|||||||
@ -3,16 +3,19 @@ export CPU = atmega2560
|
|||||||
|
|
||||||
USEMODULE += boards_common_arduino-atmega
|
USEMODULE += boards_common_arduino-atmega
|
||||||
|
|
||||||
#export needed for flash rule
|
# configure the terminal program
|
||||||
export PORT_LINUX ?= /dev/ttyACM0
|
PORT_LINUX ?= /dev/ttyACM0
|
||||||
export PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
||||||
export PROGRAMMER_SPEED ?= 115200
|
BAUD ?= 9600
|
||||||
|
|
||||||
export FFLAGS += -p m2560
|
# PROGRAMMER defaults to stk500v2 which is the internal flasher via USB
|
||||||
|
# using avrdude. Can be overridden for debugging (which requires changes
|
||||||
# PROGRAMMER defaults to stk500v2 which is the internal flasher via USB. Can be
|
# that require to use an ISP)
|
||||||
# overridden for debugging (which requires changes that require to use an ISP)
|
PROGRAMMER ?= stk500v2
|
||||||
export PROGRAMMER ?= stk500v2
|
# set mcu model for avrdude
|
||||||
|
FFLAGS += -p m2560
|
||||||
|
# configure programmer speed in baud
|
||||||
|
FFLAGS_EXTRA += -b 115200
|
||||||
|
|
||||||
BOOTLOADER_SIZE ?= 8K
|
BOOTLOADER_SIZE ?= 8K
|
||||||
ROM_RESERVED ?= $(BOOTLOADER_SIZE)
|
ROM_RESERVED ?= $(BOOTLOADER_SIZE)
|
||||||
|
|||||||
@ -3,16 +3,19 @@ export CPU = atmega328p
|
|||||||
|
|
||||||
USEMODULE += boards_common_arduino-atmega
|
USEMODULE += boards_common_arduino-atmega
|
||||||
|
|
||||||
# export needed for flash rule
|
# configure the terminal program
|
||||||
export PORT_LINUX ?= /dev/ttyACM0
|
PORT_LINUX ?= /dev/ttyACM0
|
||||||
export PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
||||||
export PROGRAMMER_SPEED ?= 115200
|
BAUD ?= 9600
|
||||||
|
|
||||||
export FFLAGS += -p m328p
|
# PROGRAMMER defaults to stk500v2 which is the internal flasher via USB
|
||||||
|
# using avrdude. Can be overridden for debugging (which requires changes
|
||||||
# PROGRAMMER defaults to arduino which is the internal flasher via USB. Can be
|
# that require to use an ISP)
|
||||||
# overridden for debugging (which requires changes that require to use an ISP)
|
PROGRAMMER ?= arduino
|
||||||
export PROGRAMMER ?= arduino
|
# set mcu model for avrdude
|
||||||
|
FFLAGS += -p m328p
|
||||||
|
# configure programmer speed in baud
|
||||||
|
FFLAGS_EXTRA += -b 115200
|
||||||
|
|
||||||
BOOTLOADER_SIZE ?= 512
|
BOOTLOADER_SIZE ?= 512
|
||||||
ROM_RESERVED ?= $(BOOTLOADER_SIZE)
|
ROM_RESERVED ?= $(BOOTLOADER_SIZE)
|
||||||
|
|||||||
@ -11,6 +11,3 @@ ifeq (,$(filter jiminy-mega256rfr2,$(BOARD)))
|
|||||||
FEATURES_PROVIDED += arduino
|
FEATURES_PROVIDED += arduino
|
||||||
FEATURES_PROVIDED += periph_pwm
|
FEATURES_PROVIDED += periph_pwm
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# The board MPU family (used for grouping by the CI system)
|
|
||||||
FEATURES_MCU_GROUP = avr8
|
|
||||||
|
|||||||
@ -3,19 +3,10 @@ include $(RIOTBOARD)/common/arduino-atmega/Makefile.dep
|
|||||||
|
|
||||||
INCLUDES += -I$(RIOTBOARD)/common/arduino-atmega/include
|
INCLUDES += -I$(RIOTBOARD)/common/arduino-atmega/include
|
||||||
|
|
||||||
# refine serial port information
|
|
||||||
export BAUD ?= 9600
|
|
||||||
include $(RIOTMAKE)/tools/serial.inc.mk
|
include $(RIOTMAKE)/tools/serial.inc.mk
|
||||||
|
|
||||||
export FLASHER = avrdude
|
# Disable auto erase for flash and avoid error if signature doesn't match
|
||||||
export DIST_PATH = $(RIOTBOARD)/$(BOARD)/dist
|
FFLAGS_EXTRA += -F -D
|
||||||
export DEBUGSERVER_PORT = 4242
|
|
||||||
export DEBUGSERVER = $(DIST_PATH)/debug_srv.sh
|
|
||||||
export DEBUGSERVER_FLAGS = "-g -j usb :$(DEBUGSERVER_PORT)"
|
|
||||||
export DEBUGGER_FLAGS = "-x $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE)"
|
|
||||||
export DEBUGGER = $(DIST_PATH)/debug.sh $(DEBUGSERVER_FLAGS) $(DIST_PATH) $(DEBUGSERVER_PORT)
|
|
||||||
|
|
||||||
export PROGRAMMER_FLAGS = -P $(PORT) -b $(PROGRAMMER_SPEED)
|
# include avrdude flashing tool
|
||||||
|
include $(RIOTMAKE)/tools/avrdude.inc.mk
|
||||||
OFLAGS += -j .text -j .data
|
|
||||||
export FFLAGS += -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -F -D -U flash:w:$(HEXFILE)
|
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
|
# This board is based on an atmega CPU, thus import the features from it
|
||||||
include $(RIOTBOARD)/common/arduino-atmega/Makefile.features
|
include $(RIOTBOARD)/common/arduino-atmega/Makefile.features
|
||||||
|
|
||||||
# Put defined MCU peripherals here (in alphabetical order)
|
# Put defined MCU peripherals here (in alphabetical order)
|
||||||
# Peripherals are defined in common/arduino-atmega/Makefile.features
|
# Peripherals are defined in common/arduino-atmega/Makefile.features
|
||||||
# Add only additional Peripherals
|
# Add only additional Peripherals
|
||||||
|
|
||||||
# The board MPU family (used for grouping by the CI system)
|
-include $(RIOTCPU)/atmega256rfr2/Makefile.features
|
||||||
FEATURES_MCU_GROUP = avr6
|
|
||||||
|
|
||||||
include $(RIOTCPU)/atmega256rfr2/Makefile.features
|
|
||||||
|
|||||||
@ -1,28 +1,30 @@
|
|||||||
# define the cpu used by the jiminy board
|
# define the cpu used by the jiminy board
|
||||||
export CPU = atmega256rfr2
|
export CPU = atmega256rfr2
|
||||||
|
|
||||||
# export needed for flash rule
|
# configure the terminal program
|
||||||
export PORT_LINUX ?= /dev/ttyACM0
|
PORT_LINUX ?= /dev/ttyACM0
|
||||||
export PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
||||||
|
|
||||||
# Serial Baud rate for Ffasher is configured to 500kBaud
|
|
||||||
# see /usr/include/asm-generic/termbits.h for availabel baudrates on your linux system
|
|
||||||
export PROGRAMMER_SPEED ?= 0010005
|
|
||||||
|
|
||||||
export FFLAGS += -p atmega256rfr2
|
|
||||||
|
|
||||||
# refine serial port information for pyterm
|
# refine serial port information for pyterm
|
||||||
# For 8MHz F_CPU following Baudrate have good error rates
|
# For 8MHz F_CPU following Baudrate have good error rates
|
||||||
# 76923
|
# 76923
|
||||||
# 38400
|
# 38400
|
||||||
export BAUD = 38400
|
BAUD ?= 38400
|
||||||
|
include $(RIOTMAKE)/tools/serial.inc.mk
|
||||||
|
|
||||||
# PROGRAMMER defaults to arduino which is the internal flasher via USB. Can be
|
# PROGRAMMER defaults to wiring which is the internal flasher via USB
|
||||||
# overridden for debugging (which requires changes that require to use an ISP)
|
# using avrdude. Can be overridden for debugging (which requires changes
|
||||||
export PROGRAMMER ?= wiring
|
# that require to use an ISP)
|
||||||
|
PROGRAMMER ?= wiring
|
||||||
|
# set mcu model for avrdude (mandatory)
|
||||||
|
FFLAGS += -p atmega256rfr2
|
||||||
|
# Serial Baud rate for flasher is configured to 500kBaud
|
||||||
|
# see /usr/include/asm-generic/termbits.h for availabel baudrates on your linux system
|
||||||
|
FFLAGS_EXTRA += -b 0010005
|
||||||
|
# avoid error if mcu signature doesn't match
|
||||||
|
FFLAGS_EXTRA += -F
|
||||||
|
|
||||||
# From current fuse configuration
|
# From current fuse configuration
|
||||||
BOOTLOADER_SIZE ?= 4K
|
BOOTLOADER_SIZE ?= 4K
|
||||||
ROM_RESERVED ?= $(BOOTLOADER_SIZE)
|
ROM_RESERVED ?= $(BOOTLOADER_SIZE)
|
||||||
|
|
||||||
include $(RIOTBOARD)/common/arduino-atmega/Makefile.include
|
include $(RIOTMAKE)/tools/avrdude.inc.mk
|
||||||
|
|||||||
@ -8,7 +8,4 @@ FEATURES_PROVIDED += periph_uart
|
|||||||
|
|
||||||
# Various other features (if any)
|
# Various other features (if any)
|
||||||
|
|
||||||
# The board MPU family (used for grouping by the CI system)
|
-include $(RIOTCPU)/atmega1284p/Makefile.features
|
||||||
FEATURES_MCU_GROUP = avr8
|
|
||||||
|
|
||||||
include $(RIOTCPU)/atmega1284p/Makefile.features
|
|
||||||
|
|||||||
@ -7,23 +7,22 @@ BOOTLOADER_SIZE ?= 4K
|
|||||||
ROM_RESERVED ?= $(BOOTLOADER_SIZE)
|
ROM_RESERVED ?= $(BOOTLOADER_SIZE)
|
||||||
|
|
||||||
# configure the terminal program
|
# configure the terminal program
|
||||||
export PORT_LINUX ?= /dev/ttyACM0
|
PORT_LINUX ?= /dev/ttyACM0
|
||||||
export PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*)))
|
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
||||||
export BAUD ?= 9600
|
BAUD ?= 9600
|
||||||
include $(RIOTMAKE)/tools/serial.inc.mk
|
include $(RIOTMAKE)/tools/serial.inc.mk
|
||||||
|
|
||||||
export FLASHER = avrdude
|
# PROGRAMMER defaults to the external flasher Bus Pirate ISP using avrdude.
|
||||||
export DIST_PATH = $(RIOTBOARD)/$(BOARD)/dist
|
PROGRAMMER ?= buspirate
|
||||||
export DEBUGSERVER_PORT = 4242
|
# set mcu model for avrdude
|
||||||
export DEBUGSERVER = $(DIST_PATH)/debug_srv.sh
|
FFLAGS += -p m1284p
|
||||||
export DEBUGSERVER_FLAGS = "-g -j usb :$(DEBUGSERVER_PORT)"
|
# set serial port for avrdude with buspirate
|
||||||
export DEBUGGER_FLAGS = "-x $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE)"
|
ifeq ($(OS),Linux)
|
||||||
export DEBUGGER = $(DIST_PATH)/debug.sh $(DEBUGSERVER_FLAGS) $(DIST_PATH) $(DEBUGSERVER_PORT)
|
AVRDUDE_PORT ?= /dev/ttyUSB0
|
||||||
|
else ifeq ($(OS),Darwin)
|
||||||
|
AVRDUDE_PORT ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*)))
|
||||||
|
endif
|
||||||
|
# avoid error if mcu signature doesn't match
|
||||||
|
FFLAGS_EXTRA += -F
|
||||||
|
|
||||||
# PROGRAMMER defaults to the Bus Pirate ISP
|
include $(RIOTMAKE)/tools/avrdude.inc.mk
|
||||||
export PROGRAMMER ?= buspirate
|
|
||||||
|
|
||||||
export PROGRAMMER_FLAGS = -P /dev/ttyUSB0
|
|
||||||
|
|
||||||
OFLAGS += -j .text -j .data
|
|
||||||
export FFLAGS += -p m1284p -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -F -U flash:w:$(HEXFILE)
|
|
||||||
|
|||||||
@ -8,7 +8,4 @@ FEATURES_PROVIDED += periph_uart
|
|||||||
|
|
||||||
# Various other features (if any)
|
# Various other features (if any)
|
||||||
|
|
||||||
# The board MPU family (used for grouping by the CI system)
|
-include $(RIOTCPU)/atmega1281/Makefile.features
|
||||||
FEATURES_MCU_GROUP = avr8
|
|
||||||
|
|
||||||
include $(RIOTCPU)/atmega1281/Makefile.features
|
|
||||||
|
|||||||
@ -13,31 +13,15 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*)))
|
|||||||
BAUD ?= 9600
|
BAUD ?= 9600
|
||||||
include $(RIOTMAKE)/tools/serial.inc.mk
|
include $(RIOTMAKE)/tools/serial.inc.mk
|
||||||
|
|
||||||
# define tools used for building the project
|
# PROGRAMMER defaults to stk500v1 which is the internal flasher via USB
|
||||||
export PREFIX = avr-
|
# using avrdude. Can be overridden for debugging (which requires changes
|
||||||
export CC = $(PREFIX)gcc
|
# that require to use an ISP)
|
||||||
export CXX = $(PREFIX)c++
|
PROGRAMMER ?= stk500v1
|
||||||
export AR = $(PREFIX)ar
|
# set mcu model for avrdude
|
||||||
export AS = $(PREFIX)as
|
FFLAGS += -p m1281
|
||||||
export LINK = $(PREFIX)gcc
|
# configure programmer speed in baud
|
||||||
export SIZE = $(PREFIX)size
|
FFLAGS_EXTRA += -b 115200
|
||||||
export OBJCOPY = $(PREFIX)objcopy
|
# avoid error if mcu signature doesn't match
|
||||||
|
FFLAGS_EXTRA += -F
|
||||||
|
|
||||||
export FLASHER = avrdude
|
include $(RIOTMAKE)/tools/avrdude.inc.mk
|
||||||
export DIST_PATH = $(RIOTBOARD)/$(BOARD)/dist
|
|
||||||
export DEBUGSERVER_PORT = 4242
|
|
||||||
export DEBUGSERVER = $(DIST_PATH)/debug_srv.sh
|
|
||||||
export DEBUGSERVER_FLAGS = "-g -j usb :$(DEBUGSERVER_PORT)"
|
|
||||||
export DEBUGGER_FLAGS = "-x $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE)"
|
|
||||||
export DEBUGGER = $(DIST_PATH)/debug.sh $(DEBUGSERVER_FLAGS) $(DIST_PATH) $(DEBUGSERVER_PORT)
|
|
||||||
|
|
||||||
# PROGRAMMER defaults to stk500v1 which is the internal flasher via USB. Can be
|
|
||||||
# overridden for debugging (which requires changes that require to use an ISP)
|
|
||||||
export PROGRAMMER ?= stk500v1
|
|
||||||
|
|
||||||
ifeq ($(PROGRAMMER), stk500v1)
|
|
||||||
export PROGRAMMER_FLAGS = -P $(PORT) -b 115200
|
|
||||||
endif
|
|
||||||
|
|
||||||
OFLAGS += -j .text -j .data
|
|
||||||
export FFLAGS += -p m1281 -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -F -U flash:w:$(HEXFILE)
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
include $(RIOTBASE)/Makefile.base
|
include $(RIOTMAKE)/periph.mk
|
||||||
|
|||||||
@ -5,4 +5,4 @@ RAM_LEN = 2K
|
|||||||
ROM_LEN = 32K
|
ROM_LEN = 32K
|
||||||
|
|
||||||
# CPU depends on the atmega common module, so include it
|
# CPU depends on the atmega common module, so include it
|
||||||
include $(RIOTCPU)/atmega_common/Makefile.include
|
include $(RIOTCPU)/atmega_common/Makefile.include
|
||||||
|
|||||||
@ -1,44 +1,9 @@
|
|||||||
# Target architecture for the build. Use avr if you are unsure.
|
|
||||||
export TARGET_ARCH ?= avr
|
|
||||||
|
|
||||||
export CFLAGS_CPU = -mmcu=$(CPU) $(CFLAGS_FPU)
|
|
||||||
export CFLAGS_LINK = -ffunction-sections -fdata-sections -fno-builtin -fshort-enums
|
|
||||||
export CFLAGS_DBG ?= -ggdb -g3
|
|
||||||
export CFLAGS_OPT ?= -Os
|
|
||||||
|
|
||||||
export CFLAGS += $(CFLAGS_CPU) $(CFLAGS_LINK) $(CFLAGS_DBG) $(CFLAGS_OPT)
|
|
||||||
export ASFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG)
|
|
||||||
LINKFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) $(CFLAGS_OPT) -static -lgcc -e reset_handler -Wl,--gc-sections
|
|
||||||
|
|
||||||
# export the peripheral drivers to be linked into the final binary
|
|
||||||
export USEMODULE += atmega_common_periph
|
|
||||||
export USEMODULE += periph_common
|
|
||||||
|
|
||||||
# the atmel port uses stdio_uart
|
|
||||||
export USEMODULE += stdio_uart
|
|
||||||
|
|
||||||
# include module specific includes
|
# include module specific includes
|
||||||
export INCLUDES += -I$(RIOTCPU)/atmega_common/include \
|
export INCLUDES += -I$(RIOTCPU)/atmega_common/include \
|
||||||
-isystem$(RIOTCPU)/atmega_common/avr_libc_extra/include \
|
-isystem$(RIOTCPU)/atmega_common/avr_libc_extra/include \
|
||||||
-isystem$(RIOTCPU)/atmega_common/avr_libc_extra/include/vendor
|
-isystem$(RIOTCPU)/atmega_common/avr_libc_extra/include/vendor
|
||||||
|
|
||||||
ifeq ($(LTO),1)
|
|
||||||
# avr-gcc <4.8.3 has a bug when using LTO which causes a warning to be printed always:
|
|
||||||
# '_vector_25' appears to be a misspelled signal handler [enabled by default]
|
|
||||||
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59396
|
|
||||||
LINKFLAGS += -Wno-error
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Use ROM_LEN and RAM_LEN during link
|
|
||||||
$(if $(ROM_LEN),,$(error ROM_LEN is not defined))
|
|
||||||
$(if $(RAM_LEN),,$(error RAM_LEN is not defined))
|
|
||||||
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=__TEXT_REGION_LENGTH__=$(ROM_LEN)$(if $(ROM_RESERVED),-$(ROM_RESERVED))
|
|
||||||
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=__DATA_REGION_LENGTH__=$(RAM_LEN)
|
|
||||||
|
|
||||||
# Use newer linker script to have ROM/RAM configuration symbols in binutils<2.26
|
|
||||||
LDSCRIPT_COMPAT = $(if $(shell $(TARGET_ARCH)-ld --verbose | grep __TEXT_REGION_LENGTH__),,\
|
|
||||||
-T$(RIOTCPU)/$(CPU)/ldscripts_compat/avr_2.26.ld)
|
|
||||||
LINKFLAGS += $(LDSCRIPT_COMPAT)
|
|
||||||
|
|
||||||
# avr libc needs some RIOT-specific support code
|
# avr libc needs some RIOT-specific support code
|
||||||
USEMODULE += avr_libc_extra
|
USEMODULE += avr_libc_extra
|
||||||
|
|
||||||
|
include $(RIOTMAKE)/arch/atmega.inc.mk
|
||||||
|
|||||||
50
makefiles/arch/atmega.inc.mk
Normal file
50
makefiles/arch/atmega.inc.mk
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# Target architecture for the build. Use avr if you are unsure.
|
||||||
|
TARGET_ARCH ?= avr
|
||||||
|
|
||||||
|
CFLAGS_CPU = -mmcu=$(CPU) $(CFLAGS_FPU)
|
||||||
|
CFLAGS_LINK = -ffunction-sections -fdata-sections -fno-builtin -fshort-enums
|
||||||
|
CFLAGS_DBG ?= -ggdb -g3
|
||||||
|
CFLAGS_OPT ?= -Os
|
||||||
|
|
||||||
|
CFLAGS += $(CFLAGS_CPU) $(CFLAGS_LINK) $(CFLAGS_DBG) $(CFLAGS_OPT)
|
||||||
|
ASFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG)
|
||||||
|
LINKFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) $(CFLAGS_OPT) -static -lgcc -e reset_handler -Wl,--gc-sections
|
||||||
|
OFLAGS += -j .text -j .data
|
||||||
|
|
||||||
|
# Tell the build system that the CPU depends on the atmega common files:
|
||||||
|
USEMODULE += atmega_common
|
||||||
|
|
||||||
|
# export the peripheral drivers to be linked into the final binary
|
||||||
|
USEMODULE += atmega_common_periph
|
||||||
|
USEMODULE += periph_common
|
||||||
|
|
||||||
|
# Export the peripheral drivers to be linked into the final binary, for now
|
||||||
|
# only atmega126rfr2 has periph drivers
|
||||||
|
ifeq ($(CPU), atmega256rfr2)
|
||||||
|
USEMODULE += periph
|
||||||
|
endif
|
||||||
|
|
||||||
|
# the atmel port uses stdio_uart
|
||||||
|
USEMODULE += stdio_uart
|
||||||
|
|
||||||
|
# explicitly tell the linker to link the syscalls and startup code.
|
||||||
|
# without this the interrupt vectors will not be linked correctly!
|
||||||
|
UNDEF += $(BINDIR)/atmega_common/startup.o
|
||||||
|
|
||||||
|
# Use ROM_LEN and RAM_LEN during link
|
||||||
|
$(if $(ROM_LEN),,$(error ROM_LEN is not defined))
|
||||||
|
$(if $(RAM_LEN),,$(error RAM_LEN is not defined))
|
||||||
|
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=__TEXT_REGION_LENGTH__=$(ROM_LEN)$(if $(ROM_RESERVED),-$(ROM_RESERVED))
|
||||||
|
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=__DATA_REGION_LENGTH__=$(RAM_LEN)
|
||||||
|
|
||||||
|
# Use newer linker script to have ROM/RAM configuration symbols in binutils<2.26
|
||||||
|
LDSCRIPT_COMPAT = $(if $(shell $(TARGET_ARCH)-ld --verbose | grep __TEXT_REGION_LENGTH__),,\
|
||||||
|
-T$(RIOTCPU)/$(CPU)/ldscripts_compat/avr_2.26.ld)
|
||||||
|
LINKFLAGS += $(LDSCRIPT_COMPAT)
|
||||||
|
|
||||||
|
ifeq ($(LTO),1)
|
||||||
|
# avr-gcc <4.8.3 has a bug when using LTO which causes a warning to be printed always:
|
||||||
|
# '_vector_25' appears to be a misspelled signal handler [enabled by default]
|
||||||
|
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59396
|
||||||
|
LINKFLAGS += -Wno-error
|
||||||
|
endif
|
||||||
16
makefiles/tools/avrdude.inc.mk
Normal file
16
makefiles/tools/avrdude.inc.mk
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
FLASHER = avrdude
|
||||||
|
DIST_PATH = $(RIOTBOARD)/$(BOARD)/dist
|
||||||
|
DEBUGSERVER_PORT = 4242
|
||||||
|
DEBUGSERVER = $(DIST_PATH)/debug_srv.sh
|
||||||
|
DEBUGSERVER_FLAGS = "-g -j usb :$(DEBUGSERVER_PORT)"
|
||||||
|
DEBUGGER_FLAGS = "-x $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE)"
|
||||||
|
DEBUGGER = $(DIST_PATH)/debug.sh $(DEBUGSERVER_FLAGS) $(DIST_PATH) $(DEBUGSERVER_PORT)
|
||||||
|
|
||||||
|
# make the flasher port configurable (e.g. with atmelice the port is usb)
|
||||||
|
# defaults to terminal's serial port if not configured
|
||||||
|
AVRDUDE_PORT ?= $(PORT)
|
||||||
|
PROGRAMMER_FLAGS = -P $(AVRDUDE_PORT) $(FFLAGS_EXTRA)
|
||||||
|
|
||||||
|
# don't force to flash HEXFILE, but set it as default
|
||||||
|
FLASHFILE ?= $(HEXFILE)
|
||||||
|
FFLAGS += -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -U flash:w:$(HEXFILE)
|
||||||
Loading…
x
Reference in New Issue
Block a user