From 418303d38a90692d2025e7a72a56c590dec6c40c Mon Sep 17 00:00:00 2001 From: Jakob Hasse Date: Thu, 9 Sep 2021 18:49:51 +0800 Subject: [PATCH] [examples]: fixed linux host example --- .gitlab/ci/host-test.yml | 7 +++++++ examples/build_system/cmake/linux_host_app/CMakeLists.txt | 5 +++++ examples/build_system/cmake/linux_host_app/README.md | 5 ++++- .../build_system/cmake/linux_host_app/sdkconfig.defaults | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.gitlab/ci/host-test.yml b/.gitlab/ci/host-test.yml index 42e2b18c12..82be5c54aa 100644 --- a/.gitlab/ci/host-test.yml +++ b/.gitlab/ci/host-test.yml @@ -363,3 +363,10 @@ test_cxx_gpio: - cd ${IDF_PATH}/examples/cxx/experimental/experimental_cpp_component/host_test/gpio - idf.py build - build/test_gpio_cxx_host.elf + +test_linux_example: + extends: .host_test_template + script: + - cd ${IDF_PATH}/examples/build_system/cmake/linux_host_app + - idf.py build + - build/linux_host_app.elf diff --git a/examples/build_system/cmake/linux_host_app/CMakeLists.txt b/examples/build_system/cmake/linux_host_app/CMakeLists.txt index 40264e1a7a..f7fc668d72 100644 --- a/examples/build_system/cmake/linux_host_app/CMakeLists.txt +++ b/examples/build_system/cmake/linux_host_app/CMakeLists.txt @@ -2,4 +2,9 @@ cmake_minimum_required(VERSION 3.5) include($ENV{IDF_PATH}/tools/cmake/project.cmake) set(COMPONENTS main) + +# Freertos is included via common components, however, currently only the mock component is compatible with linux +# target. +list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/") + project(linux_host_app) diff --git a/examples/build_system/cmake/linux_host_app/README.md b/examples/build_system/cmake/linux_host_app/README.md index 446b100261..02fbd5b5bd 100644 --- a/examples/build_system/cmake/linux_host_app/README.md +++ b/examples/build_system/cmake/linux_host_app/README.md @@ -13,9 +13,12 @@ There are two major differences to an IDF application built for an ESP chip comp 2. The project-level [CMakeLists.txt](CMakeLists.txt) for Linux is different from that of a normal IDF application for an ESP chip. On Linux, there is an additional line `set(COMPONENTS main)`, which clears the common requirements (default dependencies usually included in all IDF applications). - This is currently necessary as the Linux-host feature is still under developement. + This is currently necessary as the Linux-host feature is still under development. Otherwise, a lot of hardware-dependent code would be pulled in. +# Requirements +Currently, Ruby is required for the mock override of FreeRTOS. + # Build Source the IDF environment as usual, then set the Linux target: ```bash diff --git a/examples/build_system/cmake/linux_host_app/sdkconfig.defaults b/examples/build_system/cmake/linux_host_app/sdkconfig.defaults index c18d7771a4..f14d0b8caa 100644 --- a/examples/build_system/cmake/linux_host_app/sdkconfig.defaults +++ b/examples/build_system/cmake/linux_host_app/sdkconfig.defaults @@ -1,2 +1,3 @@ +CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=n CONFIG_IDF_TARGET="linux" CONFIG_COMPILER_CXX_EXCEPTIONS=y