From 78e5b2c6a4d58701dbb9c0ff69ba6cc02f5cc8e1 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 14 Aug 2023 16:52:16 +0700 Subject: [PATCH] add board_get_unique_id() for lpc43 --- hw/bsp/lpc43/family.c | 7 +++++++ hw/bsp/lpc43/family.cmake | 1 + hw/bsp/lpc43/family.mk | 11 +++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/hw/bsp/lpc43/family.c b/hw/bsp/lpc43/family.c index 1c79ba7cf..8d80bf951 100644 --- a/hw/bsp/lpc43/family.c +++ b/hw/bsp/lpc43/family.c @@ -236,6 +236,13 @@ uint32_t board_button_read(void) { return BUTTON_STATE_ACTIVE == Chip_GPIO_GetPinState(LPC_GPIO_PORT, BUTTON_PORT, BUTTON_PIN); } +size_t board_get_unique_id(uint8_t id[], size_t max_len) { + if ( max_len < 16 ) return 0; + uint32_t* id32 = (uint32_t*) (uintptr_t) id; + Chip_IAP_ReadUID(id32); + return 16; +} + int board_uart_read(uint8_t *buf, int len) { return Chip_UART_Read(UART_DEV, buf, len); } diff --git a/hw/bsp/lpc43/family.cmake b/hw/bsp/lpc43/family.cmake index 9fd78c9c2..e79004686 100644 --- a/hw/bsp/lpc43/family.cmake +++ b/hw/bsp/lpc43/family.cmake @@ -24,6 +24,7 @@ function(add_board_target BOARD_TARGET) ${SDK_DIR}/src/clock_18xx_43xx.c ${SDK_DIR}/src/fpu_init.c ${SDK_DIR}/src/gpio_18xx_43xx.c + ${SDK_DIR}/src/iap_18xx_43xx.c ${SDK_DIR}/src/sysinit_18xx_43xx.c ${SDK_DIR}/src/uart_18xx_43xx.c ) diff --git a/hw/bsp/lpc43/family.mk b/hw/bsp/lpc43/family.mk index 4a1c2fb3c..55d86e955 100644 --- a/hw/bsp/lpc43/family.mk +++ b/hw/bsp/lpc43/family.mk @@ -12,7 +12,11 @@ CFLAGS += \ -DCFG_TUSB_MCU=OPT_MCU_LPC43XX # mcu driver cause following warnings -CFLAGS += -Wno-error=unused-parameter -Wno-error=strict-prototypes -Wno-error=cast-qual +CFLAGS += \ + -Wno-error=unused-parameter \ + -Wno-error=strict-prototypes \ + -Wno-error=cast-qual \ + -Wno-error=incompatible-pointer-types \ SRC_C += \ src/portable/chipidea/ci_hs/dcd_ci_hs.c \ @@ -21,12 +25,11 @@ SRC_C += \ ${SDK_DIR}/../gcc/cr_startup_lpc43xx.c \ ${SDK_DIR}/src/chip_18xx_43xx.c \ ${SDK_DIR}/src/clock_18xx_43xx.c \ + ${SDK_DIR}/src/fpu_init.c \ ${SDK_DIR}/src/gpio_18xx_43xx.c \ + ${SDK_DIR}/src/iap_18xx_43xx.c \ ${SDK_DIR}/src/sysinit_18xx_43xx.c \ - ${SDK_DIR}/src/i2c_18xx_43xx.c \ - ${SDK_DIR}/src/i2cm_18xx_43xx.c \ ${SDK_DIR}/src/uart_18xx_43xx.c \ - ${SDK_DIR}/src/fpu_init.c INC += \ $(TOP)/$(BOARD_PATH) \