summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-12-13 18:54:00 +0700
committerhathach <[email protected]>2023-12-13 18:54:00 +0700
commit19d7d62e804dbf26f9d193d72710574abcd6fa95 (patch)
treea4922ca57196e788b487f734f4d9345922858964 /hw
parent59ecdb78fed4221c3e623d7ea9a9e69c3cd87aae (diff)
try to add samd51 to hil pool using doublereset (rpi gpio) and bossac
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/samd21/family.cmake3
-rw-r--r--hw/bsp/samd51/family.c14
-rw-r--r--hw/bsp/samd51/family.cmake4
3 files changed, 19 insertions, 2 deletions
diff --git a/hw/bsp/samd21/family.cmake b/hw/bsp/samd21/family.cmake
index 44aad6ecb..a79a25b54 100644
--- a/hw/bsp/samd21/family.cmake
+++ b/hw/bsp/samd21/family.cmake
@@ -10,7 +10,7 @@ set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus CACHE INTERNAL "System Processor")
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
set(FAMILY_MCUS SAMD21 CACHE INTERNAL "")
-
+set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -c \"transport select swd\" -f target/at91samdXX.cfg")
#------------------------------------
# BOARD_TARGET
@@ -102,4 +102,5 @@ function(family_configure_example TARGET RTOS)
# Flashing
family_flash_jlink(${TARGET})
+ #family_flash_openocd(${TARGET} ${OPENOCD_OPTION})
endfunction()
diff --git a/hw/bsp/samd51/family.c b/hw/bsp/samd51/family.c
index 009a0d290..170c88191 100644
--- a/hw/bsp/samd51/family.c
+++ b/hw/bsp/samd51/family.c
@@ -157,6 +157,20 @@ uint32_t board_button_read(void) {
return gpio_get_pin_level(BUTTON_PIN) ? 0 : 1;
}
+size_t board_get_unique_id(uint8_t id[], size_t max_len) {
+ (void) max_len;
+
+ uint32_t did_addr[4] = {0x008061FC, 0x00806010, 0x00806014, 0x00806018};
+
+ for (int i = 0; i < 4; i++) {
+ uint32_t did = *((uint32_t const*) did_addr[i]);
+ did = TU_BSWAP32(did); // swap endian to match samd51 uf2 bootloader
+ memcpy(id + i * 4, &did, 4);
+ }
+
+ return 16;
+}
+
int board_uart_read(uint8_t* buf, int len) {
(void) buf;
(void) len;
diff --git a/hw/bsp/samd51/family.cmake b/hw/bsp/samd51/family.cmake
index 7591f3b1b..4d91bf1a6 100644
--- a/hw/bsp/samd51/family.cmake
+++ b/hw/bsp/samd51/family.cmake
@@ -10,7 +10,7 @@ set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
set(FAMILY_MCUS SAMD51 CACHE INTERNAL "")
-
+set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -c \"transport select swd\" -c \"set CHIPNAME samd51\" -f target/atsame5x.cfg")
#------------------------------------
# BOARD_TARGET
@@ -100,5 +100,7 @@ function(family_configure_example TARGET RTOS)
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
# Flashing
+ family_add_bin_hex(${TARGET})
family_flash_jlink(${TARGET})
+ #family_flash_openocd(${TARGET} ${OPENOCD_OPTION})
endfunction()