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

Add new support for Seeeduino Cortex-M0+ #150

Merged
merged 15 commits into from
Nov 6, 2023
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
1 change: 1 addition & 0 deletions .github/workflows/qa-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ jobs:
--platform rpi_pico \
--platform seeed_xiao_samd21 \
--platform seeeduino_xiao \
--platform seeeduino_cm0 \
--platform seeeduino_lotus \
--platform waveshare_rp2040_plus \
--platform waveshare_rp2040_plus@16mb \
Expand Down
8 changes: 8 additions & 0 deletions boards/arm/seeeduino_cm0/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Seeeduino Cortex-M0+ board configuration

# Copyright (c) 2023 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

config BOARD_SEEEDUINO_CM0
bool "Seeeduino Cortex-M0+"
depends on SOC_PART_NUMBER_SAMD21G18A
57 changes: 57 additions & 0 deletions boards/arm/seeeduino_cm0/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Seeedunio Cortex-M0+ board configuration

# Copyright (c) 2023 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

config BOARD
default "seeeduino_cm0"
depends on BOARD_SEEEDUINO_CM0

config USB_SELF_POWERED
default n
depends on USB_DEVICE_STACK && BOARD_SEEEDUINO_CM0

config USB_MAX_POWER
default 250 if BOARD_SEEEDUINO_CM0 # 500mA
depends on USB_DEVICE_STACK && BOARD_SEEEDUINO_CM0

# Workaround for not being able to have commas in macro arguments
DT_CHOSEN_Z_CONSOLE := zephyr,console
DT_COMPAT_Z_CDC_ACM_UART := zephyr,cdc-acm-uart
DT_COMPAT_ATMEL_USB := atmel,sam0-usb

# Macros to shorten Kconfig expressions
DT_CHOSEN_CONSOLE_NODE := $(dt_chosen_path,$(DT_CHOSEN_Z_CONSOLE))
DT_CHOSEN_CONSOLE_PARENT := $(dt_node_parent,$(DT_CHOSEN_CONSOLE_NODE))

if BOARD_SEEEDUINO_CM0 && \
$(dt_chosen_enabled,$(DT_CHOSEN_Z_CONSOLE)) && \
$(dt_compat_on_bus,$(DT_COMPAT_Z_CDC_ACM_UART),usb) && \
$(dt_node_has_compat,$(DT_CHOSEN_CONSOLE_PARENT),$(DT_COMPAT_ATMEL_USB))

config BOOTLOADER_BOSSA_DEVICE_NAME
default "$(dt_chosen_label,$(DT_CHOSEN_Z_CONSOLE))"
depends on USB_CDC_ACM

# Logger cannot use itself to log
choice USB_CDC_ACM_LOG_LEVEL_CHOICE
default USB_CDC_ACM_LOG_LEVEL_OFF
depends on LOG
endchoice

# Set USB log level to error only
choice USB_DEVICE_LOG_LEVEL_CHOICE
default USB_DEVICE_LOG_LEVEL_ERR
depends on LOG
endchoice

# Wait 4000ms at startup for logging
config LOG_PROCESS_THREAD_STARTUP_DELAY_MS
default 4000
depends on LOG

# Wait 4000ms at startup for USB enumeration on host side
config BOOT_DELAY
default 4000

endif # zephyr,cdc-acm-uart
39 changes: 39 additions & 0 deletions boards/arm/seeeduino_cm0/arduino_r3_connector.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2023 TiaC Systems
* SPDX-License-Identifier: Apache-2.0
*/

/ {
arduino_header: connector {
compatible = "arduino-header-r3";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map = <0 0 &porta 2 0>, /* A0 */
<1 0 &portb 8 0>, /* A1 */
<2 0 &portb 9 0>, /* A2 */
<3 0 &porta 4 0>, /* A3 */
<4 0 &porta 5 0>, /* A4 */
<5 0 &portb 2 0>, /* A5 */
<6 0 &porta 11 0>, /* D0 */
<7 0 &porta 10 0>, /* D1 */
<8 0 &porta 14 0>, /* D2 */
<9 0 &porta 9 0>, /* D3 */
<10 0 &porta 8 0>, /* D4 */
<11 0 &porta 15 0>, /* D5 */
<12 0 &porta 20 0>, /* D6 */
<13 0 &porta 21 0>, /* D7 */
<14 0 &porta 6 0>, /* D8 */
<15 0 &porta 7 0>, /* D9 */
<16 0 &porta 18 0>, /* D10 */
<17 0 &porta 16 0>, /* D11 */
<18 0 &porta 19 0>, /* D12 */
<19 0 &porta 17 0>, /* D13 */
<20 0 &porta 22 0>, /* D14 */
<21 0 &porta 23 0>; /* D15 */
};
};

arduino_i2c: &sercom3 {};
arduino_spi: &sercom1 {};
arduino_serial: &sercom2 {};
5 changes: 5 additions & 0 deletions boards/arm/seeeduino_cm0/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2023 TiaC Systems
# SPDX-License-Identifier: Apache-2.0

include(${ZEPHYR_BASE}/boards/common/bossac.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
87 changes: 87 additions & 0 deletions boards/arm/seeeduino_cm0/doc/bootloader/samd21_sam_ba.jflash
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
AppVersion = 78406
FileVersion = 2
[GENERAL]
aATEModuleSel[24] = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
ConnectMode = 0
CurrentFile = "samd21_sam_ba.hex"
DataFileSAddr = 0x00000000
GUIMode = 0
HostName = ""
TargetIF = 1
USBPort = 0
USBSerialNo = 0x00000000
UseATEModuleSelection = 0
[JTAG]
IRLen = 0
MultipleTargets = 0
NumDevices = 0
Speed0 = 4000
Speed1 = 4000
TAP_Number = 0
UseAdaptive0 = 0
UseAdaptive1 = 0
UseMaxSpeed0 = 0
UseMaxSpeed1 = 0
[CPU]
NumInitSteps = 1
InitStep0_Action = "Reset"
InitStep0_Value0 = 0x00000000
InitStep0_Value1 = 0x00000000
InitStep0_Comment = "Reset and halt target"
NumExitSteps = 0
UseScriptFile = 0
ScriptFile = ""
UseRAM = 1
RAMAddr = 0x20000000
RAMSize = 0x00008000
CheckCoreID = 1
CoreID = 0x0BC11477
CoreIDMask = 0x0F000FFF
UseAutoSpeed = 0x00000001
ClockSpeed = 0x00000000
EndianMode = 0
ChipName = "Microchip ATSAMD21G18A"
[FLASH]
NumBanks = 2
[FLASH0]
aRangeSel[1] = 0-1023
BankName = "Internal program flash"
BankSelMode = 1
BaseAddr = 0x00000000
[FLASH1]
aRangeSel[1] = 0
BankName = "NVM User Row"
BankSelMode = 1
BaseAddr = 0x00804000
[PRODUCTION]
AutoPerformsDisconnect = 0
AutoPerformsErase = 1
AutoPerformsProgram = 1
AutoPerformsSecure = 0
AutoPerformsStartApp = 0
AutoPerformsVerify = 1
EnableFixedVTref = 0
EnableTargetPower = 0
EraseType = 1
FixedVTref = 0x00000CE4
MonitorVTref = 0
MonitorVTrefMax = 0x0000157C
MonitorVTrefMin = 0x000003E8
OverrideTimeouts = 0
ProgramSN = 0
SerialFile = ""
SNAddr = 0x00000000
SNInc = 0x00000001
SNLen = 0x00000004
SNListFile = ""
SNValue = 0x00000001
StartAppType = 0
TargetPowerDelay = 0x00000014
TimeoutErase = 0x00003A98
TimeoutProgram = 0x00002710
TimeoutVerify = 0x00002710
VerifyType = 1
[PERFORMANCE]
DisableSkipBlankDataOnProgram = 0x00000000
PerfromBlankCheckPriorEraseChip = 0x00000001
PerfromBlankCheckPriorEraseSelectedSectors = 0x00000001
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading