From e0aa49ffcf55df1009ab4e3fec3ed565d120d89c Mon Sep 17 00:00:00 2001 From: Hugues Kamba Date: Wed, 28 Oct 2020 11:37:24 +0000 Subject: [PATCH] CMake: Add support for NUCLEO_F303K8 Added the board so it can be used for testing the bare-metal profile on a Mbed 2 board --- targets/TARGET_STM/CMakeLists.txt | 6 +- .../TARGET_STM/TARGET_STM32F3/CMakeLists.txt | 24 ++++++ .../TARGET_STM32F303x8/CMakeLists.txt | 13 ++++ .../TARGET_NUCLEO_F303K8/CMakeLists.txt | 13 ++++ .../TARGET_STM32F303x8/device/CMakeLists.txt | 32 ++++++++ .../TARGET_STM32F3/device/CMakeLists.txt | 78 +++++++++++++++++++ .../TARGET_STM/TARGET_STM32F4/CMakeLists.txt | 2 - tools/cmake/README.md | 1 + 8 files changed, 165 insertions(+), 4 deletions(-) create mode 100644 targets/TARGET_STM/TARGET_STM32F3/CMakeLists.txt create mode 100644 targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303x8/CMakeLists.txt create mode 100644 targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303x8/TARGET_NUCLEO_F303K8/CMakeLists.txt create mode 100644 targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303x8/device/CMakeLists.txt create mode 100644 targets/TARGET_STM/TARGET_STM32F3/device/CMakeLists.txt diff --git a/targets/TARGET_STM/CMakeLists.txt b/targets/TARGET_STM/CMakeLists.txt index b65ebcd0b5..24b67046d4 100644 --- a/targets/TARGET_STM/CMakeLists.txt +++ b/targets/TARGET_STM/CMakeLists.txt @@ -1,10 +1,12 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if("STM32F4" IN_LIST MBED_TARGET_LABELS) +if("STM32F3" IN_LIST MBED_TARGET_LABELS) + add_subdirectory(TARGET_STM32F3) +elseif("STM32F4" IN_LIST MBED_TARGET_LABELS) add_subdirectory(TARGET_STM32F4) elseif("STM32L4" IN_LIST MBED_TARGET_LABELS) - add_subdirectory(TARGET_STM32L4) + add_subdirectory(TARGET_STM32L4) endif() target_include_directories(mbed-core diff --git a/targets/TARGET_STM/TARGET_STM32F3/CMakeLists.txt b/targets/TARGET_STM/TARGET_STM32F3/CMakeLists.txt new file mode 100644 index 0000000000..0b9545d4f5 --- /dev/null +++ b/targets/TARGET_STM/TARGET_STM32F3/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +if("STM32F303x8" IN_LIST MBED_TARGET_LABELS) + add_subdirectory(TARGET_STM32F303x8) +endif() + +add_subdirectory(device) + +target_include_directories(mbed-core + INTERFACE + . +) + +target_sources(mbed-core + INTERFACE + analogin_device.c + analogout_device.c + flash_api.c + gpio_irq_device.c + pwmout_device.c + serial_device.c + spi_api.c +) diff --git a/targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303x8/CMakeLists.txt b/targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303x8/CMakeLists.txt new file mode 100644 index 0000000000..0cdeb5f0e3 --- /dev/null +++ b/targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303x8/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +if("NUCLEO_F303K8" IN_LIST MBED_TARGET_LABELS) + add_subdirectory(TARGET_NUCLEO_F303K8) +endif() + +add_subdirectory(device) + +target_include_directories(mbed-core + INTERFACE + . +) diff --git a/targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303x8/TARGET_NUCLEO_F303K8/CMakeLists.txt b/targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303x8/TARGET_NUCLEO_F303K8/CMakeLists.txt new file mode 100644 index 0000000000..c4d3e2a096 --- /dev/null +++ b/targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303x8/TARGET_NUCLEO_F303K8/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +target_include_directories(mbed-core + INTERFACE + . +) + +target_sources(mbed-core + INTERFACE + PeripheralPins.c + system_clock.c +) diff --git a/targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303x8/device/CMakeLists.txt b/targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303x8/device/CMakeLists.txt new file mode 100644 index 0000000000..0a9ae7546d --- /dev/null +++ b/targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303x8/device/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +function(_mbed_get_assembly_stm32f303x8) + if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") + set(STARTUP_FILE TOOLCHAIN_GCC_ARM/startup_stm32f303x8.S) + elseif(${MBED_TOOLCHAIN} STREQUAL "ARM") + set(STARTUP_FILE TOOLCHAIN_ARM/startup_stm32f303x8.S) + elseif(${MBED_TOOLCHAIN} STREQUAL "IAR") + set(STARTUP_FILE TOOLCHAIN_IAR/startup_stm32f303x8.S) + endif() + target_sources(mbed-core INTERFACE ${STARTUP_FILE}) +endfunction() + +function(_mbed_set_linker_file) + if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") + set(LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/TOOLCHAIN_GCC_ARM/STM32F303X8.ld) + elseif(${MBED_TOOLCHAIN} STREQUAL "ARM") + set(LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/TOOLCHAIN_ARM/stm32f303x8.sct) + elseif(${MBED_TOOLCHAIN} STREQUAL "IAR") + set(LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/TOOLCHAIN_IAR/stm32f303x8.icf) + endif() + set_property(GLOBAL PROPERTY MBED_TARGET_LINKER_FILE ${LINKER_FILE}) +endfunction() + +_mbed_get_assembly_stm32f303x8() +_mbed_set_linker_file() + +target_include_directories(mbed-core + INTERFACE + . +) diff --git a/targets/TARGET_STM/TARGET_STM32F3/device/CMakeLists.txt b/targets/TARGET_STM/TARGET_STM32F3/device/CMakeLists.txt new file mode 100644 index 0000000000..1e2dc34e8c --- /dev/null +++ b/targets/TARGET_STM/TARGET_STM32F3/device/CMakeLists.txt @@ -0,0 +1,78 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +target_include_directories(mbed-core + INTERFACE + . +) + +target_sources(mbed-core + INTERFACE + stm32f3xx_hal.c + stm32f3xx_hal_adc.c + stm32f3xx_hal_adc_ex.c + stm32f3xx_hal_can.c + stm32f3xx_hal_cec.c + stm32f3xx_hal_comp.c + stm32f3xx_hal_cortex.c + stm32f3xx_hal_crc.c + stm32f3xx_hal_crc_ex.c + stm32f3xx_hal_dac.c + stm32f3xx_hal_dac_ex.c + stm32f3xx_hal_dma.c + stm32f3xx_hal_flash.c + stm32f3xx_hal_flash_ex.c + stm32f3xx_hal_gpio.c + stm32f3xx_hal_hrtim.c + stm32f3xx_hal_i2c.c + stm32f3xx_hal_i2c_ex.c + stm32f3xx_hal_i2s_ex.c + stm32f3xx_hal_irda.c + stm32f3xx_hal_iwdg.c + stm32f3xx_hal_nand.c + stm32f3xx_hal_nor.c + stm32f3xx_hal_opamp.c + stm32f3xx_hal_opamp_ex.c + stm32f3xx_hal_pccard.c + stm32f3xx_hal_pcd.c + stm32f3xx_hal_pcd_ex.c + stm32f3xx_hal_pwr.c + stm32f3xx_hal_pwr_ex.c + stm32f3xx_hal_rcc.c + stm32f3xx_hal_rcc_ex.c + stm32f3xx_hal_rtc.c + stm32f3xx_hal_rtc_ex.c + stm32f3xx_hal_sdadc.c + stm32f3xx_hal_smartcard.c + stm32f3xx_hal_smartcard_ex.c + stm32f3xx_hal_smbus.c + stm32f3xx_hal_spi.c + stm32f3xx_hal_spi_ex.c + stm32f3xx_hal_sram.c + stm32f3xx_hal_tim.c + stm32f3xx_hal_tim_ex.c + stm32f3xx_hal_tsc.c + stm32f3xx_hal_uart.c + stm32f3xx_hal_uart_ex.c + stm32f3xx_hal_usart.c + stm32f3xx_hal_wwdg.c + stm32f3xx_ll_adc.c + stm32f3xx_ll_comp.c + stm32f3xx_ll_crc.c + stm32f3xx_ll_dac.c + stm32f3xx_ll_dma.c + stm32f3xx_ll_exti.c + stm32f3xx_ll_fmc.c + stm32f3xx_ll_gpio.c + stm32f3xx_ll_hrtim.c + stm32f3xx_ll_i2c.c + stm32f3xx_ll_opamp.c + stm32f3xx_ll_pwr.c + stm32f3xx_ll_rcc.c + stm32f3xx_ll_rtc.c + stm32f3xx_ll_spi.c + stm32f3xx_ll_tim.c + stm32f3xx_ll_usart.c + stm32f3xx_ll_utils.c + system_stm32f3xx.c +) diff --git a/targets/TARGET_STM/TARGET_STM32F4/CMakeLists.txt b/targets/TARGET_STM/TARGET_STM32F4/CMakeLists.txt index 43a7be9142..25f7b886f7 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/CMakeLists.txt +++ b/targets/TARGET_STM/TARGET_STM32F4/CMakeLists.txt @@ -16,8 +16,6 @@ target_sources(mbed-core pwmout_device.c serial_device.c spi_api.c - - ) add_subdirectory(STM32Cube_FW) diff --git a/tools/cmake/README.md b/tools/cmake/README.md index 893319d66c..44055f0248 100644 --- a/tools/cmake/README.md +++ b/tools/cmake/README.md @@ -23,6 +23,7 @@ The following targets are supported: - K64F - K66F - NRF52840_DK +- NUCLEO_F303K8 - NUCLEO_F401RE - WIO_3G