From 48ff3cdea9eb6261bb978c3de85d606ccb08d381 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 28 Aug 2017 10:23:03 -0400 Subject: [PATCH 01/11] cmake: c library part of libapp Signed-off-by: Anas Nashif --- lib/libc/minimal/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/minimal/CMakeLists.txt b/lib/libc/minimal/CMakeLists.txt index 40807d4b28ca..8ce16c6b84f9 100644 --- a/lib/libc/minimal/CMakeLists.txt +++ b/lib/libc/minimal/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(zephyr PRIVATE +target_sources(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/source/stdlib/atoi.c ${CMAKE_CURRENT_SOURCE_DIR}/source/stdlib/strtol.c ${CMAKE_CURRENT_SOURCE_DIR}/source/stdlib/strtoul.c @@ -10,7 +10,7 @@ target_sources(zephyr PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/source/stdout/sprintf.c ${CMAKE_CURRENT_SOURCE_DIR}/source/stdout/fprintf.c ) -target_include_directories(zephyr +target_include_directories(app PUBLIC include ) From 2ba3239f26d9ecc4e9d74135656863b83c6fd66f Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 28 Aug 2017 10:31:50 -0400 Subject: [PATCH 02/11] cmake: add zephyr_library_sources_if_kconfig Signed-off-by: Anas Nashif --- cmake/extensions.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/extensions.cmake b/cmake/extensions.cmake index 6428641b50df..875b73c5d6b3 100644 --- a/cmake/extensions.cmake +++ b/cmake/extensions.cmake @@ -68,6 +68,12 @@ function(zephyr_library_sources_ifdef feature_toggle source) endif() endfunction() +function(zephyr_library_sources_if_kconfig item) + get_filename_component(item_basename ${item} NAME_WE) + string(TOUPPER CONFIG_${item_basename} UPPER_CASE_CONFIG) + zephyr_library_sources_ifdef(${UPPER_CASE_CONFIG} ${item}) +endfunction() + function(zephyr_sources_if_kconfig item) get_filename_component(item_basename ${item} NAME_WE) string(TOUPPER CONFIG_${item_basename} UPPER_CASE_CONFIG) From 005990a4d7681649ee41a4a807d9ad821c90b579 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 28 Aug 2017 10:32:26 -0400 Subject: [PATCH 03/11] cmake: serial: use zephyr_library_sources macros Signed-off-by: Anas Nashif --- drivers/serial/CMakeLists.txt | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/serial/CMakeLists.txt b/drivers/serial/CMakeLists.txt index 72100dfb8b2e..cb1973d7f416 100644 --- a/drivers/serial/CMakeLists.txt +++ b/drivers/serial/CMakeLists.txt @@ -1,17 +1,18 @@ zephyr_library() -target_link_libraries(drivers__serial drivers) -target_sources_if_kconfig(drivers__serial PRIVATE uart_ns16550.c) -target_sources_if_kconfig(drivers__serial PRIVATE uart_mcux.c) -target_sources_if_kconfig(drivers__serial PRIVATE uart_mcux_lpuart.c) -target_sources_if_kconfig(drivers__serial PRIVATE uart_stellaris.c) -target_sources_if_kconfig(drivers__serial PRIVATE uart_nsim.c) -target_sources_if_kconfig(drivers__serial PRIVATE uart_atmel_sam3.c) -target_sources_if_kconfig(drivers__serial PRIVATE uart_sam.c) -target_sources_if_kconfig(drivers__serial PRIVATE uart_qmsi.c) -target_sources_if_kconfig(drivers__serial PRIVATE uart_stm32.c) -target_sources_if_kconfig(drivers__serial PRIVATE uart_nrf5.c) -target_sources_if_kconfig(drivers__serial PRIVATE uart_altera_jtag.c) -target_sources_if_kconfig(drivers__serial PRIVATE uart_cc32.c) -target_sources_if_kconfig(drivers__serial PRIVATE uart_cmsdk_apb.c) -target_sources_if_kconfig(drivers__serial PRIVATE uart_riscv_qemu.c) +zephyr_library_link_libraries(drivers) + +zephyr_library_sources_if_kconfig(uart_ns16550.c) +zephyr_library_sources_if_kconfig(uart_mcux.c) +zephyr_library_sources_if_kconfig(uart_mcux_lpuart.c) +zephyr_library_sources_if_kconfig(uart_stellaris.c) +zephyr_library_sources_if_kconfig(uart_nsim.c) +zephyr_library_sources_if_kconfig(uart_atmel_sam3.c) +zephyr_library_sources_if_kconfig(uart_sam.c) +zephyr_library_sources_if_kconfig(uart_qmsi.c) +zephyr_library_sources_if_kconfig(uart_stm32.c) +zephyr_library_sources_if_kconfig(uart_nrf5.c) +zephyr_library_sources_if_kconfig(uart_altera_jtag.c) +zephyr_library_sources_if_kconfig(uart_cc32.c) +zephyr_library_sources_if_kconfig(uart_cmsdk_apb.c) +zephyr_library_sources_if_kconfig(uart_riscv_qemu.c) From 7b1a4839df4b9b1eace1e2fd0e829a65015b807e Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 28 Aug 2017 10:32:34 -0400 Subject: [PATCH 04/11] cmake: console: use zephyr_library_sources macros Signed-off-by: Anas Nashif --- drivers/console/CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/console/CMakeLists.txt b/drivers/console/CMakeLists.txt index c0f2f78d8d13..27c80059b572 100644 --- a/drivers/console/CMakeLists.txt +++ b/drivers/console/CMakeLists.txt @@ -1,12 +1,12 @@ zephyr_library() -target_sources_if_kconfig(drivers__console PRIVATE uart_console.c) -target_sources_if_kconfig(drivers__console PRIVATE ram_console.c) -target_sources_if_kconfig(drivers__console PRIVATE rtt_console.c) -target_sources_if_kconfig(drivers__console PRIVATE ipm_console_receiver.c) -target_sources_if_kconfig(drivers__console PRIVATE ipm_console_sender.c) -target_sources_if_kconfig(drivers__console PRIVATE uart_pipe.c) -target_sources_if_kconfig(drivers__console PRIVATE telnet_console.c) -target_sources_if_kconfig(drivers__console PRIVATE xtensa_sim_console.c) +zephyr_library_sources_if_kconfig(uart_console.c) +zephyr_library_sources_if_kconfig(ram_console.c) +zephyr_library_sources_if_kconfig(rtt_console.c) +zephyr_library_sources_if_kconfig(ipm_console_receiver.c) +zephyr_library_sources_if_kconfig(ipm_console_sender.c) +zephyr_library_sources_if_kconfig(uart_pipe.c) +zephyr_library_sources_if_kconfig(telnet_console.c) +zephyr_library_sources_if_kconfig(xtensa_sim_console.c) -target_link_libraries(drivers__console drivers) +zephyr_library_link_libraries(drivers) From 78261259ac47fcb48700e39bcd5bf1ccec6689e5 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 28 Aug 2017 10:32:46 -0400 Subject: [PATCH 05/11] cmake: timer: use zephyr_library_sources macros Signed-off-by: Anas Nashif --- drivers/timer/CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/timer/CMakeLists.txt b/drivers/timer/CMakeLists.txt index 70a1d7aa76af..ce536d22ff0a 100644 --- a/drivers/timer/CMakeLists.txt +++ b/drivers/timer/CMakeLists.txt @@ -2,14 +2,14 @@ zephyr_library() zephyr_library_sources(sys_clock_init.c) -target_sources_ifdef(CONFIG_HPET_TIMER drivers__timer PRIVATE hpet.c) -target_sources_ifdef(CONFIG_ARCV2_TIMER drivers__timer PRIVATE arcv2_timer0.c) +zephyr_library_sources_ifdef(CONFIG_HPET_TIMER hpet.c) +zephyr_library_sources_ifdef(CONFIG_ARCV2_TIMER arcv2_timer0.c) -target_sources_if_kconfig( drivers__timer PRIVATE loapic_timer.c) -target_sources_if_kconfig( drivers__timer PRIVATE altera_avalon_timer.c) -target_sources_if_kconfig( drivers__timer PRIVATE nrf_rtc_timer.c) -target_sources_if_kconfig( drivers__timer PRIVATE pulpino_timer.c) -target_sources_if_kconfig( drivers__timer PRIVATE riscv_machine_timer.c) -target_sources_if_kconfig( drivers__timer PRIVATE cortex_m_systick.c) +zephyr_library_sources_if_kconfig(loapic_timer.c) +zephyr_library_sources_if_kconfig(altera_avalon_timer.c) +zephyr_library_sources_if_kconfig(nrf_rtc_timer.c) +zephyr_library_sources_if_kconfig(pulpino_timer.c) +zephyr_library_sources_if_kconfig(riscv_machine_timer.c) +zephyr_library_sources_if_kconfig(cortex_m_systick.c) -target_link_libraries(drivers__timer drivers) +zephyr_library_link_libraries(drivers) From df6a954cce5f6c8a61885b58567d840f0dca9be5 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Sun, 27 Aug 2017 10:35:21 -0400 Subject: [PATCH 06/11] cmake: add makefile for quark_d2000_crb Signed-off-by: Anas Nashif --- boards/x86/quark_d2000_crb/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 boards/x86/quark_d2000_crb/CMakeLists.txt diff --git a/boards/x86/quark_d2000_crb/CMakeLists.txt b/boards/x86/quark_d2000_crb/CMakeLists.txt new file mode 100644 index 000000000000..4cc376292f34 --- /dev/null +++ b/boards/x86/quark_d2000_crb/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources(pinmux.c) +zephyr_library_include_directories(PRIVATE ${PROJECT_SOURCE_DIR}/drivers) From 18f02914ec9bdc272b4b040f954a50d8006f5a93 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 29 Aug 2017 08:49:41 -0400 Subject: [PATCH 07/11] boards: Build arduino 101 related file in board directory Signed-off-by: Anas Nashif --- boards/x86/arduino_101/CMakeLists.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/boards/x86/arduino_101/CMakeLists.txt b/boards/x86/arduino_101/CMakeLists.txt index fc21933b157f..4b5a3fcae18f 100644 --- a/boards/x86/arduino_101/CMakeLists.txt +++ b/boards/x86/arduino_101/CMakeLists.txt @@ -1,8 +1,7 @@ zephyr_library() -zephyr_library_sources(${CMAKE_CURRENT_SOURCE_DIR}/pinmux.c) -target_link_libraries(boards__x86__arduino_101 zephyr drivers__pinmux) -target_include_directories(boards__x86__arduino_101 PRIVATE - ${PROJECT_SOURCE_DIR}/include +zephyr_library_sources(pinmux.c) + + +zephyr_library_include_directories(PRIVATE ${PROJECT_SOURCE_DIR}/drivers - ${PROJECT_SOURCE_DIR}/drivers/pinmux ) From 73917a25c0b83594e4b267a04471e8279d2c74fe Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 29 Aug 2017 09:44:17 -0400 Subject: [PATCH 08/11] cmake: support console subsys Signed-off-by: Anas Nashif --- subsys/CMakeLists.txt | 1 + subsys/console/CMakeLists.txt | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 subsys/console/CMakeLists.txt diff --git a/subsys/CMakeLists.txt b/subsys/CMakeLists.txt index 9006f4a3c255..3c44523eb523 100644 --- a/subsys/CMakeLists.txt +++ b/subsys/CMakeLists.txt @@ -1,3 +1,4 @@ +add_subdirectory_ifdef(CONFIG_CONSOLE_PULL console) # add_subdirectory_ifdef(CONFIG_FILE_SYSTEM fs) # add_subdirectory_ifdef(CONFIG_USB usb) add_subdirectory_ifdef(CONFIG_BT bluetooth) diff --git a/subsys/console/CMakeLists.txt b/subsys/console/CMakeLists.txt new file mode 100644 index 000000000000..6a54379e96e8 --- /dev/null +++ b/subsys/console/CMakeLists.txt @@ -0,0 +1,2 @@ +zephyr_sources_ifdef(CONFIG_CONSOLE_GETCHAR getchar.c) +zephyr_sources_ifdef(CONFIG_CONSOLE_GETLINE getline.c) From b96c48e61685a340d6a27a0a3a5098764179ca2c Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 29 Aug 2017 09:45:17 -0400 Subject: [PATCH 09/11] sanitycheck: only run on ported tests and samples Signed-off-by: Anas Nashif --- scripts/sanitycheck | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/sanitycheck b/scripts/sanitycheck index dcd2093cd4ac..2de5a19b541d 100755 --- a/scripts/sanitycheck +++ b/scripts/sanitycheck @@ -1277,6 +1277,9 @@ class TestSuite: for dirpath, dirnames, filenames in os.walk(testcase_root, topdown=True): verbose("scanning %s" % dirpath) + # FIXME: To only run on ported tests and samples when migrating to cmake + if 'CMakeLists.txt' not in filenames: + continue if 'sample.yaml' in filenames: filename = 'sample.yaml' elif 'testcase.yaml' in filenames: From 40be5159c56e646fcb914f84125f7442ca3518f9 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 29 Aug 2017 09:53:06 -0400 Subject: [PATCH 10/11] cmake: fix typo target_cc_options -> target_cc_option Signed-off-by: Anas Nashif --- arch/arm/CMakeLists.txt | 2 +- cmake/extensions.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/CMakeLists.txt b/arch/arm/CMakeLists.txt index 32c3955dc141..58eed76aa0a9 100644 --- a/arch/arm/CMakeLists.txt +++ b/arch/arm/CMakeLists.txt @@ -42,7 +42,7 @@ if(CONFIG_FLOAT) set(FPU_FOR_cortex-m4 fpv4-sp-d16) set(FPU_FOR_cortex-m7 fpv5-d16) set(FPU_FOR_cortex-m33 fpv5-d16) - target_cc_options(zephyr PUBLIC -mfpu=${FPU_FOR_${GCC_M_CPU}}) + target_cc_option(zephyr PUBLIC -mfpu=${FPU_FOR_${GCC_M_CPU}}) if (CONFIG_FP_SOFTABI) target_cc_option(zephyr PUBLIC -mfloat-abi=soft) diff --git a/cmake/extensions.cmake b/cmake/extensions.cmake index 875b73c5d6b3..8eeb5b062851 100644 --- a/cmake/extensions.cmake +++ b/cmake/extensions.cmake @@ -52,7 +52,7 @@ endfunction() function(target_cc_option_ifdef feature_toggle target scope option) if(${feature_toggle}) - target_cc_options(${target} ${scope} ${option}) + target_cc_option(${target} ${scope} ${option}) endif() endfunction() From 8dffa8c7690ff80a6c3d3c691d11b83d931baf14 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 29 Aug 2017 10:01:08 -0400 Subject: [PATCH 11/11] ci: increase coverage in CI sanitycheck Signed-off-by: Anas Nashif --- .shippable.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.shippable.yml b/.shippable.yml index fd8582a950b8..ab9f09e3905d 100644 --- a/.shippable.yml +++ b/.shippable.yml @@ -5,7 +5,7 @@ compiler: gcc env: global: - SDK=0.9.1 - - SANITYCHECK_OPTIONS=" --inline-logs -R -p nrf52_pca10040 -T samples/bluetooth/" + - SANITYCHECK_OPTIONS=" --inline-logs -R -p nrf52_pca10040 -p qemu_cortex_m3 -p qemu_x86_iamcu -p qemu_x86 -p arduino_101" - SANITYCHECK_OPTIONS_RETRY="${SANITYCHECK_OPTIONS} --only-failed --outdir=out-2nd-pass" - ZEPHYR_SDK_INSTALL_DIR=/opt/sdk/zephyr-sdk-0.9.1 - ZEPHYR_GCC_VARIANT=zephyr