From 3f75ee2a228743860953595acdb5d837a64048d3 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Tue, 11 Jun 2024 10:50:37 +0200 Subject: [PATCH 1/5] chore(cmake): update database Signed-off-by: Frederic Pillon --- cmake/boards_db.cmake | 694 +++++++++++++++++- .../CMakeLists.txt | 1 + 2 files changed, 689 insertions(+), 6 deletions(-) diff --git a/cmake/boards_db.cmake b/cmake/boards_db.cmake index df3fdff42f..12c8346ce6 100644 --- a/cmake/boards_db.cmake +++ b/cmake/boards_db.cmake @@ -5888,14 +5888,14 @@ target_compile_options(ELEKTOR_F072CB_serial_none INTERFACE # ----------------------------------------------------------------------------- set(ELV_BM_TRX1_VARIANT_PATH "${CMAKE_CURRENT_LIST_DIR}/../variants/STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I") -set(ELV_BM_TRX1_MAXSIZE 124927) -set(ELV_BM_TRX1_MAXDATASIZE 16383) +set(ELV_BM_TRX1_MAXSIZE 129024) +set(ELV_BM_TRX1_MAXDATASIZE 49152) set(ELV_BM_TRX1_MCU cortex-m4) set(ELV_BM_TRX1_FPCONF "-") add_library(ELV_BM_TRX1 INTERFACE) target_compile_options(ELV_BM_TRX1 INTERFACE "SHELL:-DSTM32WLE5xx -DUSE_CM4_STARTUP_FILE " - "SHELL:" + "SHELL:-DCUSTOM_PERIPHERAL_PINS" "SHELL:" "SHELL: " -mcpu=${ELV_BM_TRX1_MCU} @@ -5918,9 +5918,9 @@ target_include_directories(ELV_BM_TRX1 INTERFACE target_link_options(ELV_BM_TRX1 INTERFACE "LINKER:--default-script=${ELV_BM_TRX1_VARIANT_PATH}/ldscript.ld" - "LINKER:--defsym=LD_FLASH_OFFSET=0x0800" - "LINKER:--defsym=LD_MAX_SIZE=124927" - "LINKER:--defsym=LD_MAX_DATA_SIZE=16383" + "LINKER:--defsym=LD_FLASH_OFFSET=0x800" + "LINKER:--defsym=LD_MAX_SIZE=129024" + "LINKER:--defsym=LD_MAX_DATA_SIZE=49152" "SHELL: " -mcpu=${ELV_BM_TRX1_MCU} ) @@ -6616,6 +6616,114 @@ target_compile_options(GENERIC_C011F6UX_serial_none INTERFACE "SHELL:-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE" ) +# GENERIC_C011J4MX +# ----------------------------------------------------------------------------- + +set(GENERIC_C011J4MX_VARIANT_PATH "${CMAKE_CURRENT_LIST_DIR}/../variants/STM32C0xx/C011J(4-6)M") +set(GENERIC_C011J4MX_MAXSIZE 16384) +set(GENERIC_C011J4MX_MAXDATASIZE 6144) +set(GENERIC_C011J4MX_MCU cortex-m0plus) +set(GENERIC_C011J4MX_FPCONF "-") +add_library(GENERIC_C011J4MX INTERFACE) +target_compile_options(GENERIC_C011J4MX INTERFACE + "SHELL:-DSTM32C011xx -D__CORTEX_SC=0" + "SHELL:" + "SHELL:" + "SHELL: " + -mcpu=${GENERIC_C011J4MX_MCU} +) +target_compile_definitions(GENERIC_C011J4MX INTERFACE + "STM32C0xx" + "ARDUINO_GENERIC_C011J4MX" + "BOARD_NAME=\"GENERIC_C011J4MX\"" + "BOARD_ID=GENERIC_C011J4MX" + "VARIANT_H=\"variant_generic.h\"" +) +target_include_directories(GENERIC_C011J4MX INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/../system/STM32C0xx + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32C0xx_HAL_Driver/Inc + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32C0xx_HAL_Driver/Src + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32C0xx/Include/ + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32C0xx/Source/Templates/gcc/ + ${GENERIC_C011J4MX_VARIANT_PATH} +) + +target_link_options(GENERIC_C011J4MX INTERFACE + "LINKER:--default-script=${GENERIC_C011J4MX_VARIANT_PATH}/ldscript.ld" + "LINKER:--defsym=LD_FLASH_OFFSET=0x0" + "LINKER:--defsym=LD_MAX_SIZE=16384" + "LINKER:--defsym=LD_MAX_DATA_SIZE=6144" + "SHELL: " + -mcpu=${GENERIC_C011J4MX_MCU} +) + +add_library(GENERIC_C011J4MX_serial_disabled INTERFACE) +target_compile_options(GENERIC_C011J4MX_serial_disabled INTERFACE + "SHELL:" +) +add_library(GENERIC_C011J4MX_serial_generic INTERFACE) +target_compile_options(GENERIC_C011J4MX_serial_generic INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED" +) +add_library(GENERIC_C011J4MX_serial_none INTERFACE) +target_compile_options(GENERIC_C011J4MX_serial_none INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE" +) + +# GENERIC_C011J6MX +# ----------------------------------------------------------------------------- + +set(GENERIC_C011J6MX_VARIANT_PATH "${CMAKE_CURRENT_LIST_DIR}/../variants/STM32C0xx/C011J(4-6)M") +set(GENERIC_C011J6MX_MAXSIZE 32768) +set(GENERIC_C011J6MX_MAXDATASIZE 6144) +set(GENERIC_C011J6MX_MCU cortex-m0plus) +set(GENERIC_C011J6MX_FPCONF "-") +add_library(GENERIC_C011J6MX INTERFACE) +target_compile_options(GENERIC_C011J6MX INTERFACE + "SHELL:-DSTM32C011xx -D__CORTEX_SC=0" + "SHELL:" + "SHELL:" + "SHELL: " + -mcpu=${GENERIC_C011J6MX_MCU} +) +target_compile_definitions(GENERIC_C011J6MX INTERFACE + "STM32C0xx" + "ARDUINO_GENERIC_C011J6MX" + "BOARD_NAME=\"GENERIC_C011J6MX\"" + "BOARD_ID=GENERIC_C011J6MX" + "VARIANT_H=\"variant_generic.h\"" +) +target_include_directories(GENERIC_C011J6MX INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/../system/STM32C0xx + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32C0xx_HAL_Driver/Inc + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32C0xx_HAL_Driver/Src + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32C0xx/Include/ + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32C0xx/Source/Templates/gcc/ + ${GENERIC_C011J6MX_VARIANT_PATH} +) + +target_link_options(GENERIC_C011J6MX INTERFACE + "LINKER:--default-script=${GENERIC_C011J6MX_VARIANT_PATH}/ldscript.ld" + "LINKER:--defsym=LD_FLASH_OFFSET=0x0" + "LINKER:--defsym=LD_MAX_SIZE=32768" + "LINKER:--defsym=LD_MAX_DATA_SIZE=6144" + "SHELL: " + -mcpu=${GENERIC_C011J6MX_MCU} +) + +add_library(GENERIC_C011J6MX_serial_disabled INTERFACE) +target_compile_options(GENERIC_C011J6MX_serial_disabled INTERFACE + "SHELL:" +) +add_library(GENERIC_C011J6MX_serial_generic INTERFACE) +target_compile_options(GENERIC_C011J6MX_serial_generic INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED" +) +add_library(GENERIC_C011J6MX_serial_none INTERFACE) +target_compile_options(GENERIC_C011J6MX_serial_none INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE" +) + # GENERIC_C031C4TX # ----------------------------------------------------------------------------- @@ -77330,6 +77438,580 @@ target_compile_options(GENERIC_H757XIHX_xusb_HSFS INTERFACE "SHELL:-DUSE_USB_HS -DUSE_USB_HS_IN_FS" ) +# GENERIC_H7A3VGHX +# ----------------------------------------------------------------------------- + +set(GENERIC_H7A3VGHX_VARIANT_PATH "${CMAKE_CURRENT_LIST_DIR}/../variants/STM32H7xx/H7A3V(G-I)(H-T)_H7B0VBT_H7B3VI(H-T)") +set(GENERIC_H7A3VGHX_MAXSIZE 1048576) +set(GENERIC_H7A3VGHX_MAXDATASIZE 1048576) +set(GENERIC_H7A3VGHX_MCU cortex-m7) +set(GENERIC_H7A3VGHX_FPCONF "-") +add_library(GENERIC_H7A3VGHX INTERFACE) +target_compile_options(GENERIC_H7A3VGHX INTERFACE + "SHELL:-DCORE_CM7 -DSTM32H7A3xx " + "SHELL:" + "SHELL:" + "SHELL:-mfpu=fpv4-sp-d16 -mfloat-abi=hard" + -mcpu=${GENERIC_H7A3VGHX_MCU} +) +target_compile_definitions(GENERIC_H7A3VGHX INTERFACE + "STM32H7xx" + "ARDUINO_GENERIC_H7A3VGHX" + "BOARD_NAME=\"GENERIC_H7A3VGHX\"" + "BOARD_ID=GENERIC_H7A3VGHX" + "VARIANT_H=\"variant_generic.h\"" +) +target_include_directories(GENERIC_H7A3VGHX INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/../system/STM32H7xx + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32H7xx_HAL_Driver/Inc + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32H7xx_HAL_Driver/Src + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32H7xx/Include/ + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32H7xx/Source/Templates/gcc/ + ${GENERIC_H7A3VGHX_VARIANT_PATH} +) + +target_link_options(GENERIC_H7A3VGHX INTERFACE + "LINKER:--default-script=${GENERIC_H7A3VGHX_VARIANT_PATH}/ldscript.ld" + "LINKER:--defsym=LD_FLASH_OFFSET=0x0" + "LINKER:--defsym=LD_MAX_SIZE=1048576" + "LINKER:--defsym=LD_MAX_DATA_SIZE=1048576" + "SHELL:-mfpu=fpv4-sp-d16 -mfloat-abi=hard" + -mcpu=${GENERIC_H7A3VGHX_MCU} +) + +add_library(GENERIC_H7A3VGHX_serial_disabled INTERFACE) +target_compile_options(GENERIC_H7A3VGHX_serial_disabled INTERFACE + "SHELL:" +) +add_library(GENERIC_H7A3VGHX_serial_generic INTERFACE) +target_compile_options(GENERIC_H7A3VGHX_serial_generic INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED" +) +add_library(GENERIC_H7A3VGHX_serial_none INTERFACE) +target_compile_options(GENERIC_H7A3VGHX_serial_none INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE" +) +add_library(GENERIC_H7A3VGHX_usb_CDC INTERFACE) +target_compile_options(GENERIC_H7A3VGHX_usb_CDC INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC -DDISABLE_GENERIC_SERIALUSB" +) +add_library(GENERIC_H7A3VGHX_usb_CDCgen INTERFACE) +target_compile_options(GENERIC_H7A3VGHX_usb_CDCgen INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC" +) +add_library(GENERIC_H7A3VGHX_usb_HID INTERFACE) +target_compile_options(GENERIC_H7A3VGHX_usb_HID INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_HID_COMPOSITE" +) +add_library(GENERIC_H7A3VGHX_usb_none INTERFACE) +target_compile_options(GENERIC_H7A3VGHX_usb_none INTERFACE + "SHELL:" +) +add_library(GENERIC_H7A3VGHX_xusb_FS INTERFACE) +target_compile_options(GENERIC_H7A3VGHX_xusb_FS INTERFACE + "SHELL:" +) +add_library(GENERIC_H7A3VGHX_xusb_HS INTERFACE) +target_compile_options(GENERIC_H7A3VGHX_xusb_HS INTERFACE + "SHELL:-DUSE_USB_HS" +) +add_library(GENERIC_H7A3VGHX_xusb_HSFS INTERFACE) +target_compile_options(GENERIC_H7A3VGHX_xusb_HSFS INTERFACE + "SHELL:-DUSE_USB_HS -DUSE_USB_HS_IN_FS" +) + +# GENERIC_H7A3VGTX +# ----------------------------------------------------------------------------- + +set(GENERIC_H7A3VGTX_VARIANT_PATH "${CMAKE_CURRENT_LIST_DIR}/../variants/STM32H7xx/H7A3V(G-I)(H-T)_H7B0VBT_H7B3VI(H-T)") +set(GENERIC_H7A3VGTX_MAXSIZE 1048576) +set(GENERIC_H7A3VGTX_MAXDATASIZE 1048576) +set(GENERIC_H7A3VGTX_MCU cortex-m7) +set(GENERIC_H7A3VGTX_FPCONF "-") +add_library(GENERIC_H7A3VGTX INTERFACE) +target_compile_options(GENERIC_H7A3VGTX INTERFACE + "SHELL:-DCORE_CM7 -DSTM32H7A3xx " + "SHELL:" + "SHELL:" + "SHELL:-mfpu=fpv4-sp-d16 -mfloat-abi=hard" + -mcpu=${GENERIC_H7A3VGTX_MCU} +) +target_compile_definitions(GENERIC_H7A3VGTX INTERFACE + "STM32H7xx" + "ARDUINO_GENERIC_H7A3VGTX" + "BOARD_NAME=\"GENERIC_H7A3VGTX\"" + "BOARD_ID=GENERIC_H7A3VGTX" + "VARIANT_H=\"variant_generic.h\"" +) +target_include_directories(GENERIC_H7A3VGTX INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/../system/STM32H7xx + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32H7xx_HAL_Driver/Inc + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32H7xx_HAL_Driver/Src + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32H7xx/Include/ + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32H7xx/Source/Templates/gcc/ + ${GENERIC_H7A3VGTX_VARIANT_PATH} +) + +target_link_options(GENERIC_H7A3VGTX INTERFACE + "LINKER:--default-script=${GENERIC_H7A3VGTX_VARIANT_PATH}/ldscript.ld" + "LINKER:--defsym=LD_FLASH_OFFSET=0x0" + "LINKER:--defsym=LD_MAX_SIZE=1048576" + "LINKER:--defsym=LD_MAX_DATA_SIZE=1048576" + "SHELL:-mfpu=fpv4-sp-d16 -mfloat-abi=hard" + -mcpu=${GENERIC_H7A3VGTX_MCU} +) + +add_library(GENERIC_H7A3VGTX_serial_disabled INTERFACE) +target_compile_options(GENERIC_H7A3VGTX_serial_disabled INTERFACE + "SHELL:" +) +add_library(GENERIC_H7A3VGTX_serial_generic INTERFACE) +target_compile_options(GENERIC_H7A3VGTX_serial_generic INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED" +) +add_library(GENERIC_H7A3VGTX_serial_none INTERFACE) +target_compile_options(GENERIC_H7A3VGTX_serial_none INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE" +) +add_library(GENERIC_H7A3VGTX_usb_CDC INTERFACE) +target_compile_options(GENERIC_H7A3VGTX_usb_CDC INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC -DDISABLE_GENERIC_SERIALUSB" +) +add_library(GENERIC_H7A3VGTX_usb_CDCgen INTERFACE) +target_compile_options(GENERIC_H7A3VGTX_usb_CDCgen INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC" +) +add_library(GENERIC_H7A3VGTX_usb_HID INTERFACE) +target_compile_options(GENERIC_H7A3VGTX_usb_HID INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_HID_COMPOSITE" +) +add_library(GENERIC_H7A3VGTX_usb_none INTERFACE) +target_compile_options(GENERIC_H7A3VGTX_usb_none INTERFACE + "SHELL:" +) +add_library(GENERIC_H7A3VGTX_xusb_FS INTERFACE) +target_compile_options(GENERIC_H7A3VGTX_xusb_FS INTERFACE + "SHELL:" +) +add_library(GENERIC_H7A3VGTX_xusb_HS INTERFACE) +target_compile_options(GENERIC_H7A3VGTX_xusb_HS INTERFACE + "SHELL:-DUSE_USB_HS" +) +add_library(GENERIC_H7A3VGTX_xusb_HSFS INTERFACE) +target_compile_options(GENERIC_H7A3VGTX_xusb_HSFS INTERFACE + "SHELL:-DUSE_USB_HS -DUSE_USB_HS_IN_FS" +) + +# GENERIC_H7A3VIHX +# ----------------------------------------------------------------------------- + +set(GENERIC_H7A3VIHX_VARIANT_PATH "${CMAKE_CURRENT_LIST_DIR}/../variants/STM32H7xx/H7A3V(G-I)(H-T)_H7B0VBT_H7B3VI(H-T)") +set(GENERIC_H7A3VIHX_MAXSIZE 2097152) +set(GENERIC_H7A3VIHX_MAXDATASIZE 1048576) +set(GENERIC_H7A3VIHX_MCU cortex-m7) +set(GENERIC_H7A3VIHX_FPCONF "-") +add_library(GENERIC_H7A3VIHX INTERFACE) +target_compile_options(GENERIC_H7A3VIHX INTERFACE + "SHELL:-DCORE_CM7 -DSTM32H7A3xx " + "SHELL:" + "SHELL:" + "SHELL:-mfpu=fpv4-sp-d16 -mfloat-abi=hard" + -mcpu=${GENERIC_H7A3VIHX_MCU} +) +target_compile_definitions(GENERIC_H7A3VIHX INTERFACE + "STM32H7xx" + "ARDUINO_GENERIC_H7A3VIHX" + "BOARD_NAME=\"GENERIC_H7A3VIHX\"" + "BOARD_ID=GENERIC_H7A3VIHX" + "VARIANT_H=\"variant_generic.h\"" +) +target_include_directories(GENERIC_H7A3VIHX INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/../system/STM32H7xx + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32H7xx_HAL_Driver/Inc + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32H7xx_HAL_Driver/Src + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32H7xx/Include/ + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32H7xx/Source/Templates/gcc/ + ${GENERIC_H7A3VIHX_VARIANT_PATH} +) + +target_link_options(GENERIC_H7A3VIHX INTERFACE + "LINKER:--default-script=${GENERIC_H7A3VIHX_VARIANT_PATH}/ldscript.ld" + "LINKER:--defsym=LD_FLASH_OFFSET=0x0" + "LINKER:--defsym=LD_MAX_SIZE=2097152" + "LINKER:--defsym=LD_MAX_DATA_SIZE=1048576" + "SHELL:-mfpu=fpv4-sp-d16 -mfloat-abi=hard" + -mcpu=${GENERIC_H7A3VIHX_MCU} +) + +add_library(GENERIC_H7A3VIHX_serial_disabled INTERFACE) +target_compile_options(GENERIC_H7A3VIHX_serial_disabled INTERFACE + "SHELL:" +) +add_library(GENERIC_H7A3VIHX_serial_generic INTERFACE) +target_compile_options(GENERIC_H7A3VIHX_serial_generic INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED" +) +add_library(GENERIC_H7A3VIHX_serial_none INTERFACE) +target_compile_options(GENERIC_H7A3VIHX_serial_none INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE" +) +add_library(GENERIC_H7A3VIHX_usb_CDC INTERFACE) +target_compile_options(GENERIC_H7A3VIHX_usb_CDC INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC -DDISABLE_GENERIC_SERIALUSB" +) +add_library(GENERIC_H7A3VIHX_usb_CDCgen INTERFACE) +target_compile_options(GENERIC_H7A3VIHX_usb_CDCgen INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC" +) +add_library(GENERIC_H7A3VIHX_usb_HID INTERFACE) +target_compile_options(GENERIC_H7A3VIHX_usb_HID INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_HID_COMPOSITE" +) +add_library(GENERIC_H7A3VIHX_usb_none INTERFACE) +target_compile_options(GENERIC_H7A3VIHX_usb_none INTERFACE + "SHELL:" +) +add_library(GENERIC_H7A3VIHX_xusb_FS INTERFACE) +target_compile_options(GENERIC_H7A3VIHX_xusb_FS INTERFACE + "SHELL:" +) +add_library(GENERIC_H7A3VIHX_xusb_HS INTERFACE) +target_compile_options(GENERIC_H7A3VIHX_xusb_HS INTERFACE + "SHELL:-DUSE_USB_HS" +) +add_library(GENERIC_H7A3VIHX_xusb_HSFS INTERFACE) +target_compile_options(GENERIC_H7A3VIHX_xusb_HSFS INTERFACE + "SHELL:-DUSE_USB_HS -DUSE_USB_HS_IN_FS" +) + +# GENERIC_H7A3VITX +# ----------------------------------------------------------------------------- + +set(GENERIC_H7A3VITX_VARIANT_PATH "${CMAKE_CURRENT_LIST_DIR}/../variants/STM32H7xx/H7A3V(G-I)(H-T)_H7B0VBT_H7B3VI(H-T)") +set(GENERIC_H7A3VITX_MAXSIZE 2097152) +set(GENERIC_H7A3VITX_MAXDATASIZE 1048576) +set(GENERIC_H7A3VITX_MCU cortex-m7) +set(GENERIC_H7A3VITX_FPCONF "-") +add_library(GENERIC_H7A3VITX INTERFACE) +target_compile_options(GENERIC_H7A3VITX INTERFACE + "SHELL:-DCORE_CM7 -DSTM32H7A3xx " + "SHELL:" + "SHELL:" + "SHELL:-mfpu=fpv4-sp-d16 -mfloat-abi=hard" + -mcpu=${GENERIC_H7A3VITX_MCU} +) +target_compile_definitions(GENERIC_H7A3VITX INTERFACE + "STM32H7xx" + "ARDUINO_GENERIC_H7A3VITX" + "BOARD_NAME=\"GENERIC_H7A3VITX\"" + "BOARD_ID=GENERIC_H7A3VITX" + "VARIANT_H=\"variant_generic.h\"" +) +target_include_directories(GENERIC_H7A3VITX INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/../system/STM32H7xx + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32H7xx_HAL_Driver/Inc + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32H7xx_HAL_Driver/Src + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32H7xx/Include/ + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32H7xx/Source/Templates/gcc/ + ${GENERIC_H7A3VITX_VARIANT_PATH} +) + +target_link_options(GENERIC_H7A3VITX INTERFACE + "LINKER:--default-script=${GENERIC_H7A3VITX_VARIANT_PATH}/ldscript.ld" + "LINKER:--defsym=LD_FLASH_OFFSET=0x0" + "LINKER:--defsym=LD_MAX_SIZE=2097152" + "LINKER:--defsym=LD_MAX_DATA_SIZE=1048576" + "SHELL:-mfpu=fpv4-sp-d16 -mfloat-abi=hard" + -mcpu=${GENERIC_H7A3VITX_MCU} +) + +add_library(GENERIC_H7A3VITX_serial_disabled INTERFACE) +target_compile_options(GENERIC_H7A3VITX_serial_disabled INTERFACE + "SHELL:" +) +add_library(GENERIC_H7A3VITX_serial_generic INTERFACE) +target_compile_options(GENERIC_H7A3VITX_serial_generic INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED" +) +add_library(GENERIC_H7A3VITX_serial_none INTERFACE) +target_compile_options(GENERIC_H7A3VITX_serial_none INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE" +) +add_library(GENERIC_H7A3VITX_usb_CDC INTERFACE) +target_compile_options(GENERIC_H7A3VITX_usb_CDC INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC -DDISABLE_GENERIC_SERIALUSB" +) +add_library(GENERIC_H7A3VITX_usb_CDCgen INTERFACE) +target_compile_options(GENERIC_H7A3VITX_usb_CDCgen INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC" +) +add_library(GENERIC_H7A3VITX_usb_HID INTERFACE) +target_compile_options(GENERIC_H7A3VITX_usb_HID INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_HID_COMPOSITE" +) +add_library(GENERIC_H7A3VITX_usb_none INTERFACE) +target_compile_options(GENERIC_H7A3VITX_usb_none INTERFACE + "SHELL:" +) +add_library(GENERIC_H7A3VITX_xusb_FS INTERFACE) +target_compile_options(GENERIC_H7A3VITX_xusb_FS INTERFACE + "SHELL:" +) +add_library(GENERIC_H7A3VITX_xusb_HS INTERFACE) +target_compile_options(GENERIC_H7A3VITX_xusb_HS INTERFACE + "SHELL:-DUSE_USB_HS" +) +add_library(GENERIC_H7A3VITX_xusb_HSFS INTERFACE) +target_compile_options(GENERIC_H7A3VITX_xusb_HSFS INTERFACE + "SHELL:-DUSE_USB_HS -DUSE_USB_HS_IN_FS" +) + +# GENERIC_H7B0VBTX +# ----------------------------------------------------------------------------- + +set(GENERIC_H7B0VBTX_VARIANT_PATH "${CMAKE_CURRENT_LIST_DIR}/../variants/STM32H7xx/H7A3V(G-I)(H-T)_H7B0VBT_H7B3VI(H-T)") +set(GENERIC_H7B0VBTX_MAXSIZE 131072) +set(GENERIC_H7B0VBTX_MAXDATASIZE 1048576) +set(GENERIC_H7B0VBTX_MCU cortex-m7) +set(GENERIC_H7B0VBTX_FPCONF "-") +add_library(GENERIC_H7B0VBTX INTERFACE) +target_compile_options(GENERIC_H7B0VBTX INTERFACE + "SHELL:-DCORE_CM7 -DSTM32H7B0xx " + "SHELL:" + "SHELL:" + "SHELL:-mfpu=fpv4-sp-d16 -mfloat-abi=hard" + -mcpu=${GENERIC_H7B0VBTX_MCU} +) +target_compile_definitions(GENERIC_H7B0VBTX INTERFACE + "STM32H7xx" + "ARDUINO_GENERIC_H7B0VBTX" + "BOARD_NAME=\"GENERIC_H7B0VBTX\"" + "BOARD_ID=GENERIC_H7B0VBTX" + "VARIANT_H=\"variant_generic.h\"" +) +target_include_directories(GENERIC_H7B0VBTX INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/../system/STM32H7xx + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32H7xx_HAL_Driver/Inc + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32H7xx_HAL_Driver/Src + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32H7xx/Include/ + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32H7xx/Source/Templates/gcc/ + ${GENERIC_H7B0VBTX_VARIANT_PATH} +) + +target_link_options(GENERIC_H7B0VBTX INTERFACE + "LINKER:--default-script=${GENERIC_H7B0VBTX_VARIANT_PATH}/ldscript.ld" + "LINKER:--defsym=LD_FLASH_OFFSET=0x0" + "LINKER:--defsym=LD_MAX_SIZE=131072" + "LINKER:--defsym=LD_MAX_DATA_SIZE=1048576" + "SHELL:-mfpu=fpv4-sp-d16 -mfloat-abi=hard" + -mcpu=${GENERIC_H7B0VBTX_MCU} +) + +add_library(GENERIC_H7B0VBTX_serial_disabled INTERFACE) +target_compile_options(GENERIC_H7B0VBTX_serial_disabled INTERFACE + "SHELL:" +) +add_library(GENERIC_H7B0VBTX_serial_generic INTERFACE) +target_compile_options(GENERIC_H7B0VBTX_serial_generic INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED" +) +add_library(GENERIC_H7B0VBTX_serial_none INTERFACE) +target_compile_options(GENERIC_H7B0VBTX_serial_none INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE" +) +add_library(GENERIC_H7B0VBTX_usb_CDC INTERFACE) +target_compile_options(GENERIC_H7B0VBTX_usb_CDC INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC -DDISABLE_GENERIC_SERIALUSB" +) +add_library(GENERIC_H7B0VBTX_usb_CDCgen INTERFACE) +target_compile_options(GENERIC_H7B0VBTX_usb_CDCgen INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC" +) +add_library(GENERIC_H7B0VBTX_usb_HID INTERFACE) +target_compile_options(GENERIC_H7B0VBTX_usb_HID INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_HID_COMPOSITE" +) +add_library(GENERIC_H7B0VBTX_usb_none INTERFACE) +target_compile_options(GENERIC_H7B0VBTX_usb_none INTERFACE + "SHELL:" +) +add_library(GENERIC_H7B0VBTX_xusb_FS INTERFACE) +target_compile_options(GENERIC_H7B0VBTX_xusb_FS INTERFACE + "SHELL:" +) +add_library(GENERIC_H7B0VBTX_xusb_HS INTERFACE) +target_compile_options(GENERIC_H7B0VBTX_xusb_HS INTERFACE + "SHELL:-DUSE_USB_HS" +) +add_library(GENERIC_H7B0VBTX_xusb_HSFS INTERFACE) +target_compile_options(GENERIC_H7B0VBTX_xusb_HSFS INTERFACE + "SHELL:-DUSE_USB_HS -DUSE_USB_HS_IN_FS" +) + +# GENERIC_H7B3VIHX +# ----------------------------------------------------------------------------- + +set(GENERIC_H7B3VIHX_VARIANT_PATH "${CMAKE_CURRENT_LIST_DIR}/../variants/STM32H7xx/H7A3V(G-I)(H-T)_H7B0VBT_H7B3VI(H-T)") +set(GENERIC_H7B3VIHX_MAXSIZE 2097152) +set(GENERIC_H7B3VIHX_MAXDATASIZE 1048576) +set(GENERIC_H7B3VIHX_MCU cortex-m7) +set(GENERIC_H7B3VIHX_FPCONF "-") +add_library(GENERIC_H7B3VIHX INTERFACE) +target_compile_options(GENERIC_H7B3VIHX INTERFACE + "SHELL:-DCORE_CM7 -DSTM32H7B3xx " + "SHELL:" + "SHELL:" + "SHELL:-mfpu=fpv4-sp-d16 -mfloat-abi=hard" + -mcpu=${GENERIC_H7B3VIHX_MCU} +) +target_compile_definitions(GENERIC_H7B3VIHX INTERFACE + "STM32H7xx" + "ARDUINO_GENERIC_H7B3VIHX" + "BOARD_NAME=\"GENERIC_H7B3VIHX\"" + "BOARD_ID=GENERIC_H7B3VIHX" + "VARIANT_H=\"variant_generic.h\"" +) +target_include_directories(GENERIC_H7B3VIHX INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/../system/STM32H7xx + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32H7xx_HAL_Driver/Inc + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32H7xx_HAL_Driver/Src + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32H7xx/Include/ + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32H7xx/Source/Templates/gcc/ + ${GENERIC_H7B3VIHX_VARIANT_PATH} +) + +target_link_options(GENERIC_H7B3VIHX INTERFACE + "LINKER:--default-script=${GENERIC_H7B3VIHX_VARIANT_PATH}/ldscript.ld" + "LINKER:--defsym=LD_FLASH_OFFSET=0x0" + "LINKER:--defsym=LD_MAX_SIZE=2097152" + "LINKER:--defsym=LD_MAX_DATA_SIZE=1048576" + "SHELL:-mfpu=fpv4-sp-d16 -mfloat-abi=hard" + -mcpu=${GENERIC_H7B3VIHX_MCU} +) + +add_library(GENERIC_H7B3VIHX_serial_disabled INTERFACE) +target_compile_options(GENERIC_H7B3VIHX_serial_disabled INTERFACE + "SHELL:" +) +add_library(GENERIC_H7B3VIHX_serial_generic INTERFACE) +target_compile_options(GENERIC_H7B3VIHX_serial_generic INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED" +) +add_library(GENERIC_H7B3VIHX_serial_none INTERFACE) +target_compile_options(GENERIC_H7B3VIHX_serial_none INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE" +) +add_library(GENERIC_H7B3VIHX_usb_CDC INTERFACE) +target_compile_options(GENERIC_H7B3VIHX_usb_CDC INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC -DDISABLE_GENERIC_SERIALUSB" +) +add_library(GENERIC_H7B3VIHX_usb_CDCgen INTERFACE) +target_compile_options(GENERIC_H7B3VIHX_usb_CDCgen INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC" +) +add_library(GENERIC_H7B3VIHX_usb_HID INTERFACE) +target_compile_options(GENERIC_H7B3VIHX_usb_HID INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_HID_COMPOSITE" +) +add_library(GENERIC_H7B3VIHX_usb_none INTERFACE) +target_compile_options(GENERIC_H7B3VIHX_usb_none INTERFACE + "SHELL:" +) +add_library(GENERIC_H7B3VIHX_xusb_FS INTERFACE) +target_compile_options(GENERIC_H7B3VIHX_xusb_FS INTERFACE + "SHELL:" +) +add_library(GENERIC_H7B3VIHX_xusb_HS INTERFACE) +target_compile_options(GENERIC_H7B3VIHX_xusb_HS INTERFACE + "SHELL:-DUSE_USB_HS" +) +add_library(GENERIC_H7B3VIHX_xusb_HSFS INTERFACE) +target_compile_options(GENERIC_H7B3VIHX_xusb_HSFS INTERFACE + "SHELL:-DUSE_USB_HS -DUSE_USB_HS_IN_FS" +) + +# GENERIC_H7B3VITX +# ----------------------------------------------------------------------------- + +set(GENERIC_H7B3VITX_VARIANT_PATH "${CMAKE_CURRENT_LIST_DIR}/../variants/STM32H7xx/H7A3V(G-I)(H-T)_H7B0VBT_H7B3VI(H-T)") +set(GENERIC_H7B3VITX_MAXSIZE 2097152) +set(GENERIC_H7B3VITX_MAXDATASIZE 1048576) +set(GENERIC_H7B3VITX_MCU cortex-m7) +set(GENERIC_H7B3VITX_FPCONF "-") +add_library(GENERIC_H7B3VITX INTERFACE) +target_compile_options(GENERIC_H7B3VITX INTERFACE + "SHELL:-DCORE_CM7 -DSTM32H7B3xx " + "SHELL:" + "SHELL:" + "SHELL:-mfpu=fpv4-sp-d16 -mfloat-abi=hard" + -mcpu=${GENERIC_H7B3VITX_MCU} +) +target_compile_definitions(GENERIC_H7B3VITX INTERFACE + "STM32H7xx" + "ARDUINO_GENERIC_H7B3VITX" + "BOARD_NAME=\"GENERIC_H7B3VITX\"" + "BOARD_ID=GENERIC_H7B3VITX" + "VARIANT_H=\"variant_generic.h\"" +) +target_include_directories(GENERIC_H7B3VITX INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/../system/STM32H7xx + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32H7xx_HAL_Driver/Inc + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/STM32H7xx_HAL_Driver/Src + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32H7xx/Include/ + ${CMAKE_CURRENT_LIST_DIR}/../system/Drivers/CMSIS/Device/ST/STM32H7xx/Source/Templates/gcc/ + ${GENERIC_H7B3VITX_VARIANT_PATH} +) + +target_link_options(GENERIC_H7B3VITX INTERFACE + "LINKER:--default-script=${GENERIC_H7B3VITX_VARIANT_PATH}/ldscript.ld" + "LINKER:--defsym=LD_FLASH_OFFSET=0x0" + "LINKER:--defsym=LD_MAX_SIZE=2097152" + "LINKER:--defsym=LD_MAX_DATA_SIZE=1048576" + "SHELL:-mfpu=fpv4-sp-d16 -mfloat-abi=hard" + -mcpu=${GENERIC_H7B3VITX_MCU} +) + +add_library(GENERIC_H7B3VITX_serial_disabled INTERFACE) +target_compile_options(GENERIC_H7B3VITX_serial_disabled INTERFACE + "SHELL:" +) +add_library(GENERIC_H7B3VITX_serial_generic INTERFACE) +target_compile_options(GENERIC_H7B3VITX_serial_generic INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED" +) +add_library(GENERIC_H7B3VITX_serial_none INTERFACE) +target_compile_options(GENERIC_H7B3VITX_serial_none INTERFACE + "SHELL:-DHAL_UART_MODULE_ENABLED -DHWSERIAL_NONE" +) +add_library(GENERIC_H7B3VITX_usb_CDC INTERFACE) +target_compile_options(GENERIC_H7B3VITX_usb_CDC INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC -DDISABLE_GENERIC_SERIALUSB" +) +add_library(GENERIC_H7B3VITX_usb_CDCgen INTERFACE) +target_compile_options(GENERIC_H7B3VITX_usb_CDCgen INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC" +) +add_library(GENERIC_H7B3VITX_usb_HID INTERFACE) +target_compile_options(GENERIC_H7B3VITX_usb_HID INTERFACE + "SHELL:-DUSBCON -DUSBD_VID=0 -DUSBD_PID=-1 -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_HID_COMPOSITE" +) +add_library(GENERIC_H7B3VITX_usb_none INTERFACE) +target_compile_options(GENERIC_H7B3VITX_usb_none INTERFACE + "SHELL:" +) +add_library(GENERIC_H7B3VITX_xusb_FS INTERFACE) +target_compile_options(GENERIC_H7B3VITX_xusb_FS INTERFACE + "SHELL:" +) +add_library(GENERIC_H7B3VITX_xusb_HS INTERFACE) +target_compile_options(GENERIC_H7B3VITX_xusb_HS INTERFACE + "SHELL:-DUSE_USB_HS" +) +add_library(GENERIC_H7B3VITX_xusb_HSFS INTERFACE) +target_compile_options(GENERIC_H7B3VITX_xusb_HSFS INTERFACE + "SHELL:-DUSE_USB_HS -DUSE_USB_HS_IN_FS" +) + # GENERIC_L010C6TX # ----------------------------------------------------------------------------- diff --git a/variants/STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I/CMakeLists.txt b/variants/STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I/CMakeLists.txt index 1bb69e4deb..decbf6998e 100644 --- a/variants/STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I/CMakeLists.txt +++ b/variants/STM32WLxx/WL54JCI_WL55JCI_WLE4J(8-B-C)I_WLE5J(8-B-C)I/CMakeLists.txt @@ -21,6 +21,7 @@ target_link_libraries(variant INTERFACE variant_usage) add_library(variant_bin STATIC EXCLUDE_FROM_ALL generic_clock.c PeripheralPins.c + PeripheralPins_ELV_BM_TRX1.c PeripheralPins_LORA_E5_MINI.c variant_ELV_BM_TRX1.cpp variant_generic.cpp From d5a983249099cf60193f552b2d25195f12422547 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Thu, 23 May 2024 16:32:20 +0200 Subject: [PATCH 2/5] fix(cmake): harden Path usage Signed-off-by: Frederic Pillon --- cmake/scripts/ccwrapper.py | 10 +++--- cmake/scripts/cmake_easy_setup.py | 55 +++++++++++++++-------------- cmake/scripts/cmake_gen.py | 16 +++++---- cmake/scripts/cmake_updater_hook.py | 4 +-- cmake/scripts/generate_header.py | 10 ++---- cmake/scripts/includes.py | 12 +++---- cmake/scripts/sizereport.py | 6 ++-- cmake/scripts/syms.py | 10 +++--- cmake/scripts/update_boarddb.py | 12 +++---- cmake/templates/easy_cmake.cmake | 3 +- 10 files changed, 65 insertions(+), 73 deletions(-) diff --git a/cmake/scripts/ccwrapper.py b/cmake/scripts/ccwrapper.py index c00abbc300..f0d2749426 100644 --- a/cmake/scripts/ccwrapper.py +++ b/cmake/scripts/ccwrapper.py @@ -2,17 +2,15 @@ import io import re -import pathlib +from pathlib import Path import subprocess import argparse parser = argparse.ArgumentParser() parser.add_argument( - "--source", "-i", type=pathlib.Path, required=True, help="input file being compiled" -) -parser.add_argument( - "--logdir", "-d", type=pathlib.Path, required=True, help="log directory" + "--source", "-i", type=Path, required=True, help="input file being compiled" ) +parser.add_argument("--logdir", "-d", type=Path, required=True, help="log directory") parser.add_argument( "cmd", action="extend", @@ -29,7 +27,7 @@ if proc.returncode != 0: exit(proc.returncode) -with open(shargs.logdir / (shargs.source.name + ".log"), "w") as file: +with open(shargs.logdir / f"{shargs.source.name}.log", "w") as file: print(" " + str(shargs.source), file=file) for line in io.StringIO(proc.stderr): if logline.match(line): diff --git a/cmake/scripts/cmake_easy_setup.py b/cmake/scripts/cmake_easy_setup.py index f944956c0c..a381c5d72c 100644 --- a/cmake/scripts/cmake_easy_setup.py +++ b/cmake/scripts/cmake_easy_setup.py @@ -5,7 +5,7 @@ import shutil import tempfile import os -import pathlib +from pathlib import Path import json from jinja2 import Environment, FileSystemLoader import difflib @@ -16,7 +16,7 @@ parser.add_argument( "--cli", "-x", - type=pathlib.Path, + type=Path, required=False, default=shutil.which("arduino-cli"), help="path to arduino-cli", @@ -30,12 +30,12 @@ ) output_args = parser.add_mutually_exclusive_group(required=True) output_args.add_argument( - "--output", "-o", type=pathlib.Path, help="output file (CMake) with placeholders" + "--output", "-o", type=Path, help="output file (CMake) with placeholders" ) output_args.add_argument( "--sketch", "-s", - type=pathlib.Path, + type=Path, help="output file (CMake) filled given a sketch folder", ) @@ -62,6 +62,13 @@ exit(-1) +# Path management +scriptname = Path(__file__).resolve() +corepath = scriptname.parent.parent.parent.resolve() +boards_txt = corepath / "boards.txt" +userhome = Path.home() + + def arduino(*args): # return (out.stdout, logfile) # raises an exception if the command fails @@ -76,16 +83,23 @@ def arduino(*args): return (out, logfile) +def userhome_process(path): + lpath = str(path) + if path.is_relative_to(userhome): + lpath = f"~/{str(path.relative_to(userhome))}" + return lpath + + def get_log(fname): with open(fname) as file: for line in file: yield json.loads(line) -def get_boards(boardstxt): +def get_boards(): - # we "reject" everything because we don't care about the values, only the keys - families = parse_file(boardstxt, lambda x: True) + # "reject" everything because we don't care about the values, only the keys + families = parse_file(boards_txt, lambda x: True) del families["menu"] boards = set() @@ -97,7 +111,7 @@ def get_boards(boardstxt): _, logf = arduino("lib", "list") -allboards = get_boards(pathlib.Path(__file__).parent.parent.parent / "boards.txt") +allboards = get_boards() if shargs.board and shargs.board not in allboards: @@ -119,11 +133,11 @@ def get_boards(boardstxt): libpaths = dict() for line in get_log(logf): if line["msg"] == "Adding libraries dir": - libpaths[line["location"]] = pathlib.Path(line["dir"]) + libpaths[line["location"]] = Path(line["dir"]) # platform lib path is already known, obviously, since that's where this script resides if "user" in libpaths.keys(): - userlibs = pathlib.Path(libpaths["user"]) + userlibs = Path(libpaths["user"]) if userlibs.exists(): userlibs = userlibs.resolve() libs = [u.name for u in userlibs.iterdir() if u.is_dir()] @@ -137,7 +151,7 @@ def get_boards(boardstxt): ) libs = list() else: - userlibs = pathlib.Path.home() / "Arduino/libraries" + userlibs = Path.home() / "Arduino/libraries" print( f"""No user library path found through arduino-cli (falling back to {userlibs}). This has likely to do with your arduino-cli configuration. @@ -147,8 +161,6 @@ def get_boards(boardstxt): ) libs = list() -corepath = pathlib.Path(__file__).parent.parent.parent.resolve() - j2_env = Environment( loader=FileSystemLoader(str(corepath / "cmake" / "templates")), trim_blocks=True, @@ -156,13 +168,6 @@ def get_boards(boardstxt): ) cmake_template = j2_env.get_template("easy_cmake.cmake") - -userhome = pathlib.Path.home() -if userlibs.is_relative_to(userhome): - userlibs = "~/" + str(userlibs.relative_to(userhome)) -if corepath.is_relative_to(userhome): - corepath = "~/" + str(corepath.relative_to(userhome)) - if shargs.sketch: SOURCEFILE_EXTS = (".c", ".cpp", ".S", ".ino") sources = { @@ -180,19 +185,15 @@ def get_boards(boardstxt): tgtname = "" sources = set() -scriptname = pathlib.Path(__file__) -if scriptname.is_relative_to(userhome): - scriptname = "~/" + str(scriptname.relative_to(userhome)) - with open(shargs.output or shargs.sketch / "CMakeLists.txt", "w") as out: out.write( cmake_template.render( - corepath=str(corepath).replace( + corepath=userhome_process(corepath).replace( "\\", "\\\\" ), # escape backslashes for CMake - userlibs=str(userlibs).replace("\\", "\\\\"), + userlibs=userhome_process(userlibs).replace("\\", "\\\\"), libs=libs, - scriptfile=scriptname, + scriptfile=userhome_process(scriptname), tgtname=tgtname, scrcfiles=sources, boardname=shargs.board, diff --git a/cmake/scripts/cmake_gen.py b/cmake/scripts/cmake_gen.py index ab8c8bd5ba..d4a3eb081f 100644 --- a/cmake/scripts/cmake_gen.py +++ b/cmake/scripts/cmake_gen.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +from pathlib import Path + SOURCEFILE_EXTS = ( ".c", ".cpp", @@ -20,7 +22,7 @@ def get_default_config(): ) -def parse_configfile(file): +def parse_configfile(file: Path): rawcfg = dict() for line in open(file): @@ -42,7 +44,7 @@ def parse_configfile(file): return cfg -def get_sources(dir, recursive=False, relative_to=None): +def get_sources(dir: Path, recursive: bool = False, relative_to: Path = None): if relative_to is None: relative_to = dir if recursive: @@ -57,12 +59,12 @@ def get_sources(dir, recursive=False, relative_to=None): } -def render(dir, template, config): +def render(dir: Path, template, config): with open(dir / "CMakeLists.txt", "w") as outfile: outfile.write(template.render(**config)) -def get_static_libs(dir): +def get_static_libs(dir: Path): result = dict() cpu = "" fpconf = "-" # format: f"{fpu}-{float_abi}"; this makes "-" by default @@ -80,7 +82,7 @@ def get_static_libs(dir): return result -def config_for_bareflat(dir, force_recurse=False): +def config_for_bareflat(dir: Path, force_recurse: bool = False): # no library.properties config = get_default_config() @@ -98,7 +100,7 @@ def config_for_bareflat(dir, force_recurse=False): return config -def config_for_modern(dir): +def config_for_modern(dir: Path): # library.properties present, src/ present config = get_default_config() config.update(parse_configfile(dir / "library.properties")) @@ -111,7 +113,7 @@ def config_for_modern(dir): return config -def autoconfig(libdir): +def autoconfig(libdir: Path): conf_file = libdir / "library.properties" srcdir = libdir / "src" if ( diff --git a/cmake/scripts/cmake_updater_hook.py b/cmake/scripts/cmake_updater_hook.py index f121e44112..8cfa36d6d1 100644 --- a/cmake/scripts/cmake_updater_hook.py +++ b/cmake/scripts/cmake_updater_hook.py @@ -8,7 +8,7 @@ import argparse import subprocess -import pathlib +from pathlib import Path import sys parser = argparse.ArgumentParser( @@ -16,7 +16,7 @@ ) shargs = parser.parse_args() -script_dir = pathlib.Path(__file__).parent # Arduino_Core_STM32/cmake/scripts +script_dir = Path(__file__).parent.resolve() # Arduino_Core_STM32/cmake/scripts base_dir = script_dir.parent.parent # Arduino_Core_STM32 templates_dir = base_dir / "cmake" / "templates" diff --git a/cmake/scripts/generate_header.py b/cmake/scripts/generate_header.py index 6dbc5b5093..8c0bf45f06 100644 --- a/cmake/scripts/generate_header.py +++ b/cmake/scripts/generate_header.py @@ -1,15 +1,11 @@ #!/usr/bin/env python3 import argparse -import pathlib +from pathlib import Path parser = argparse.ArgumentParser() -parser.add_argument( - "--source", "-i", type=pathlib.Path, required=True, help="ctags's output" -) -parser.add_argument( - "--out", "-o", type=pathlib.Path, required=True, help="header to generate" -) +parser.add_argument("--source", "-i", type=Path, required=True, help="ctags's output") +parser.add_argument("--out", "-o", type=Path, required=True, help="header to generate") shargs = parser.parse_args() diff --git a/cmake/scripts/includes.py b/cmake/scripts/includes.py index 9873bdf353..688d6124c2 100644 --- a/cmake/scripts/includes.py +++ b/cmake/scripts/includes.py @@ -1,18 +1,16 @@ #!/usr/bin/env python3 -import pathlib +from pathlib import Path import argparse import graphviz parser = argparse.ArgumentParser() -parser.add_argument("-o", type=pathlib.Path, help="file to write the full graph to") -parser.add_argument( - "-t", type=pathlib.Path, help="file to write the transitive graph to" -) +parser.add_argument("-o", type=Path, help="file to write the full graph to") +parser.add_argument("-t", type=Path, help="file to write the transitive graph to") parser.add_argument( "logs", - type=pathlib.Path, + type=Path, nargs="*", action="extend", help="list of log files to parse", @@ -39,7 +37,7 @@ def parse_output(log): for line in log: d, h = line.rstrip().split(" ", 1) d = d.count(".") - h = pathlib.Path(h) + h = Path(h) if d == 0: rootcause = h diff --git a/cmake/scripts/sizereport.py b/cmake/scripts/sizereport.py index 6048eeb67b..3bce368815 100644 --- a/cmake/scripts/sizereport.py +++ b/cmake/scripts/sizereport.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -import pathlib +from pathlib import Path import re import subprocess import argparse @@ -9,14 +9,14 @@ parser.add_argument( "-x", "--tool", - type=pathlib.Path, + type=Path, required=True, help="path to `arm-none-eabi-size`", ) parser.add_argument( "-f", "--binfile", - type=pathlib.Path, + type=Path, required=True, help="path to the binary to analyze", ) diff --git a/cmake/scripts/syms.py b/cmake/scripts/syms.py index 56fb366acd..1cb873fddf 100644 --- a/cmake/scripts/syms.py +++ b/cmake/scripts/syms.py @@ -1,19 +1,17 @@ #!/usr/bin/env python3 -import pathlib +from pathlib import Path import argparse import graphviz parser = argparse.ArgumentParser() parser.add_argument( - "-m", "--mapfile", type=pathlib.Path, required=True, help="path to ld's map file" + "-m", "--mapfile", type=Path, required=True, help="path to ld's map file" ) +parser.add_argument("-f", "--fullgv", type=Path, help="file to write the full graph to") parser.add_argument( - "-f", "--fullgv", type=pathlib.Path, help="file to write the full graph to" -) -parser.add_argument( - "-s", "--summarygv", type=pathlib.Path, help="file to write the summarized graph to" + "-s", "--summarygv", type=Path, help="file to write the summarized graph to" ) shargs = parser.parse_args() diff --git a/cmake/scripts/update_boarddb.py b/cmake/scripts/update_boarddb.py index d3a430750b..4246d1452a 100644 --- a/cmake/scripts/update_boarddb.py +++ b/cmake/scripts/update_boarddb.py @@ -1,10 +1,8 @@ #!/usr/bin/env python3 -import pathlib import argparse - +from pathlib import Path from jinja2 import Environment, FileSystemLoader - from parse_boards import parse_file @@ -76,26 +74,26 @@ def regenerate_template(config, infile, outfile): if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument( - "-b", "--boards", type=pathlib.Path, required=True, help="path to boards.txt" + "-b", "--boards", type=Path, required=True, help="path to boards.txt" ) parser.add_argument( "-p", "--platform", - type=pathlib.Path, + type=Path, required=True, help="path to platform.txt", ) parser.add_argument( "-t", "--template", - type=pathlib.Path, + type=Path, required=True, help="path to the jinja template", ) parser.add_argument( "-o", "--outfile", - type=pathlib.Path, + type=Path, required=True, help="path to the cmake database to generate", ) diff --git a/cmake/templates/easy_cmake.cmake b/cmake/templates/easy_cmake.cmake index e38863661e..a85ad86274 100644 --- a/cmake/templates/easy_cmake.cmake +++ b/cmake/templates/easy_cmake.cmake @@ -1,4 +1,5 @@ -# This file was autogenerated by {{scriptfile}}. +# This file was autogenerated by: +# {{scriptfile}} # Use it in your CMake configuration by `include()`'ing it. # You can also copy it in your sketch's folder and edit it to fit your project. From 76ed62cf769e6eaedb5dad4900c2580c8c8306b6 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Wed, 12 Jun 2024 18:20:24 +0200 Subject: [PATCH 3/5] chore(cmake): comment external library by default Signed-off-by: Frederic Pillon --- cmake/templates/easy_cmake.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/templates/easy_cmake.cmake b/cmake/templates/easy_cmake.cmake index a85ad86274..2729feb11e 100644 --- a/cmake/templates/easy_cmake.cmake +++ b/cmake/templates/easy_cmake.cmake @@ -66,7 +66,7 @@ include(external_library) # Please write them in using the DEPENDS ... clause # The same directives apply as for `build_sketch()` just below. {% for libdir in libs | sort %} -external_library(PATH "{{"${USER_LIBS}"}}/{{libdir}}") +# external_library(PATH "{{"${USER_LIBS}"}}/{{libdir}}") {% endfor %} include(build_sketch) From cca16584473a4e702a7c4fae88faed66ad18f17f Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Wed, 12 Jun 2024 18:21:05 +0200 Subject: [PATCH 4/5] chore(cmake): reword some comments Signed-off-by: Frederic Pillon --- cmake/templates/easy_cmake.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/templates/easy_cmake.cmake b/cmake/templates/easy_cmake.cmake index 2729feb11e..2d979dd920 100644 --- a/cmake/templates/easy_cmake.cmake +++ b/cmake/templates/easy_cmake.cmake @@ -20,9 +20,9 @@ list(APPEND CMAKE_MODULE_PATH {{"${CORE_PATH}"}}/cmake) set(CMAKE_TOOLCHAIN_FILE toolchain) -# You may remove this block when using this file as the sketch's CMakeLists.txt +# This block can be removed when using this file as the sketch's CMakeLists.txt if (NOT ${CMAKE_PARENT_LIST_FILE} STREQUAL ${CMAKE_CURRENT_LIST_FILE}) - # When we are imported from the main CMakeLists.txt, we should stop here + # When imported from the main CMakeLists.txt, it should stop here # not to interfere with the true build config. return() endif() @@ -62,7 +62,7 @@ overall_settings( # STEP 3: configure your sketch # ----------------------------------------------------------------------------- include(external_library) -# I cannot tell the dependencies of the library ahead-of-time +# Cannot tell the dependencies of the library ahead-of-time # Please write them in using the DEPENDS ... clause # The same directives apply as for `build_sketch()` just below. {% for libdir in libs | sort %} From eee321f131aebfcd96be4029575bb5cb5448aa61 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Wed, 12 Jun 2024 18:21:56 +0200 Subject: [PATCH 5/5] fix(cmake): support extern "C" when generate header Signed-off-by: Frederic Pillon --- cmake/scripts/generate_header.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmake/scripts/generate_header.py b/cmake/scripts/generate_header.py index 8c0bf45f06..c4cc0c2b61 100644 --- a/cmake/scripts/generate_header.py +++ b/cmake/scripts/generate_header.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import argparse +import re from pathlib import Path parser = argparse.ArgumentParser() @@ -8,8 +9,7 @@ parser.add_argument("--out", "-o", type=Path, required=True, help="header to generate") shargs = parser.parse_args() - - +externC_regex = re.compile(r'extern\s+"C"') with open(shargs.source, "r") as infile: with open(shargs.out, "w") as outfile: for line in infile: @@ -20,7 +20,11 @@ fields = line.split("\t") kind = fields[3].split(":", 1)[1] if kind == "function": + decl = "" + externC = externC_regex.search(fields[2]) + if externC: + decl = 'extern "C" ' symname = fields[0] signature = fields[5].split(":", 1)[1] rtype = fields[6].split(":", 1)[1] - print(f"{rtype} {symname}{signature};", file=outfile) + print(f"{decl}{rtype} {symname}{signature};", file=outfile)