Skip to content

Commit 076a96c

Browse files
authored
Merge pull request #3046 from jepler/same51
Add basic SAM E54 support and SAM E54 Xplained board
2 parents 87835c7 + d507422 commit 076a96c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+13461
-154
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ jobs:
238238
- "pyruler"
239239
- "robohatmm1_m4"
240240
- "sam32"
241+
- "same54_xplained"
241242
- "seeeduino_xiao"
242243
- "serpente"
243244
- "shirtty"

ports/atmel-samd/Makefile

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,27 @@ INC += -I. \
8686
# NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt.
8787

8888
ifeq ($(CHIP_FAMILY), samd21)
89+
PERIPHERALS_CHIP_FAMILY=samd21
8990
CFLAGS += -Os -DNDEBUG
9091
# TinyUSB defines
9192
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD21 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=128 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=128 -DCFG_TUD_MSC_BUFSIZE=512
9293
endif
9394

9495
ifeq ($(CHIP_FAMILY), samd51)
96+
PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x
9597
CFLAGS += -Os -DNDEBUG
9698
# TinyUSB defines
9799
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
98100
endif
99101

102+
ifeq ($(CHIP_FAMILY), same54)
103+
PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x
104+
CFLAGS += -Os -DNDEBUG
105+
# TinyUSB defines
106+
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
107+
endif
108+
109+
$(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY))
100110
#Debugging/Optimization
101111
ifeq ($(DEBUG), 1)
102112
CFLAGS += -ggdb
@@ -152,7 +162,16 @@ CFLAGS += \
152162
-mcpu=cortex-m4 \
153163
-mfloat-abi=hard \
154164
-mfpu=fpv4-sp-d16 \
155-
-DSAMD51
165+
-DSAM_D5X_E5X -DSAMD51
166+
endif
167+
ifeq ($(CHIP_FAMILY), same54)
168+
CFLAGS += \
169+
-mthumb \
170+
-mabi=aapcs-linux \
171+
-mcpu=cortex-m4 \
172+
-mfloat-abi=hard \
173+
-mfpu=fpv4-sp-d16 \
174+
-DSAM_D5X_E5X -DSAME54
156175
endif
157176

158177

@@ -171,6 +190,9 @@ BOOTLOADER_SIZE := 0x2000
171190
else ifeq ($(CHIP_FAMILY), samd51)
172191
LDFLAGS += -mthumb -mcpu=cortex-m4
173192
BOOTLOADER_SIZE := 0x4000
193+
else ifeq ($(CHIP_FAMILY), same54)
194+
LDFLAGS += -mthumb -mcpu=cortex-m4
195+
BOOTLOADER_SIZE := 0x4000
174196
endif
175197

176198
SRC_ASF := \
@@ -213,6 +235,15 @@ SRC_ASF += \
213235
hpl/oscctrl/hpl_oscctrl.c \
214236
hpl/trng/hpl_trng.c \
215237

238+
else ifeq ($(CHIP_FAMILY), same54)
239+
SRC_ASF += \
240+
hal/src/hal_rand_sync.c \
241+
hpl/core/hpl_core_m4.c \
242+
hpl/mclk/hpl_mclk.c \
243+
hpl/osc32kctrl/hpl_osc32kctrl.c \
244+
hpl/oscctrl/hpl_oscctrl.c \
245+
hpl/trng/hpl_trng.c \
246+
216247
endif
217248

218249
SRC_ASF := $(addprefix asf4/$(CHIP_FAMILY)/, $(SRC_ASF))
@@ -240,15 +271,15 @@ SRC_C = \
240271
lib/utils/stdout_helpers.c \
241272
lib/utils/sys_stdio_mphal.c \
242273
mphalport.c \
243-
peripherals/samd/$(CHIP_FAMILY)/adc.c \
244-
peripherals/samd/$(CHIP_FAMILY)/cache.c \
245-
peripherals/samd/$(CHIP_FAMILY)/clocks.c \
246-
peripherals/samd/$(CHIP_FAMILY)/dma.c \
247-
peripherals/samd/$(CHIP_FAMILY)/events.c \
248-
peripherals/samd/$(CHIP_FAMILY)/external_interrupts.c \
249-
peripherals/samd/$(CHIP_FAMILY)/pins.c \
250-
peripherals/samd/$(CHIP_FAMILY)/sercom.c \
251-
peripherals/samd/$(CHIP_FAMILY)/timers.c \
274+
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/adc.c \
275+
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/cache.c \
276+
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/clocks.c \
277+
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/dma.c \
278+
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/events.c \
279+
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/external_interrupts.c \
280+
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/pins.c \
281+
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/sercom.c \
282+
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/timers.c \
252283
peripherals/samd/clocks.c \
253284
peripherals/samd/dma.c \
254285
peripherals/samd/events.c \
@@ -288,7 +319,7 @@ endif
288319

289320
# The smallest SAMD51 packages don't have I2S. Everything else does.
290321
ifeq ($(CIRCUITPY_AUDIOBUSIO),1)
291-
SRC_C += peripherals/samd/i2s.c peripherals/samd/$(CHIP_FAMILY)/i2s.c
322+
SRC_C += peripherals/samd/i2s.c peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/i2s.c
292323
endif
293324

294325
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
@@ -317,7 +348,7 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
317348

318349
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)
319350
# Sources that only hold QSTRs after pre-processing.
320-
SRC_QSTR_PREPROCESSOR += peripherals/samd/$(CHIP_FAMILY)/clocks.c
351+
SRC_QSTR_PREPROCESSOR += peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/clocks.c
321352

322353
all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2
323354

ports/atmel-samd/asf4

Submodule asf4 updated 409 files

0 commit comments

Comments
 (0)