Skip to content

Commit

Permalink
Merge pull request #2133 from greatscottgadgets/cynthion_support
Browse files Browse the repository at this point in the history
Update support for Cynthion boards
  • Loading branch information
hathach authored Aug 4, 2023
2 parents 9a4c76d + 14d69e4 commit bbdc879
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/reference/supported.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ SAMD11 & SAMD21
- `Adafruit Feather M0 Express <https://www.adafruit.com/product/3403>`__
- `Adafruit ItsyBitsy M0 Express <https://www.adafruit.com/product/3727>`__
- `Adafruit Metro M0 Express <https://www.adafruit.com/product/3505>`__
- `Great Scott Gadgets LUNA <https://greatscottgadgets.com/luna/>`__
- `Great Scott Gadgets Cynthion <https://greatscottgadgets.com/cynthion/>`__
- `Microchip SAMD11 Xplained Pro <https://www.microchip.com/developmenttools/ProductDetails/atsamd11-xpro>`__
- `Microchip SAMD21 Xplained Pro <https://www.microchip.com/DevelopmentTools/ProductDetails/ATSAMD21-XPRO>`__
- `Seeeduino Xiao <https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcontroller-SAMD21-Cortex-M0+-p-4426.html>`__
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@
#define LED_STATE_ON 0

// Button
#if ((_BOARD_REVISION_MAJOR_ == 0) && (_BOARD_REVISION_MINOR_ < 6))
#define BUTTON_PIN PIN_PA16 // pin PB22
#define BUTTON_PULL_MODE GPIO_PULL_UP
#else
#define BUTTON_PIN PIN_PA02
#define BUTTON_PULL_MODE GPIO_PULL_OFF
#endif
#define BUTTON_STATE_ACTIVE 0

#ifdef __cplusplus
Expand Down
22 changes: 22 additions & 0 deletions hw/bsp/samd11/boards/cynthion_d11/board.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
BOARD_REVISION_MAJOR ?= 1
BOARD_REVISION_MINOR ?= 0

CFLAGS += -D__SAMD11D14AM__ \
-D_BOARD_REVISION_MAJOR_=$(BOARD_REVISION_MAJOR) \
-D_BOARD_REVISION_MINOR_=$(BOARD_REVISION_MINOR)

# All source paths should be relative to the top level.
LD_FILE = $(BOARD_PATH)/samd11d14am_flash.ld

# Default bootloader size is now 2K, allow to specify other
ifeq ($(BOOTLOADER_SIZE), )
BOOTLOADER_SIZE := 0x800
endif
LDFLAGS += -Wl,--defsym=BOOTLOADER_SIZE=$(BOOTLOADER_SIZE)

# For flash-jlink target
JLINK_DEVICE = ATSAMD11D14

# flash using dfu-util
flash: $(BUILD)/$(PROJECT).bin
dfu-util -a 0 -d 1d50:615c -D $< || dfu-util -a 0 -d 16d0:05a5 -D $<
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00000000 + 4K, LENGTH = 0x00004000 - 4K
rom (rx) : ORIGIN = 0x00000000 + BOOTLOADER_SIZE, LENGTH = 0x00004000 - BOOTLOADER_SIZE
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00001000
}

Expand Down
11 changes: 0 additions & 11 deletions hw/bsp/samd11/boards/luna_d11/board.mk

This file was deleted.

1 change: 1 addition & 0 deletions hw/bsp/samd11/boards/samd11_xplained/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
// Button
#define BUTTON_PIN PIN_PA14 // pin PB22
#define BUTTON_STATE_ACTIVE 0
#define BUTTON_PULL_MODE GPIO_PULL_UP

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/samd11/family.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void board_init(void)

// Button init
gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN);
gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP);
gpio_set_pin_pull_mode(BUTTON_PIN, BUTTON_PULL_MODE);

/* USB Clock init
* The USB module requires a GCLK_USB of 48 MHz ~ 0.25% clock
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ CFLAGS += -D__SAMD21G18A__ -DCFG_EXAMPLE_VIDEO_READONLY

LD_FILE = $(BOARD_PATH)/samd21g18a_flash.ld

# Default bootloader size is now 2K, allow to specify other
ifeq ($(BOOTLOADER_SIZE), )
BOOTLOADER_SIZE := 0x800
endif
LDFLAGS += -Wl,--defsym=BOOTLOADER_SIZE=$(BOOTLOADER_SIZE)

# For flash-jlink target
JLINK_DEVICE = ATSAMD21G18

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00000000 + 4K, LENGTH = 0x00040000 - 4K
rom (rx) : ORIGIN = 0x00000000 + BOOTLOADER_SIZE, LENGTH = 0x00040000 - BOOTLOADER_SIZE
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
}

Expand Down

0 comments on commit bbdc879

Please sign in to comment.