Skip to content

Commit b53801a

Browse files
committed
add cmake RTOS=zephyr (default noos) for zephyr build
1 parent 201b970 commit b53801a

File tree

61 files changed

+96
-112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+96
-112
lines changed
Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1-
if (NOT DEFINED CMAKE_C_COMPILER)
2-
set(CMAKE_C_COMPILER "arm-none-eabi-gcc")
3-
endif ()
1+
if (RTOS STREQUAL zephyr)
42

5-
if (NOT DEFINED CMAKE_CXX_COMPILER)
6-
set(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
7-
endif ()
3+
else ()
4+
if (NOT DEFINED CMAKE_C_COMPILER)
5+
set(CMAKE_C_COMPILER "arm-none-eabi-gcc")
6+
endif ()
7+
8+
if (NOT DEFINED CMAKE_CXX_COMPILER)
9+
set(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
10+
endif ()
811

9-
set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
10-
find_program(CMAKE_SIZE arm-none-eabi-size)
11-
find_program(CMAKE_OBJCOPY arm-none-eabi-objcopy)
12-
find_program(CMAKE_OBJDUMP arm-none-eabi-objdump)
12+
set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
13+
find_program(CMAKE_SIZE arm-none-eabi-size)
14+
find_program(CMAKE_OBJCOPY arm-none-eabi-objcopy)
15+
find_program(CMAKE_OBJDUMP arm-none-eabi-objdump)
1316

14-
include(${CMAKE_CURRENT_LIST_DIR}/common.cmake)
17+
include(${CMAKE_CURRENT_LIST_DIR}/common.cmake)
1518

16-
get_property(IS_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE)
17-
if (IS_IN_TRY_COMPILE)
18-
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -nostdlib")
19-
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -nostdlib")
20-
cmake_print_variables(CMAKE_C_LINK_FLAGS)
19+
get_property(IS_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE)
20+
if (IS_IN_TRY_COMPILE)
21+
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -nostdlib")
22+
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -nostdlib")
23+
cmake_print_variables(CMAKE_C_LINK_FLAGS)
24+
endif ()
2125
endif ()

examples/build_system/cmake/toolchain/common.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
if (BUILD_ZEPHYR)
2-
return()
3-
endif()
4-
51
include(CMakePrintHelpers)
62

73
# ----------------------------------------------------------------------------

examples/device/board_test/CMakeLists.txt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
55
# gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>)
66
family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR})
77

8-
if (BUILD_ZEPHYR)
9-
set(BOARD_ROOT ${TOP}/hw/bsp/${FAMILY})
10-
find_package(Zephyr REQUIRED HINTS ${TOP}/lib/zephyr)
11-
endif ()
12-
138
project(${PROJECT} C CXX ASM)
149

1510
# Checks this example is valid for the family and initializes the project
@@ -20,7 +15,7 @@ if(FAMILY STREQUAL "espressif")
2015
return()
2116
endif()
2217

23-
if (BUILD_ZEPHYR)
18+
if (RTOS STREQUAL zephyr)
2419
set(EXE_NAME app)
2520
else()
2621
set(EXE_NAME ${PROJECT})
@@ -39,8 +34,4 @@ target_include_directories(${EXE_NAME} PUBLIC
3934

4035
# Configure compilation flags and libraries for the example without RTOS.
4136
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
42-
if (BUILD_ZEPHYR)
43-
family_configure_device_example(${EXE_NAME} zephyr)
44-
else()
45-
family_configure_device_example(${EXE_NAME} noos)
46-
endif()
37+
family_configure_device_example(${EXE_NAME} ${RTOS})

examples/device/cdc_msc/CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if(FAMILY STREQUAL "espressif")
1616
return()
1717
endif()
1818

19-
if (BUILD_ZEPHYR)
19+
if (RTOS STREQUAL zephyr)
2020
set(EXE_NAME app)
2121
else()
2222
set(EXE_NAME ${PROJECT})
@@ -37,8 +37,4 @@ target_include_directories(${EXE_NAME} PUBLIC
3737

3838
# Configure compilation flags and libraries for the example without RTOS.
3939
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
40-
if (BUILD_ZEPHYR)
41-
family_configure_device_example(${EXE_NAME} zephyr)
42-
else()
43-
family_configure_device_example(${EXE_NAME} noos)
44-
endif()
40+
family_configure_device_example(${EXE_NAME} ${RTOS})

examples/device/msc_dual_lun/CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if(FAMILY STREQUAL "espressif")
1515
return()
1616
endif()
1717

18-
if (BUILD_ZEPHYR)
18+
if (RTOS STREQUAL zephyr)
1919
set(EXE_NAME app)
2020
else()
2121
set(EXE_NAME ${PROJECT})
@@ -36,8 +36,4 @@ target_include_directories(${EXE_NAME} PUBLIC
3636

3737
# Configure compilation flags and libraries for the example without RTOS.
3838
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
39-
if (BUILD_ZEPHYR)
40-
family_configure_device_example(${EXE_NAME} zephyr)
41-
else()
42-
family_configure_device_example(${EXE_NAME} noos)
43-
endif()
39+
family_configure_device_example(${EXE_NAME} ${RTOS})

hw/bsp/broadcom_32bit/family.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function(family_configure_example TARGET RTOS)
9494
)
9595

9696
# Add TinyUSB target and port source
97-
family_add_tinyusb(${TARGET} OPT_MCU_BCM2835 ${RTOS})
97+
family_add_tinyusb(${TARGET} OPT_MCU_BCM2835)
9898
target_sources(${TARGET}-tinyusb PUBLIC
9999
${TOP}/src/portable/synopsys/dwc2/dcd_dwc2.c
100100
${TOP}/src/portable/synopsys/dwc2/hcd_dwc2.c

hw/bsp/broadcom_64bit/family.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function(family_configure_example TARGET RTOS)
101101
)
102102

103103
# Add TinyUSB target and port source
104-
family_add_tinyusb(${TARGET} OPT_MCU_BCM${BCM_VERSION} ${RTOS})
104+
family_add_tinyusb(${TARGET} OPT_MCU_BCM${BCM_VERSION})
105105
target_sources(${TARGET}-tinyusb PUBLIC
106106
${TOP}/src/portable/synopsys/dwc2/dcd_dwc2.c
107107
${TOP}/src/portable/synopsys/dwc2/hcd_dwc2.c

hw/bsp/ch32v10x/family.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function(family_configure_example TARGET RTOS)
9898
)
9999

100100
# Add TinyUSB target and port source
101-
family_add_tinyusb(${TARGET} OPT_MCU_CH32V103 ${RTOS})
101+
family_add_tinyusb(${TARGET} OPT_MCU_CH32V103)
102102

103103
target_sources(${TARGET}-tinyusb PUBLIC
104104
${TOP}/src/portable/wch/dcd_ch32_usbfs.c

hw/bsp/ch32v20x/family.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function(family_configure_example TARGET RTOS)
123123
)
124124

125125
# Add TinyUSB target and port source
126-
family_add_tinyusb(${TARGET} OPT_MCU_CH32V20X ${RTOS})
126+
family_add_tinyusb(${TARGET} OPT_MCU_CH32V20X)
127127

128128
target_sources(${TARGET}-tinyusb PUBLIC
129129
${TOP}/src/portable/wch/dcd_ch32_usbfs.c

hw/bsp/ch32v307/family.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function(family_configure_example TARGET RTOS)
113113
)
114114

115115
# Add TinyUSB target and port source
116-
family_add_tinyusb(${TARGET} OPT_MCU_CH32V307 ${RTOS})
116+
family_add_tinyusb(${TARGET} OPT_MCU_CH32V307)
117117
target_sources(${TARGET}-tinyusb PUBLIC
118118
${TOP}/src/portable/wch/dcd_ch32_usbhs.c
119119
${TOP}/src/portable/wch/dcd_ch32_usbfs.c

0 commit comments

Comments
 (0)