From 1630c7b52d1442b46e598f30633093f63c192532 Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Fri, 18 Feb 2022 10:39:03 +0100 Subject: [PATCH] Adding unique_id variable. Signed-off-by: Pol Henarejos --- CMakeLists.txt | 2 +- hsm2040.c | 5 +++++ hsm2040.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 62d41fd..5b61b80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,7 +77,7 @@ target_include_directories(hsm2040 PUBLIC ) pico_add_extra_outputs(hsm2040) -target_link_libraries(hsm2040 PRIVATE pico_stdlib tinyusb_device tinyusb_board pico_multicore hardware_flash hardware_sync hardware_adc) +target_link_libraries(hsm2040 PRIVATE pico_stdlib tinyusb_device tinyusb_board pico_multicore hardware_flash hardware_sync hardware_adc pico_unique_id) # #project(flash_nuke C CXX ASM) diff --git a/hsm2040.c b/hsm2040.c index d60aa48..fbabf02 100644 --- a/hsm2040.c +++ b/hsm2040.c @@ -1747,6 +1747,8 @@ void led_off_all() #include "hardware/sync.h" extern void neug_task(); +pico_unique_board_id_t unique_id; + int main(void) { struct apdu *a = &apdu; @@ -1771,6 +1773,9 @@ int main(void) random_init(); low_flash_init(); + + pico_get_unique_board_id(&unique_id); + DEBUG_PAYLOAD(unique_id.id,8); while (1) { diff --git a/hsm2040.h b/hsm2040.h index 1e6b161..0caebcf 100644 --- a/hsm2040.h +++ b/hsm2040.h @@ -10,6 +10,7 @@ #include "ccid.h" #include "tusb.h" #include "file.h" +#include "pico/unique_id.h" #define USB_REQ_CCID 0xA1 @@ -111,4 +112,6 @@ void put_binary (const char *s, int len); extern int flash_write_data_to_file(file_t *file, const uint8_t *data, uint16_t len); extern void low_flash_available(); + +extern pico_unique_board_id_t unique_id; #endif \ No newline at end of file