@@ -42,10 +42,14 @@ BOARD_ID?=MT_D21E_rev_B
4242# SAMC21G: SAMC21G18A, SAMC21G17A, SAMC21G16A, SAMC21G15A
4343# SAMC21E: SAMC21E18A, SAMC21E17A, SAMC21E16A, SAMC21E15A
4444# SAMD11: SAMD11D14AM, SAMD11C14A, SAMD11D14AS
45+ # SAMD51G: SAMD51G18A, SAMD51G19A
46+ # SAMD51J: SAMD51J18A, SAMD51J19A, SAMD51J20A
47+ # SAMD51N: SAMD51N19A, SAMD51N20A
48+ # SAMD51P: SAMD51P19A, SAMD51P20A
4549MCU? =SAMD21E18A
4650
47- # Note that the makefile can be invoked with values that override the above two settings.
48- # For example: BOARD_ID=Generic_D11C14A MCU=SAMD11C14A make
51+ # Note that the makefile can be invoked with values that override the above settings.
52+ # For example: BOARD_ID=Generic_D11C14A MCU=SAMD11C14A SDCARD=SDCARD_DISABLED make
4953
5054# End Config ###############################
5155
5559NAME =sam_ba_$(BOARD_ID ) _$(MCU )
5660endif
5761
62+ ifeq ($(findstring 20,$(MCU ) ) ,20)
63+ FLASHSIZE =1MB
64+ endif
65+ ifeq ($(findstring 19,$(MCU ) ) ,19)
66+ FLASHSIZE =512KB
67+ endif
5868ifeq ($(findstring 18,$(MCU ) ) ,18)
5969FLASHSIZE =256KB
6070endif
@@ -71,7 +81,13 @@ ifeq ($(findstring 14,$(MCU)),14)
7181FLASHSIZE =16KB
7282endif
7383
84+ ifeq ($(findstring D51,$(MCU ) ) ,D51)
85+ LINKER_SCRIPT? =bootloader_sam_m4f_$(FLASHSIZE ) .ld
86+ MCPU =cortex-m4
87+ else
7488LINKER_SCRIPT? =bootloader_sam_m0p_$(FLASHSIZE ) .ld
89+ MCPU =cortex-m0plus
90+ endif
7591
7692# CORE_VENDOR?=arduino
7793CORE_VENDOR? =MattairTech_Arduino
@@ -125,7 +141,8 @@ SIZE=$(ARM_GCC_PATH)size
125141# Compiler options
126142# eliminate PARANOIA define to save a tiny amount of code (~40B)
127143CFLAGS_EXTRA =-D$(SDCARD ) -D__$(MCU ) __ -DBOARD_ID_$(BOARD_ID ) -DPARANOIA
128- CFLAGS =-mthumb -mcpu=cortex-m0plus -Wall -c -std=gnu99 -ffunction-sections -fdata-sections -nostdlib -nostartfiles --param max-inline-insns-single=500 -Wa,-adhlns=$(<:%.c=$(BUILD_DIR ) /%.lst )
144+ CFLAGS =-mthumb -mcpu=$(MCPU ) -Wall -c -std=gnu99 -ffunction-sections -fdata-sections -nostdlib -nostartfiles --param max-inline-insns-single=500 -Wa,-adhlns=$(<:%.c=$(BUILD_DIR ) /%.lst )
145+
129146ifdef DEBUG
130147 CFLAGS+ =-g3 -O1 -DDEBUG=1
131148else
@@ -141,7 +158,7 @@ INCLUDES=-I"$(MODULE_PATH_ARDUINO)/tools/CMSIS/4.5.0/CMSIS/Include/" -I"$(MODULE
141158
142159# -----------------------------------------------------------------------------
143160# Linker options
144- LDFLAGS =-mthumb -mcpu=cortex-m0plus -Wall -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all
161+ LDFLAGS =-mthumb -mcpu=$( MCPU ) -Wall -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all
145162LDFLAGS+ =-Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols --specs=nano.specs --specs=nosys.specs
146163
147164# -----------------------------------------------------------------------------
0 commit comments