Skip to content

Commit

Permalink
Merge pull request #2 from nashif/cmake_anas2
Browse files Browse the repository at this point in the history
WIP: improve sanitycheck and add more SoCs and samples
  • Loading branch information
SebastianBoe authored Aug 25, 2017
2 parents 42260c3 + f913f2b commit 4d619d2
Show file tree
Hide file tree
Showing 22 changed files with 175 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .shippable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ compiler: gcc
env:
global:
- SDK=0.9.1
- SANITYCHECK_OPTIONS=" --inline-logs -R --no-update -p nrf52_pca10040 -T samples/bluetooth/"
- SANITYCHECK_OPTIONS=" --inline-logs -R -p nrf52_pca10040 -T samples/bluetooth/"
- 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
Expand Down
17 changes: 17 additions & 0 deletions arch/x86/soc/intel_quark/quark_d2000/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

zephyr_library_include_directories(PRIVATE ${PROJECT_SOURCE_DIR}/drivers)

if(CONFIG_SOC_QUARK_D2000)
target_compile_definitions(zephyr PUBLIC
QM_LAKEMONT
-DSOC_SERIES=quark_d2000
)
endif()

target_cc_option(zephyr PUBLIC -march=lakemont -mtune=lakemont -msoft-float)

if(CONFIG_X86_IAMCU)
set_property(GLOBAL APPEND PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES -D__IAMCU)
set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT "elf32-iamcu")
set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_ARCH "iamcu:intel")
endif()
36 changes: 13 additions & 23 deletions arch/x86/soc/intel_quark/quark_se/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,35 +1,25 @@
zephyr_library()

zephyr_library_include_directories(PRIVATE ${PROJECT_SOURCE_DIR}/drivers)

if(COMPILER STREQUAL "clang")
else()
target_cc_option(zephyr PUBLIC -march=lakemont -mtune=lakemont)
if(CONFIG_SOC_QUARK_SE_C1000)
target_compile_definitions(zephyr PUBLIC
QM_LAKEMONT
-DSOC_SERIES=quark_se
)
endif()

target_cc_option(zephyr PUBLIC -msoft-float -march=pentium)
target_cc_option(zephyr PUBLIC -march=lakemont -mtune=lakemont -msoft-float)

if(CONFIG_X86_IAMCU)
target_cc_option(zephyr PUBLIC -miamcu)
set_property(GLOBAL APPEND PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES -D__IAMCU)
set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT "elf32-iamcu")
set_property(GLOBAL PROPERTY PROPERTY_OUTPUT_ARCH "iamcu:intel")
else()
target_cc_option(zephyr PUBLIC -mno-iamcu)
endif()

target_compile_definitions(zephyr PUBLIC QM_LAKEMONT=1)

set(SOC_SERIES quark_se) # PARENT_SCOPE or global property?

# ccflags-y +=-I$(srctree)/arch/x86
# ccflags-y +=-I$(srctree)/include/drivers
# ccflags-y +=-I$(srctree)/drivers
# asflags-y := ${ccflags-y}

zephyr_library_sources_ifdef(CONFIG_SOC_QUARK_SE_C1000
soc.c
soc_config.c
eoi.c
power.c
soc_power.S
target_sources(zephyr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/soc.c
${CMAKE_CURRENT_SOURCE_DIR}/soc_config.c
${CMAKE_CURRENT_SOURCE_DIR}/eoi.c
${CMAKE_CURRENT_SOURCE_DIR}/power.c
${CMAKE_CURRENT_SOURCE_DIR}/soc_power.S
)
2 changes: 2 additions & 0 deletions cmake/kconfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ execute_process(
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig
)

add_custom_target(config-sanitycheck DEPENDS ${DOTCONFIG})

add_custom_target(menuconfig
COMMAND
${CMAKE_COMMAND} -E env
Expand Down
2 changes: 1 addition & 1 deletion drivers/interrupt_controller/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# TODO: Get rid of this if statement by introducing
# CONFIG_HAS_INTERRUPT_CONTROLLER

if(CONFIG_LOAPIC OR MVIC OR ARCV2_INTERRUPT_UNIT OR PLIC_FE310 OR EXTI_STM32)
if(CONFIG_LOAPIC OR CONFIG_MVIC OR CONFIG_ARCV2_INTERRUPT_UNIT OR CONFIG_PLIC_FE310 OR CONFIG_EXTI_STM32)
zephyr_library()

zephyr_library_sources_ifdef(CONFIG_ARCV2_INTERRUPT_UNIT arcv2_irq_unit.c)
Expand Down
10 changes: 10 additions & 0 deletions samples/basic/blink_led/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if(DEFINED ENV{BOARD})
set(BOARD $ENV{BOARD})
else()
set(BOARD arduino_101)
endif()

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)

target_sources(app PRIVATE src/main.c)
4 changes: 2 additions & 2 deletions samples/basic/blinky/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
if(DEFINED ENV{BOARD})
set(BOARD $ENV{BOARD})
else()
set(BOARD quark_d2000_crb)
set(BOARD arduino_101)
endif()

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)

target_sources(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c)
target_sources(app PRIVATE src/main.c)
10 changes: 10 additions & 0 deletions samples/basic/button/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if(DEFINED ENV{BOARD})
set(BOARD $ENV{BOARD})
else()
set(BOARD nucleo_f103rb)
endif()

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)

target_sources(app PRIVATE src/main.c)
10 changes: 10 additions & 0 deletions samples/basic/disco/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if(DEFINED ENV{BOARD})
set(BOARD $ENV{BOARD})
else()
set(BOARD nucleo_f103rb)
endif()

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)

target_sources(app PRIVATE src/main.c)
10 changes: 10 additions & 0 deletions samples/basic/fade_led/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if(DEFINED ENV{BOARD})
set(BOARD $ENV{BOARD})
else()
set(BOARD arduino_101)
endif()

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)

target_sources(app PRIVATE src/main.c)
10 changes: 10 additions & 0 deletions samples/basic/rgb_led/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if(DEFINED ENV{BOARD})
set(BOARD $ENV{BOARD})
else()
set(BOARD arduino_101)
endif()

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)

target_sources(app PRIVATE src/main.c)
10 changes: 10 additions & 0 deletions samples/basic/servo_motor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if(DEFINED ENV{BOARD})
set(BOARD $ENV{BOARD})
else()
set(BOARD arduino_101)
endif()

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)

target_sources(app PRIVATE src/main.c)
10 changes: 10 additions & 0 deletions samples/hello_world/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if(DEFINED ENV{BOARD})
set(BOARD $ENV{BOARD})
else()
set(BOARD qemu_x86)
endif()

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)

target_sources(app PRIVATE src/main.c)
10 changes: 10 additions & 0 deletions samples/philosophers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if(DEFINED ENV{BOARD})
set(BOARD $ENV{BOARD})
else()
set(BOARD qemu_x86)
endif()

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)

target_sources(app PRIVATE src/main.c)
10 changes: 10 additions & 0 deletions samples/subsys/console/echo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if(DEFINED ENV{BOARD})
set(BOARD $ENV{BOARD})
else()
set(BOARD qemu_x86)
endif()

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)

target_sources(app PRIVATE src/main.c)
10 changes: 10 additions & 0 deletions samples/subsys/console/getchar/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if(DEFINED ENV{BOARD})
set(BOARD $ENV{BOARD})
else()
set(BOARD qemu_x86)
endif()

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)

target_sources(app PRIVATE src/main.c)
10 changes: 10 additions & 0 deletions samples/subsys/console/getline/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if(DEFINED ENV{BOARD})
set(BOARD $ENV{BOARD})
else()
set(BOARD qemu_x86)
endif()

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)

target_sources(app PRIVATE src/main.c)
10 changes: 10 additions & 0 deletions samples/synchronization/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
if(DEFINED ENV{BOARD})
set(BOARD $ENV{BOARD})
else()
set(BOARD qemu_x86)
endif()

include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(NONE)

target_sources(app PRIVATE src/main.c)
14 changes: 7 additions & 7 deletions scripts/sanitycheck
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,8 @@ class MakeGenerator:
"""
verb = "1" if VERBOSE else "0"
args = " ".join(["-D{}".format(a) for a in args])
make_args = " ".join(make_args)
#print(make_args)
#make_args = " ".join(make_args)

if self.asserts:
cflags="-DCONFIG_ASSERT=1 -D__ASSERT_ON=2"
Expand Down Expand Up @@ -744,7 +745,7 @@ class MakeGenerator:
if not os.path.exists(outdir):
os.makedirs(outdir)

def add_build_goal(self, name, directory, outdir, args, buildlog):
def add_build_goal(self, name, directory, outdir, args, buildlog, make_args=""):
"""Add a goal to invoke a Kbuild session
@param name A unique string name for this build goal. The results
Expand All @@ -760,7 +761,7 @@ class MakeGenerator:
build_logfile = os.path.join(outdir, buildlog)
text = (self._get_rule_header(name) +
self._get_sub_make(name, "building", directory,
outdir, build_logfile, args) +
outdir, build_logfile, args, make_args=make_args) +
self._get_rule_footer(name))
self.goals[name] = MakeGoal(name, text, None, self.logfile, build_logfile,
None, None)
Expand Down Expand Up @@ -1220,7 +1221,7 @@ class TestInstance:
@return A SizeCalculator object
"""
fns = glob.glob(os.path.join(self.outdir, "*.elf"))
fns = glob.glob(os.path.join(self.outdir, "zephyr", "*.elf"))
fns = [x for x in fns if not x.endswith('_prebuilt.elf')]
if (len(fns) != 1):
raise BuildError("Missing/multiple output ELF binary")
Expand Down Expand Up @@ -1431,18 +1432,17 @@ class TestSuite:
args = tc.extra_args[:]
args.append("ARCH={}" .format(plat.arch))
args.append("BOARD={}".format(plat.name))
args.append("config-sanitycheck")
args.extend(extra_args)
# FIXME would be nice to use a common outdir for this so that
# conf, gen_idt, etc aren't rebuilt for every combination,
# need a way to avoid different Make processes from clobbering
# each other since they all try to build them simultaneously

o = os.path.join(self.outdir, plat.name, tc.path)
dlist[tc, plat, tc.name.split("/")[-1]] = os.path.join(o,".config-sanitycheck")
dlist[tc, plat, tc.name.split("/")[-1]] = os.path.join(o,"zephyr", ".config")
goal = "_".join([plat.name, "_".join(tc.name.split("/")), "config-sanitycheck"])
mg.add_build_goal(goal, os.path.join(ZEPHYR_BASE, tc.code_location), o,
args, "config-sanitycheck.log")
args, "config-sanitycheck.log", make_args="config-sanitycheck")

info("Building testcase defconfigs...")
results = mg.execute(defconfig_cb)
Expand Down
4 changes: 2 additions & 2 deletions subsys/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ add_subdirectory_ifdef(CONFIG_BT bluetooth)
add_subdirectory_ifdef(CONFIG_NET_BUF net)
# add_subdirectory_ifdef(CONFIG_CONSOLE_SHELL shell)
# add_subdirectory_ifdef(CONFIG_DISK_ACCESS disk)
# add_subdirectory(logging)
# add_subdirectory(debug)
add_subdirectory(logging)
add_subdirectory(debug)
3 changes: 3 additions & 0 deletions subsys/debug/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

target_sources_ifdef(CONFIG_OPENOCD_SUPPORT zephyr PRIVATE
${CMAKE_CURRENT_LIST_DIR}/openocd.c)
7 changes: 7 additions & 0 deletions subsys/logging/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

target_sources_ifdef(CONFIG_SYS_LOG zephyr PRIVATE
${CMAKE_CURRENT_LIST_DIR}/sys_log.c)
target_sources_ifdef(CONFIG_KERNEL_EVENT_LOGGER zephyr PRIVATE
${CMAKE_CURRENT_LIST_DIR}/event_logger.c
${CMAKE_CURRENT_LIST_DIR}/kernel_event_logger.c
)

0 comments on commit 4d619d2

Please sign in to comment.