summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-10-14 17:18:26 +0700
committerhathach <[email protected]>2025-10-14 17:18:26 +0700
commita5fde08285a10a87a1f374913dfe7edfafbe383d (patch)
treeb8dcf19566f073fa3ffedc875556ddaeae2110ee
parent47b13f6b102ea981b79588158dca436ebc21f1ae (diff)
refactor same7x using codex
-rw-r--r--hw/bsp/same70_qmtech/board.mk59
-rw-r--r--hw/bsp/same70_qmtech/same70_qmtech.c159
-rw-r--r--hw/bsp/same70_xplained/board.mk67
-rw-r--r--hw/bsp/same70_xplained/same70_xplained.c156
-rw-r--r--hw/bsp/same7x/boards/same70_qmtech/board.cmake8
-rw-r--r--hw/bsp/same7x/boards/same70_qmtech/board.h64
-rw-r--r--hw/bsp/same7x/boards/same70_qmtech/board.mk3
-rw-r--r--hw/bsp/same7x/boards/same70_qmtech/hpl_pmc_config.h (renamed from hw/bsp/same70_qmtech/hpl_pmc_config.h)0
-rw-r--r--hw/bsp/same7x/boards/same70_qmtech/hpl_usart_config.h (renamed from hw/bsp/same70_qmtech/hpl_usart_config.h)0
-rw-r--r--hw/bsp/same7x/boards/same70_qmtech/hpl_xdmac_config.h (renamed from hw/bsp/same70_qmtech/hpl_xdmac_config.h)0
-rw-r--r--hw/bsp/same7x/boards/same70_qmtech/peripheral_clk_config.h (renamed from hw/bsp/same70_qmtech/peripheral_clk_config.h)0
-rw-r--r--hw/bsp/same7x/boards/same70_xplained/board.cmake8
-rw-r--r--hw/bsp/same7x/boards/same70_xplained/board.h64
-rw-r--r--hw/bsp/same7x/boards/same70_xplained/board.mk3
-rw-r--r--hw/bsp/same7x/boards/same70_xplained/hpl_pmc_config.h (renamed from hw/bsp/same70_xplained/hpl_pmc_config.h)0
-rw-r--r--hw/bsp/same7x/boards/same70_xplained/hpl_usart_config.h (renamed from hw/bsp/same70_xplained/hpl_usart_config.h)0
-rw-r--r--hw/bsp/same7x/boards/same70_xplained/hpl_xdmac_config.h (renamed from hw/bsp/same70_xplained/hpl_xdmac_config.h)0
-rw-r--r--hw/bsp/same7x/boards/same70_xplained/peripheral_clk_config.h (renamed from hw/bsp/same70_xplained/peripheral_clk_config.h)0
-rw-r--r--hw/bsp/same7x/family.c196
-rw-r--r--hw/bsp/same7x/family.cmake121
-rw-r--r--hw/bsp/same7x/family.mk56
21 files changed, 523 insertions, 441 deletions
diff --git a/hw/bsp/same70_qmtech/board.mk b/hw/bsp/same70_qmtech/board.mk
deleted file mode 100644
index 7e949e135..000000000
--- a/hw/bsp/same70_qmtech/board.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-ASF_DIR = hw/mcu/microchip/same70
-
-CFLAGS += \
- -mthumb \
- -mabi=aapcs \
- -mcpu=cortex-m7 \
- -mfloat-abi=hard \
- -mfpu=fpv4-sp-d16 \
- -nostdlib -nostartfiles \
- -D__SAME70N19B__ \
- -DCFG_TUSB_MCU=OPT_MCU_SAMX7X
-
-# suppress following warnings from mcu driver
-CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align -Wno-error=redundant-decls
-
-# SAM driver is flooded with -Wcast-qual which slow down complication significantly
-CFLAGS_SKIP += -Wcast-qual
-
-LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs
-
-# All source paths should be relative to the top level.
-LD_FILE = $(ASF_DIR)/same70b/gcc/gcc/same70q21b_flash.ld
-
-SRC_C += \
- src/portable/microchip/samx7x/dcd_samx7x.c \
- $(ASF_DIR)/same70b/gcc/gcc/startup_same70q21b.c \
- $(ASF_DIR)/same70b/gcc/system_same70q21b.c \
- $(ASF_DIR)/hpl/core/hpl_init.c \
- $(ASF_DIR)/hpl/usart/hpl_usart.c \
- $(ASF_DIR)/hpl/pmc/hpl_pmc.c \
- $(ASF_DIR)/hal/src/hal_usart_async.c \
- $(ASF_DIR)/hal/src/hal_io.c \
- $(ASF_DIR)/hal/src/hal_atomic.c \
- $(ASF_DIR)/hal/utils/src/utils_ringbuffer.c
-
-INC += \
- $(TOP)/hw/bsp/$(BOARD) \
- $(TOP)/$(ASF_DIR) \
- $(TOP)/$(ASF_DIR)/config \
- $(TOP)/$(ASF_DIR)/same70b/include \
- $(TOP)/$(ASF_DIR)/hal/include \
- $(TOP)/$(ASF_DIR)/hal/utils/include \
- $(TOP)/$(ASF_DIR)/hpl/core \
- $(TOP)/$(ASF_DIR)/hpl/pio \
- $(TOP)/$(ASF_DIR)/hpl/pmc \
- $(TOP)/$(ASF_DIR)/hri \
- $(TOP)/$(ASF_DIR)/CMSIS/Core/Include
-
-# For freeRTOS port source
-FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM7
-
-# For flash-jlink target
-JLINK_DEVICE = SAME70N19B
-
-# flash using edbg from https://github.com/ataradov/edbg
-# Note: SAME70's GPNVM1 must be set to 1 to boot from flash with
-# edbg -t same70 -F w0,1,1
-flash: $(BUILD)/$(PROJECT).bin
- edbg --verbose -t same70 -pv -f $<
diff --git a/hw/bsp/same70_qmtech/same70_qmtech.c b/hw/bsp/same70_qmtech/same70_qmtech.c
deleted file mode 100644
index e5f0da198..000000000
--- a/hw/bsp/same70_qmtech/same70_qmtech.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2019, hathach (tinyusb.org)
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- */
-
-#include "sam.h"
-#include "bsp/board_api.h"
-
-#include "peripheral_clk_config.h"
-#include "hpl/usart/hpl_usart_base.h"
-#include "hpl/pmc/hpl_pmc.h"
-#include "hal/include/hal_init.h"
-#include "hal/include/hal_usart_async.h"
-#include "hal/include/hal_gpio.h"
-
-
-// You can get the board here:
-// https://www.aliexpress.com/item/1005003173783268.html
-
-//--------------------------------------------------------------------+
-// MACRO TYPEDEF CONSTANT ENUM DECLARATION
-//--------------------------------------------------------------------+
-
-#define LED_PIN GPIO(GPIO_PORTA, 15)
-
-#define BUTTON_PIN GPIO(GPIO_PORTA, 21)
-#define BUTTON_STATE_ACTIVE 0
-
-#define UART_TX_PIN GPIO(GPIO_PORTB, 1)
-#define UART_RX_PIN GPIO(GPIO_PORTB, 0)
-
-static struct usart_async_descriptor edbg_com;
-static uint8_t edbg_com_buffer[64];
-static volatile bool uart_busy = false;
-
-static void tx_cb_EDBG_COM(const struct usart_async_descriptor *const io_descr)
-{
- (void) io_descr;
- uart_busy = false;
-}
-
-//------------- IMPLEMENTATION -------------//
-void board_init(void)
-{
- init_mcu();
-
- /* Disable Watchdog */
- hri_wdt_set_MR_WDDIS_bit(WDT);
-
- // LED
- _pmc_enable_periph_clock(ID_PIOB);
- gpio_set_pin_level(LED_PIN, false);
- gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT);
- gpio_set_pin_function(LED_PIN, GPIO_PIN_FUNCTION_OFF);
-
- // Button
- _pmc_enable_periph_clock(ID_PIOA);
- gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN);
- gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP);
- gpio_set_pin_function(BUTTON_PIN, GPIO_PIN_FUNCTION_OFF);
-
- // Uart via EDBG Com
- _pmc_enable_periph_clock(ID_USART1);
- gpio_set_pin_function(UART_RX_PIN, MUX_PA21A_USART1_RXD1);
- gpio_set_pin_function(UART_TX_PIN, MUX_PB4D_USART1_TXD1);
-
- usart_async_init(&edbg_com, USART1, edbg_com_buffer, sizeof(edbg_com_buffer), _usart_get_usart_async());
- usart_async_set_baud_rate(&edbg_com, CFG_BOARD_UART_BAUDRATE);
- usart_async_register_callback(&edbg_com, USART_ASYNC_TXC_CB, tx_cb_EDBG_COM);
- usart_async_enable(&edbg_com);
-
-#if CFG_TUSB_OS == OPT_OS_NONE
- // 1ms tick timer (samd SystemCoreClock may not correct)
- SysTick_Config(CONF_CPU_FREQUENCY / 1000);
-#endif
-
- // Enable USB clock
- _pmc_enable_periph_clock(ID_USBHS);
-
-}
-
-//--------------------------------------------------------------------+
-// USB Interrupt Handler
-//--------------------------------------------------------------------+
-void USBHS_Handler(void)
-{
- tud_int_handler(0);
-}
-
-//--------------------------------------------------------------------+
-// Board porting API
-//--------------------------------------------------------------------+
-
-void board_led_write(bool state)
-{
- gpio_set_pin_level(LED_PIN, state);
-}
-
-uint32_t board_button_read(void)
-{
- return BUTTON_STATE_ACTIVE == gpio_get_pin_level(BUTTON_PIN);
-}
-
-int board_uart_read(uint8_t* buf, int len)
-{
- (void) buf; (void) len;
- return 0;
-}
-
-int board_uart_write(void const * buf, int len)
-{
- // while until previous transfer is complete
- while(uart_busy) {}
- uart_busy = true;
-
- io_write(&edbg_com.io, buf, len);
- return len;
-}
-
-#if CFG_TUSB_OS == OPT_OS_NONE
-volatile uint32_t system_ticks = 0;
-
-void SysTick_Handler (void)
-{
- system_ticks++;
-}
-
-uint32_t board_millis(void)
-{
- return system_ticks;
-}
-#endif
-
-// Required by __libc_init_array in startup code if we are compiling using
-// -nostdlib/-nostartfiles.
-void _init(void)
-{
-
-}
diff --git a/hw/bsp/same70_xplained/board.mk b/hw/bsp/same70_xplained/board.mk
deleted file mode 100644
index 2d97ecdc1..000000000
--- a/hw/bsp/same70_xplained/board.mk
+++ /dev/null
@@ -1,67 +0,0 @@
-ASF_DIR = hw/mcu/microchip/same70
-
-CFLAGS += \
- -mthumb \
- -mabi=aapcs \
- -mcpu=cortex-m7 \
- -mfloat-abi=hard \
- -mfpu=fpv4-sp-d16 \
- -nostdlib -nostartfiles \
- -D__SAME70Q21B__ \
- -DCFG_TUSB_MCU=OPT_MCU_SAMX7X
-
-# suppress following warnings from mcu driver
-CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align -Wno-error=redundant-decls
-
-SPEED ?= high
-
-ifeq ($(SPEED), high)
- CFLAGS += -DBOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
-else
- CFLAGS += -DBOARD_TUD_MAX_SPEED=OPT_MODE_FULL_SPEED
-endif
-
-# SAM driver is flooded with -Wcast-qual which slow down complication significantly
-CFLAGS_SKIP += -Wcast-qual
-
-LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs
-
-# All source paths should be relative to the top level.
-LD_FILE = $(ASF_DIR)/same70b/gcc/gcc/same70q21b_flash.ld
-
-SRC_C += \
- src/portable/microchip/samx7x/dcd_samx7x.c \
- $(ASF_DIR)/same70b/gcc/gcc/startup_same70q21b.c \
- $(ASF_DIR)/same70b/gcc/system_same70q21b.c \
- $(ASF_DIR)/hpl/core/hpl_init.c \
- $(ASF_DIR)/hpl/usart/hpl_usart.c \
- $(ASF_DIR)/hpl/pmc/hpl_pmc.c \
- $(ASF_DIR)/hal/src/hal_usart_async.c \
- $(ASF_DIR)/hal/src/hal_io.c \
- $(ASF_DIR)/hal/src/hal_atomic.c \
- $(ASF_DIR)/hal/utils/src/utils_ringbuffer.c
-
-INC += \
- $(TOP)/hw/bsp/$(BOARD) \
- $(TOP)/$(ASF_DIR) \
- $(TOP)/$(ASF_DIR)/config \
- $(TOP)/$(ASF_DIR)/same70b/include \
- $(TOP)/$(ASF_DIR)/hal/include \
- $(TOP)/$(ASF_DIR)/hal/utils/include \
- $(TOP)/$(ASF_DIR)/hpl/core \
- $(TOP)/$(ASF_DIR)/hpl/pio \
- $(TOP)/$(ASF_DIR)/hpl/pmc \
- $(TOP)/$(ASF_DIR)/hri \
- $(TOP)/$(ASF_DIR)/CMSIS/Core/Include
-
-# For freeRTOS port source
-FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM7
-
-# For flash-jlink target
-JLINK_DEVICE = SAME70Q21B
-
-# flash using edbg from https://github.com/ataradov/edbg
-# Note: SAME70's GPNVM1 must be set to 1 to boot from flash with
-# edbg -t same70 -F w0,1,1
-flash: $(BUILD)/$(PROJECT).bin
- edbg --verbose -t same70 -pv -f $<
diff --git a/hw/bsp/same70_xplained/same70_xplained.c b/hw/bsp/same70_xplained/same70_xplained.c
deleted file mode 100644
index f532c6927..000000000
--- a/hw/bsp/same70_xplained/same70_xplained.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2019, hathach (tinyusb.org)
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- */
-
-#include "sam.h"
-#include "bsp/board_api.h"
-
-#include "peripheral_clk_config.h"
-#include "hpl/usart/hpl_usart_base.h"
-#include "hpl/pmc/hpl_pmc.h"
-#include "hal/include/hal_init.h"
-#include "hal/include/hal_usart_async.h"
-#include "hal/include/hal_gpio.h"
-
-
-//--------------------------------------------------------------------+
-// MACRO TYPEDEF CONSTANT ENUM DECLARATION
-//--------------------------------------------------------------------+
-
-#define LED_PIN GPIO(GPIO_PORTC, 8)
-
-#define BUTTON_PIN GPIO(GPIO_PORTA, 11)
-#define BUTTON_STATE_ACTIVE 0
-
-#define UART_TX_PIN GPIO(GPIO_PORTB, 4)
-#define UART_RX_PIN GPIO(GPIO_PORTA, 21)
-
-static struct usart_async_descriptor edbg_com;
-static uint8_t edbg_com_buffer[64];
-static volatile bool uart_busy = false;
-
-static void tx_cb_EDBG_COM(const struct usart_async_descriptor *const io_descr)
-{
- (void) io_descr;
- uart_busy = false;
-}
-
-//------------- IMPLEMENTATION -------------//
-void board_init(void)
-{
- init_mcu();
-
- /* Disable Watchdog */
- hri_wdt_set_MR_WDDIS_bit(WDT);
-
- // LED
- _pmc_enable_periph_clock(ID_PIOC);
- gpio_set_pin_level(LED_PIN, false);
- gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT);
- gpio_set_pin_function(LED_PIN, GPIO_PIN_FUNCTION_OFF);
-
- // Button
- _pmc_enable_periph_clock(ID_PIOA);
- gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN);
- gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP);
- gpio_set_pin_function(BUTTON_PIN, GPIO_PIN_FUNCTION_OFF);
-
- // Uart via EDBG Com
- _pmc_enable_periph_clock(ID_USART1);
- gpio_set_pin_function(UART_RX_PIN, MUX_PA21A_USART1_RXD1);
- gpio_set_pin_function(UART_TX_PIN, MUX_PB4D_USART1_TXD1);
-
- usart_async_init(&edbg_com, USART1, edbg_com_buffer, sizeof(edbg_com_buffer), _usart_get_usart_async());
- usart_async_set_baud_rate(&edbg_com, CFG_BOARD_UART_BAUDRATE);
- usart_async_register_callback(&edbg_com, USART_ASYNC_TXC_CB, tx_cb_EDBG_COM);
- usart_async_enable(&edbg_com);
-
-#if CFG_TUSB_OS == OPT_OS_NONE
- // 1ms tick timer (samd SystemCoreClock may not correct)
- SysTick_Config(CONF_CPU_FREQUENCY / 1000);
-#endif
-
- // Enable USB clock
- _pmc_enable_periph_clock(ID_USBHS);
-
-}
-
-//--------------------------------------------------------------------+
-// USB Interrupt Handler
-//--------------------------------------------------------------------+
-void USBHS_Handler(void)
-{
- tud_int_handler(0);
-}
-
-//--------------------------------------------------------------------+
-// Board porting API
-//--------------------------------------------------------------------+
-
-void board_led_write(bool state)
-{
- gpio_set_pin_level(LED_PIN, state);
-}
-
-uint32_t board_button_read(void)
-{
- return BUTTON_STATE_ACTIVE == gpio_get_pin_level(BUTTON_PIN);
-}
-
-int board_uart_read(uint8_t* buf, int len)
-{
- (void) buf; (void) len;
- return 0;
-}
-
-int board_uart_write(void const * buf, int len)
-{
- // while until previous transfer is complete
- while(uart_busy) {}
- uart_busy = true;
-
- io_write(&edbg_com.io, buf, len);
- return len;
-}
-
-#if CFG_TUSB_OS == OPT_OS_NONE
-volatile uint32_t system_ticks = 0;
-
-void SysTick_Handler (void)
-{
- system_ticks++;
-}
-
-uint32_t board_millis(void)
-{
- return system_ticks;
-}
-#endif
-
-// Required by __libc_init_array in startup code if we are compiling using
-// -nostdlib/-nostartfiles.
-void _init(void)
-{
-
-}
diff --git a/hw/bsp/same7x/boards/same70_qmtech/board.cmake b/hw/bsp/same7x/boards/same70_qmtech/board.cmake
new file mode 100644
index 000000000..cde4c3da6
--- /dev/null
+++ b/hw/bsp/same7x/boards/same70_qmtech/board.cmake
@@ -0,0 +1,8 @@
+set(JLINK_DEVICE SAME70N19B)
+set(LD_FILE_GNU ${TOP}/hw/mcu/microchip/same70/same70b/gcc/gcc/same70q21b_flash.ld)
+
+function(update_board TARGET)
+ target_compile_definitions(${TARGET} PUBLIC
+ __SAME70N19B__
+ )
+endfunction()
diff --git a/hw/bsp/same7x/boards/same70_qmtech/board.h b/hw/bsp/same7x/boards/same70_qmtech/board.h
new file mode 100644
index 000000000..09c2c93a9
--- /dev/null
+++ b/hw/bsp/same7x/boards/same70_qmtech/board.h
@@ -0,0 +1,64 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019, Ha Thach (tinyusb.org)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * This file is part of the TinyUSB stack.
+ */
+
+/* metadata:
+ name: SAME70 QMTech
+ manufacturer: Microchip
+ url: https://www.aliexpress.com/item/1005003173783268.html
+*/
+
+#ifndef BOARD_H_
+#define BOARD_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LED_PIN GPIO(GPIO_PORTA, 15)
+#define LED_STATE_ON 1
+#define LED_PORT_CLOCK ID_PIOB
+
+#define BUTTON_PIN GPIO(GPIO_PORTA, 21)
+#define BUTTON_STATE_ACTIVE 0
+#define BUTTON_PORT_CLOCK ID_PIOA
+
+#define UART_TX_PIN GPIO(GPIO_PORTB, 1)
+#define UART_TX_FUNCTION MUX_PB4D_USART1_TXD1
+#define UART_RX_PIN GPIO(GPIO_PORTB, 0)
+#define UART_RX_FUNCTION MUX_PA21A_USART1_RXD1
+#define UART_PORT_CLOCK ID_USART1
+#define BOARD_USART USART1
+
+static inline void board_vbus_set(uint8_t rhport, bool state) {
+ (void) rhport;
+ (void) state;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BOARD_H_ */
diff --git a/hw/bsp/same7x/boards/same70_qmtech/board.mk b/hw/bsp/same7x/boards/same70_qmtech/board.mk
new file mode 100644
index 000000000..09ae98860
--- /dev/null
+++ b/hw/bsp/same7x/boards/same70_qmtech/board.mk
@@ -0,0 +1,3 @@
+CFLAGS += -D__SAME70N19B__
+
+JLINK_DEVICE = SAME70N19B
diff --git a/hw/bsp/same70_qmtech/hpl_pmc_config.h b/hw/bsp/same7x/boards/same70_qmtech/hpl_pmc_config.h
index 387aaa5df..387aaa5df 100644
--- a/hw/bsp/same70_qmtech/hpl_pmc_config.h
+++ b/hw/bsp/same7x/boards/same70_qmtech/hpl_pmc_config.h
diff --git a/hw/bsp/same70_qmtech/hpl_usart_config.h b/hw/bsp/same7x/boards/same70_qmtech/hpl_usart_config.h
index 50ca3f15c..50ca3f15c 100644
--- a/hw/bsp/same70_qmtech/hpl_usart_config.h
+++ b/hw/bsp/same7x/boards/same70_qmtech/hpl_usart_config.h
diff --git a/hw/bsp/same70_qmtech/hpl_xdmac_config.h b/hw/bsp/same7x/boards/same70_qmtech/hpl_xdmac_config.h
index a3d62c6fc..a3d62c6fc 100644
--- a/hw/bsp/same70_qmtech/hpl_xdmac_config.h
+++ b/hw/bsp/same7x/boards/same70_qmtech/hpl_xdmac_config.h
diff --git a/hw/bsp/same70_qmtech/peripheral_clk_config.h b/hw/bsp/same7x/boards/same70_qmtech/peripheral_clk_config.h
index 84756f5ac..84756f5ac 100644
--- a/hw/bsp/same70_qmtech/peripheral_clk_config.h
+++ b/hw/bsp/same7x/boards/same70_qmtech/peripheral_clk_config.h
diff --git a/hw/bsp/same7x/boards/same70_xplained/board.cmake b/hw/bsp/same7x/boards/same70_xplained/board.cmake
new file mode 100644
index 000000000..b226b6c4f
--- /dev/null
+++ b/hw/bsp/same7x/boards/same70_xplained/board.cmake
@@ -0,0 +1,8 @@
+set(JLINK_DEVICE SAME70Q21B)
+set(LD_FILE_GNU ${TOP}/hw/mcu/microchip/same70/same70b/gcc/gcc/same70q21b_flash.ld)
+
+function(update_board TARGET)
+ target_compile_definitions(${TARGET} PUBLIC
+ __SAME70Q21B__
+ )
+endfunction()
diff --git a/hw/bsp/same7x/boards/same70_xplained/board.h b/hw/bsp/same7x/boards/same70_xplained/board.h
new file mode 100644
index 000000000..85e23deb8
--- /dev/null
+++ b/hw/bsp/same7x/boards/same70_xplained/board.h
@@ -0,0 +1,64 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019, Ha Thach (tinyusb.org)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to do so, subject to the
+ * following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * This file is part of the TinyUSB stack.
+ */
+
+/* metadata:
+ name: SAME70 Xplained
+ manufacturer: Microchip
+ url: https://www.microchip.com/en-us/development-tool/atsame70-xpld
+*/
+
+#ifndef BOARD_H_
+#define BOARD_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LED_PIN GPIO(GPIO_PORTC, 8)
+#define LED_STATE_ON 1
+#define LED_PORT_CLOCK ID_PIOC
+
+#define BUTTON_PIN GPIO(GPIO_PORTA, 11)
+#define BUTTON_STATE_ACTIVE 0
+#define BUTTON_PORT_CLOCK ID_PIOA
+
+#define UART_TX_PIN GPIO(GPIO_PORTB, 4)
+#define UART_TX_FUNCTION MUX_PB4D_USART1_TXD1
+#define UART_RX_PIN GPIO(GPIO_PORTA, 21)
+#define UART_RX_FUNCTION MUX_PA21A_USART1_RXD1
+#define UART_PORT_CLOCK ID_USART1
+#define BOARD_USART USART1
+
+static inline void board_vbus_set(uint8_t rhport, bool state) {
+ (void) rhport;
+ (void) state;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BOARD_H_ */
diff --git a/hw/bsp/same7x/boards/same70_xplained/board.mk b/hw/bsp/same7x/boards/same70_xplained/board.mk
new file mode 100644
index 000000000..ca23a9be5
--- /dev/null
+++ b/hw/bsp/same7x/boards/same70_xplained/board.mk
@@ -0,0 +1,3 @@
+CFLAGS += -D__SAME70Q21B__
+
+JLINK_DEVICE = SAME70Q21B
diff --git a/hw/bsp/same70_xplained/hpl_pmc_config.h b/hw/bsp/same7x/boards/same70_xplained/hpl_pmc_config.h
index 387aaa5df..387aaa5df 100644
--- a/hw/bsp/same70_xplained/hpl_pmc_config.h
+++ b/hw/bsp/same7x/boards/same70_xplained/hpl_pmc_config.h
diff --git a/hw/bsp/same70_xplained/hpl_usart_config.h b/hw/bsp/same7x/boards/same70_xplained/hpl_usart_config.h
index 50ca3f15c..50ca3f15c 100644
--- a/hw/bsp/same70_xplained/hpl_usart_config.h
+++ b/hw/bsp/same7x/boards/same70_xplained/hpl_usart_config.h
diff --git a/hw/bsp/same70_xplained/hpl_xdmac_config.h b/hw/bsp/same7x/boards/same70_xplained/hpl_xdmac_config.h
index a3d62c6fc..a3d62c6fc 100644
--- a/hw/bsp/same70_xplained/hpl_xdmac_config.h
+++ b/hw/bsp/same7x/boards/same70_xplained/hpl_xdmac_config.h
diff --git a/hw/bsp/same70_xplained/peripheral_clk_config.h b/hw/bsp/same7x/boards/same70_xplained/peripheral_clk_config.h
index 84756f5ac..84756f5ac 100644
--- a/hw/bsp/same70_xplained/peripheral_clk_config.h
+++ b/hw/bsp/same7x/boards/same70_xplained/peripheral_clk_config.h
diff --git a/hw/bsp/same7x/family.c b/hw/bsp/same7x/family.c
new file mode 100644
index 000000000..572c83588
--- /dev/null
+++ b/hw/bsp/same7x/family.c
@@ -0,0 +1,196 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019, Ha Thach (tinyusb.org)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to do so, subject to the
+ * following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * This file is part of the TinyUSB stack.
+ */
+
+/* metadata:
+ manufacturer: Microchip
+*/
+
+#include "bsp/board_api.h"
+#include "sam.h"
+
+#include "hal/include/hal_gpio.h"
+#include "hal/include/hal_init.h"
+#include "hal/include/hal_usart_async.h"
+#include "hpl/pmc/hpl_pmc.h"
+#include "hpl/usart/hpl_usart_base.h"
+#include "peripheral_clk_config.h"
+
+static inline void board_vbus_set(uint8_t rhport, bool state);
+void _init(void);
+#include "board.h"
+
+#ifndef LED_STATE_ON
+ #define LED_STATE_ON 1
+#endif
+
+#ifndef LED_PORT_CLOCK
+ #define LED_PORT_CLOCK ID_PIOA
+#endif
+
+#ifndef BUTTON_PORT_CLOCK
+ #define BUTTON_PORT_CLOCK ID_PIOA
+#endif
+
+#ifndef UART_PORT_CLOCK
+ #define UART_PORT_CLOCK ID_USART1
+#endif
+
+#ifndef BOARD_USART
+ #define BOARD_USART USART1
+#endif
+
+#ifndef BOARD_UART_DESCRIPTOR
+ #define BOARD_UART_DESCRIPTOR edbg_com
+#endif
+
+#ifndef BOARD_UART_BUFFER
+ #define BOARD_UART_BUFFER edbg_com_buffer
+#endif
+
+#ifndef BUTTON_STATE_ACTIVE
+ #define BUTTON_STATE_ACTIVE 0
+#endif
+
+#ifndef UART_TX_FUNCTION
+ #define UART_TX_FUNCTION MUX_PB4D_USART1_TXD1
+#endif
+
+#ifndef UART_RX_FUNCTION
+ #define UART_RX_FUNCTION MUX_PA21A_USART1_RXD1
+#endif
+
+#ifndef UART_BUFFER_SIZE
+ #define UART_BUFFER_SIZE 64
+#endif
+
+#define LED_STATE_OFF (1 - LED_STATE_ON)
+
+static struct usart_async_descriptor BOARD_UART_DESCRIPTOR;
+static uint8_t BOARD_UART_BUFFER[UART_BUFFER_SIZE];
+static volatile bool uart_busy = false;
+
+static void tx_complete_cb(const struct usart_async_descriptor *const io_descr) {
+ (void) io_descr;
+ uart_busy = false;
+}
+
+void board_init(void) {
+ init_mcu();
+
+ /* Disable Watchdog */
+ hri_wdt_set_MR_WDDIS_bit(WDT);
+
+#ifdef LED_PIN
+ _pmc_enable_periph_clock(LED_PORT_CLOCK);
+ gpio_set_pin_level(LED_PIN, LED_STATE_OFF);
+ gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT);
+ gpio_set_pin_function(LED_PIN, GPIO_PIN_FUNCTION_OFF);
+#endif
+
+#ifdef BUTTON_PIN
+ _pmc_enable_periph_clock(BUTTON_PORT_CLOCK);
+ gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN);
+ gpio_set_pin_pull_mode(BUTTON_PIN, BUTTON_STATE_ACTIVE ? GPIO_PULL_DOWN : GPIO_PULL_UP);
+ gpio_set_pin_function(BUTTON_PIN, GPIO_PIN_FUNCTION_OFF);
+#endif
+
+ _pmc_enable_periph_clock(UART_PORT_CLOCK);
+ gpio_set_pin_function(UART_RX_PIN, UART_RX_FUNCTION);
+ gpio_set_pin_function(UART_TX_PIN, UART_TX_FUNCTION);
+
+ usart_async_init(&BOARD_UART_DESCRIPTOR, BOARD_USART, BOARD_UART_BUFFER, sizeof(BOARD_UART_BUFFER), _usart_get_usart_async());
+ usart_async_set_baud_rate(&BOARD_UART_DESCRIPTOR, CFG_BOARD_UART_BAUDRATE);
+ usart_async_register_callback(&BOARD_UART_DESCRIPTOR, USART_ASYNC_TXC_CB, tx_complete_cb);
+ usart_async_enable(&BOARD_UART_DESCRIPTOR);
+
+#if CFG_TUSB_OS == OPT_OS_NONE
+ // 1ms tick timer (SystemCoreClock may not be correct after init)
+ SysTick_Config(CONF_CPU_FREQUENCY / 1000);
+#endif
+
+ // Enable USB clock
+ _pmc_enable_periph_clock(ID_USBHS);
+
+#if CFG_TUH_ENABLED
+ board_vbus_set(0, true);
+#endif
+}
+
+//--------------------------------------------------------------------+
+// USB Interrupt Handler
+//--------------------------------------------------------------------+
+void USBHS_Handler(void) {
+ tud_int_handler(0);
+}
+
+//--------------------------------------------------------------------+
+// Board porting API
+//--------------------------------------------------------------------+
+
+void board_led_write(bool state) {
+#ifdef LED_PIN
+ gpio_set_pin_level(LED_PIN, state ? LED_STATE_ON : LED_STATE_OFF);
+#else
+ (void) state;
+#endif
+}
+
+uint32_t board_button_read(void) {
+#ifdef BUTTON_PIN
+ return BUTTON_STATE_ACTIVE == gpio_get_pin_level(BUTTON_PIN);
+#else
+ return 0;
+#endif
+}
+
+int board_uart_read(uint8_t *buf, int len) {
+ (void) buf;
+ (void) len;
+ return 0;
+}
+
+int board_uart_write(void const *buf, int len) {
+ while (uart_busy) {}
+ uart_busy = true;
+
+ io_write(&BOARD_UART_DESCRIPTOR.io, buf, len);
+ return len;
+}
+
+#if CFG_TUSB_OS == OPT_OS_NONE
+volatile uint32_t system_ticks = 0;
+
+void SysTick_Handler(void) {
+ system_ticks++;
+}
+
+uint32_t board_millis(void) {
+ return system_ticks;
+}
+#endif
+
+void _init(void) {
+}
diff --git a/hw/bsp/same7x/family.cmake b/hw/bsp/same7x/family.cmake
new file mode 100644
index 000000000..a1eb197a3
--- /dev/null
+++ b/hw/bsp/same7x/family.cmake
@@ -0,0 +1,121 @@
+include_guard()
+
+include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
+
+set(SDK_DIR ${TOP}/hw/mcu/microchip/same70)
+
+# toolchain set up
+set(CMAKE_SYSTEM_CPU cortex-m7 CACHE INTERNAL "System Processor")
+set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
+
+set(FAMILY_MCUS SAMX7X CACHE INTERNAL "")
+
+#------------------------------------
+# BOARD_TARGET
+#------------------------------------
+function(add_board_target BOARD_TARGET)
+ if (TARGET ${BOARD_TARGET})
+ return()
+ endif ()
+
+ set(STARTUP_FILE_GNU ${SDK_DIR}/same70b/gcc/gcc/startup_same70q21b.c)
+ set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
+
+ if (NOT DEFINED LD_FILE_Clang)
+ set(LD_FILE_Clang ${LD_FILE_GNU})
+ endif ()
+
+ if (NOT DEFINED LD_FILE_IAR)
+ set(LD_FILE_IAR ${LD_FILE_GNU})
+ endif ()
+
+ if (NOT DEFINED LD_FILE_${CMAKE_C_COMPILER_ID})
+ message(FATAL_ERROR "LD_FILE_${CMAKE_C_COMPILER_ID} not defined")
+ endif ()
+
+ add_library(${BOARD_TARGET} STATIC
+ ${SDK_DIR}/same70b/gcc/system_same70q21b.c
+ ${SDK_DIR}/hpl/core/hpl_init.c
+ ${SDK_DIR}/hpl/usart/hpl_usart.c
+ ${SDK_DIR}/hpl/pmc/hpl_pmc.c
+ ${SDK_DIR}/hal/src/hal_usart_async.c
+ ${SDK_DIR}/hal/src/hal_io.c
+ ${SDK_DIR}/hal/src/hal_atomic.c
+ ${SDK_DIR}/hal/utils/src/utils_ringbuffer.c
+ ${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
+ )
+ target_include_directories(${BOARD_TARGET} PUBLIC
+ ${SDK_DIR}
+ ${SDK_DIR}/config
+ ${SDK_DIR}/same70b/include
+ ${SDK_DIR}/hal/include
+ ${SDK_DIR}/hal/utils/include
+ ${SDK_DIR}/hpl/core
+ ${SDK_DIR}/hpl/pio
+ ${SDK_DIR}/hpl/pmc
+ ${SDK_DIR}/hri
+ ${SDK_DIR}/CMSIS/Core/Include
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
+ )
+
+ update_board(${BOARD_TARGET})
+
+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ target_link_options(${BOARD_TARGET} PUBLIC
+ "LINKER:--script=${LD_FILE_GNU}"
+ -nostartfiles
+ --specs=nosys.specs --specs=nano.specs
+ )
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ target_link_options(${BOARD_TARGET} PUBLIC
+ "LINKER:--script=${LD_FILE_Clang}"
+ )
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
+ target_link_options(${BOARD_TARGET} PUBLIC
+ "LINKER:--config=${LD_FILE_IAR}"
+ )
+ endif ()
+
+ target_compile_options(${BOARD_TARGET} PUBLIC
+ -Wno-error=unused-parameter
+ -Wno-error=cast-align
+ -Wno-error=redundant-decls
+ -Wno-error=cast-qual
+ )
+endfunction()
+
+#------------------------------------
+# Functions
+#------------------------------------
+function(family_configure_example TARGET RTOS)
+ family_configure_common(${TARGET} ${RTOS})
+
+ add_board_target(board_${BOARD})
+
+ target_sources(${TARGET} PUBLIC
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
+ )
+
+ target_include_directories(${TARGET} PUBLIC
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
+ )
+
+ family_add_tinyusb(${TARGET} OPT_MCU_SAMX7X)
+ target_sources(${TARGET} PUBLIC
+ ${TOP}/src/portable/microchip/samx7x/dcd_samx7x.c
+ )
+
+ target_link_libraries(${TARGET} PUBLIC board_${BOARD})
+ target_compile_options(${TARGET} PUBLIC
+ -Wno-error=unused-parameter
+ -Wno-error=cast-align
+ -Wno-error=redundant-decls
+ -Wno-error=cast-qual
+ )
+
+ family_add_bin_hex(${TARGET})
+ family_flash_jlink(${TARGET})
+endfunction()
diff --git a/hw/bsp/same7x/family.mk b/hw/bsp/same7x/family.mk
new file mode 100644
index 000000000..c8fa74d71
--- /dev/null
+++ b/hw/bsp/same7x/family.mk
@@ -0,0 +1,56 @@
+SDK_DIR = hw/mcu/microchip/same70
+
+include $(TOP)/$(BOARD_PATH)/board.mk
+CPU_CORE ?= cortex-m7
+
+CFLAGS += \
+ -mthumb \
+ -mabi=aapcs \
+ -mcpu=cortex-m7 \
+ -mfloat-abi=hard \
+ -mfpu=fpv4-sp-d16 \
+ -nostdlib -nostartfiles \
+ -DCFG_TUSB_MCU=OPT_MCU_SAMX7X
+
+# suppress following warnings from mcu driver
+CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align -Wno-error=redundant-decls
+
+# SAM driver is flooded with -Wcast-qual which slows down compilation significantly
+CFLAGS_SKIP += -Wcast-qual
+
+LDFLAGS_GCC += -specs=nosys.specs -specs=nano.specs
+
+# All source paths should be relative to the top level.
+LD_FILE = $(SDK_DIR)/same70b/gcc/gcc/same70q21b_flash.ld
+
+SRC_C += \
+ src/portable/microchip/samx7x/dcd_samx7x.c \
+ $(SDK_DIR)/same70b/gcc/gcc/startup_same70q21b.c \
+ $(SDK_DIR)/same70b/gcc/system_same70q21b.c \
+ $(SDK_DIR)/hpl/core/hpl_init.c \
+ $(SDK_DIR)/hpl/usart/hpl_usart.c \
+ $(SDK_DIR)/hpl/pmc/hpl_pmc.c \
+ $(SDK_DIR)/hal/src/hal_usart_async.c \
+ $(SDK_DIR)/hal/src/hal_io.c \
+ $(SDK_DIR)/hal/src/hal_atomic.c \
+ $(SDK_DIR)/hal/utils/src/utils_ringbuffer.c
+
+INC += \
+ $(TOP)/$(BOARD_PATH) \
+ $(TOP)/$(SDK_DIR) \
+ $(TOP)/$(SDK_DIR)/config \
+ $(TOP)/$(SDK_DIR)/same70b/include \
+ $(TOP)/$(SDK_DIR)/hal/include \
+ $(TOP)/$(SDK_DIR)/hal/utils/include \
+ $(TOP)/$(SDK_DIR)/hpl/core \
+ $(TOP)/$(SDK_DIR)/hpl/pio \
+ $(TOP)/$(SDK_DIR)/hpl/pmc \
+ $(TOP)/$(SDK_DIR)/hri \
+ $(TOP)/$(SDK_DIR)/CMSIS/Core/Include
+
+# For freeRTOS port source
+FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM7
+
+# For flash-jlink target
+flash: $(BUILD)/$(PROJECT).bin
+ edbg --verbose -t same70 -pv -f $<