mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/ci_cmake_examples' into 'master'
CI/cmake: Fix cmake example build failures, gcov See merge request idf/esp-idf!3296
This commit is contained in:
commit
af453841ea
117
.gitlab-ci.yml
117
.gitlab-ci.yml
@ -177,7 +177,7 @@ build_esp_idf_tests:
|
||||
- make ut-build-all-configs
|
||||
- python tools/UnitTestParser.py
|
||||
|
||||
.build_examples_template: &build_examples_template
|
||||
.build_examples_make_template: &build_examples_make_template
|
||||
<<: *build_template
|
||||
retry: 1
|
||||
artifacts:
|
||||
@ -192,7 +192,7 @@ build_esp_idf_tests:
|
||||
expire_in: 1 week
|
||||
variables:
|
||||
IDF_CI_BUILD: "1"
|
||||
LOG_PATH: "$CI_PROJECT_DIR/log_examples"
|
||||
LOG_PATH: "$CI_PROJECT_DIR/log_examples_make"
|
||||
script:
|
||||
# it's not possible to build 100% out-of-tree and have the "artifacts"
|
||||
# mechanism work, but this is the next best thing
|
||||
@ -202,36 +202,81 @@ build_esp_idf_tests:
|
||||
# build some of examples
|
||||
- mkdir -p ${LOG_PATH}
|
||||
- ${IDF_PATH}/tools/ci/build_examples.sh "${CI_JOB_NAME}"
|
||||
# and again, with cmake!
|
||||
- rm -rf ../build_examples_cmake
|
||||
- mkdir ../build_examples_cmake
|
||||
- cd ../build_examples_cmake
|
||||
- mkdir -p ${LOG_PATH}_cmake
|
||||
- LOG_PATH=${LOG_PATH}_cmake ${IDF_PATH}/tools/ci/build_examples_cmake.sh "${CI_JOB_NAME}"
|
||||
|
||||
build_examples_00:
|
||||
<<: *build_examples_template
|
||||
# same as above, but for CMake
|
||||
.build_examples_cmake_template: &build_examples_cmake_template
|
||||
<<: *build_template
|
||||
retry: 1
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- build_examples_cmake/*/*/*/build/*.bin
|
||||
- build_examples_cmake/*/*/*/build/*.elf
|
||||
- build_examples_cmake/*/*/*/build/*.map
|
||||
- build_examples_cmake/*/*/*/build/download.config
|
||||
- build_examples_cmake/*/*/*/build/bootloader/*.bin
|
||||
- $LOG_PATH
|
||||
expire_in: 1 week
|
||||
variables:
|
||||
IDF_CI_BUILD: "1"
|
||||
LOG_PATH: "$CI_PROJECT_DIR/log_examples_cmake"
|
||||
script:
|
||||
# it's not possible to build 100% out-of-tree and have the "artifacts"
|
||||
# mechanism work, but this is the next best thing
|
||||
- rm -rf build_examples_cmake
|
||||
- mkdir build_examples_cmake
|
||||
- cd build_examples_cmake
|
||||
# build some of examples
|
||||
- mkdir -p ${LOG_PATH}
|
||||
- ${IDF_PATH}/tools/ci/build_examples_cmake.sh "${CI_JOB_NAME}"
|
||||
|
||||
build_examples_01:
|
||||
<<: *build_examples_template
|
||||
build_examples_make_00:
|
||||
<<: *build_examples_make_template
|
||||
|
||||
build_examples_02:
|
||||
<<: *build_examples_template
|
||||
build_examples_make_01:
|
||||
<<: *build_examples_make_template
|
||||
|
||||
build_examples_03:
|
||||
<<: *build_examples_template
|
||||
build_examples_make_02:
|
||||
<<: *build_examples_make_template
|
||||
|
||||
build_examples_04:
|
||||
<<: *build_examples_template
|
||||
build_examples_make_03:
|
||||
<<: *build_examples_make_template
|
||||
|
||||
build_examples_05:
|
||||
<<: *build_examples_template
|
||||
build_examples_make_04:
|
||||
<<: *build_examples_make_template
|
||||
|
||||
build_examples_06:
|
||||
<<: *build_examples_template
|
||||
build_examples_make_05:
|
||||
<<: *build_examples_make_template
|
||||
|
||||
build_examples_07:
|
||||
<<: *build_examples_template
|
||||
build_examples_make_06:
|
||||
<<: *build_examples_make_template
|
||||
|
||||
build_examples_make_07:
|
||||
<<: *build_examples_make_template
|
||||
|
||||
build_examples_cmake_00:
|
||||
<<: *build_examples_cmake_template
|
||||
|
||||
build_examples_cmake_01:
|
||||
<<: *build_examples_cmake_template
|
||||
|
||||
build_examples_cmake_02:
|
||||
<<: *build_examples_cmake_template
|
||||
|
||||
build_examples_cmake_03:
|
||||
<<: *build_examples_cmake_template
|
||||
|
||||
build_examples_cmake_04:
|
||||
<<: *build_examples_cmake_template
|
||||
|
||||
build_examples_cmake_05:
|
||||
<<: *build_examples_cmake_template
|
||||
|
||||
build_examples_cmake_06:
|
||||
<<: *build_examples_cmake_template
|
||||
|
||||
build_examples_cmake_07:
|
||||
<<: *build_examples_cmake_template
|
||||
|
||||
# If you want to add new build example jobs, please add it into dependencies of `.example_test_template`
|
||||
|
||||
@ -641,14 +686,22 @@ assign_test:
|
||||
- schedules
|
||||
dependencies:
|
||||
- assign_test
|
||||
- build_examples_00
|
||||
- build_examples_01
|
||||
- build_examples_02
|
||||
- build_examples_03
|
||||
- build_examples_04
|
||||
- build_examples_05
|
||||
- build_examples_06
|
||||
- build_examples_07
|
||||
- build_examples_make_00
|
||||
- build_examples_make_01
|
||||
- build_examples_make_02
|
||||
- build_examples_make_03
|
||||
- build_examples_make_04
|
||||
- build_examples_make_05
|
||||
- build_examples_make_06
|
||||
- build_examples_make_07
|
||||
- build_examples_cmake_00
|
||||
- build_examples_cmake_01
|
||||
- build_examples_cmake_02
|
||||
- build_examples_cmake_03
|
||||
- build_examples_cmake_04
|
||||
- build_examples_cmake_05
|
||||
- build_examples_cmake_06
|
||||
- build_examples_cmake_07
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
|
@ -24,3 +24,5 @@ register_component()
|
||||
# disable --coverage for this component, as it is used as transport
|
||||
# for gcov
|
||||
component_compile_options("-fno-profile-arcs" "-fno-test-coverage")
|
||||
|
||||
target_link_libraries(app_trace gcov)
|
||||
|
@ -5,7 +5,6 @@
|
||||
# BT config
|
||||
#
|
||||
CONFIG_BT_ENABLED=y
|
||||
CONFIG_BT_ENABLED=y
|
||||
CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY=y
|
||||
CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY=
|
||||
CONFIG_BTDM_CONTROLLER_MODE_BTDM=
|
||||
|
@ -302,7 +302,7 @@ esptool.py v2.1-beta1
|
||||
)";
|
||||
|
||||
const char* flash_output[] = {
|
||||
R"(Flashing binaries to serial port )" CONFIG_ESPTOOLPY_PORT R"( (app at offset 0x10000)...
|
||||
R"(Flashing binaries to serial port (*) (app at offset 0x10000)...
|
||||
esptool.py v2.1-beta1
|
||||
Connecting....
|
||||
)",
|
||||
@ -334,7 +334,7 @@ Hard resetting...
|
||||
|
||||
const char* monitor_output =
|
||||
R"(MONITOR
|
||||
)" LOG_COLOR_W R"(--- idf_monitor on )" CONFIG_ESPTOOLPY_PORT R"( 115200 ---
|
||||
)" LOG_COLOR_W R"(--- idf_monitor on (*) 115200 ---
|
||||
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H --
|
||||
)" LOG_RESET_COLOR;
|
||||
|
||||
|
@ -25,6 +25,9 @@ It will enable coverage info for all source files of your component. If you need
|
||||
`gcov_example.o: CFLAGS += --coverage`
|
||||
Replace `gcov_example.o` with path to your file.
|
||||
|
||||
For CMake-based build system, use `component_compile_options(--coverage)` or: ` set_source_files_properties(gcov_example.c PROPERTIES COMPILE_FLAGS --coverage`
|
||||
|
||||
|
||||
### Hard-coded Dump Call
|
||||
|
||||
This method requires `esp_gcov_dump` to be called from your application's code. Below are additional steps which should be performed after the generic ones to obtain coverage info via hard-coded call. Step 1 is already done for this example project.
|
||||
|
@ -3,3 +3,7 @@ set(COMPONENT_SRCS "gcov_example.c"
|
||||
set(COMPONENT_ADD_INCLUDEDIRS ".")
|
||||
|
||||
register_component()
|
||||
|
||||
set_source_files_properties(gcov_example.c
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
--coverage)
|
||||
|
@ -2,7 +2,5 @@
|
||||
# in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
set(MAIN_SRCS main/light_sleep_example_main.c)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(light_sleep_example)
|
||||
|
4
examples/system/light_sleep/main/CMakeLists.txt
Normal file
4
examples/system/light_sleep/main/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
set(COMPONENT_SRCS "light_sleep_example_main.c")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS ".")
|
||||
|
||||
register_component()
|
@ -55,10 +55,10 @@ openssl req -x509 -newkey rsa:2048 -keyout ca_key.pem -out ca_cert.pem -days 365
|
||||
|
||||
```
|
||||
|
||||
Copy the certificate to OTA example directory:
|
||||
Copy the certificate to `server_certs` directory inside OTA example directory:
|
||||
|
||||
```
|
||||
cp ca_cert.pem $IDF_PATH/examples/system/ota/server_certs/ca_cert.pem
|
||||
cp ca_cert.pem /path/to/ota/example/server_certs/
|
||||
```
|
||||
|
||||
|
||||
|
@ -1,10 +1,7 @@
|
||||
set(COMPONENT_SRCS "native_ota_example.c")
|
||||
set(COMPONENT_ADD_INCLUDEDIRS ".")
|
||||
|
||||
|
||||
# Embed the server root certificate into the final binary
|
||||
#
|
||||
# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.)
|
||||
set(COMPONENT_EMBED_TXTFILES ../../server_certs/ca_cert.pem)
|
||||
set(COMPONENT_EMBED_TXTFILES ${PROJECT_PATH}/server_certs/ca_cert.pem)
|
||||
|
||||
register_component()
|
||||
|
@ -3,4 +3,4 @@
|
||||
#
|
||||
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
||||
|
||||
COMPONENT_EMBED_TXTFILES := ${IDF_PATH}/examples/system/ota/server_certs/ca_cert.pem
|
||||
COMPONENT_EMBED_TXTFILES := ${PROJECT_PATH}/server_certs/ca_cert.pem
|
||||
|
@ -3,9 +3,6 @@ set(COMPONENT_ADD_INCLUDEDIRS ".")
|
||||
|
||||
|
||||
# Embed the server root certificate into the final binary
|
||||
#
|
||||
# (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.)
|
||||
set(COMPONENT_EMBED_TXTFILES ../../server_certs/ca_cert.pem)
|
||||
|
||||
set(COMPONENT_EMBED_TXTFILES ${PROJECT_PATH}/server_certs/ca_cert.pem)
|
||||
|
||||
register_component()
|
||||
|
@ -3,4 +3,4 @@
|
||||
#
|
||||
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
||||
|
||||
COMPONENT_EMBED_TXTFILES := ${IDF_PATH}/examples/system/ota/server_certs/ca_cert.pem
|
||||
COMPONENT_EMBED_TXTFILES := ${PROJECT_PATH}/server_certs/ca_cert.pem
|
||||
|
@ -88,8 +88,8 @@ else
|
||||
[ -z ${NUM_OF_JOBS} ] && die "NUM_OF_JOBS is bad"
|
||||
|
||||
# count number of examples
|
||||
NUM_OF_EXAMPLES=$(echo ${EXAMPLE_PATHS} | wc -l )
|
||||
[ -z ${NUM_OF_EXAMPLES} ] && die "NUM_OF_EXAMPLES is bad"
|
||||
NUM_OF_EXAMPLES=$( echo "${EXAMPLE_PATHS}" | wc -l )
|
||||
[ ${NUM_OF_EXAMPLES} -lt 100 ] && die "NUM_OF_EXAMPLES is bad"
|
||||
|
||||
# separate intervals
|
||||
#57 / 5 == 12
|
||||
|
Loading…
Reference in New Issue
Block a user