From 0ee287cd32de93cf03b15535bc3d3a761fbb8f8c Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Tue, 18 Feb 2020 08:22:43 +0500 Subject: [PATCH 1/5] partition_table: output partition table info for partition_table target --- components/partition_table/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/partition_table/CMakeLists.txt b/components/partition_table/CMakeLists.txt index 492dfb810..11fef65f0 100644 --- a/components/partition_table/CMakeLists.txt +++ b/components/partition_table/CMakeLists.txt @@ -49,7 +49,14 @@ if(CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES) endif() if(EXISTS ${partition_csv}) - add_custom_target(partition_table ALL DEPENDS "${IDF_BUILD_ARTIFACTS_DIR}/partition_table/${final_partition_bin}") + add_custom_target(partition_table ALL DEPENDS "${IDF_BUILD_ARTIFACTS_DIR}/partition_table/${final_partition_bin}" + COMMAND ${CMAKE_COMMAND} -E echo "Partition table binary generated. Contents:" + COMMAND ${CMAKE_COMMAND} -E echo "*******************************************************************************" + COMMAND COMMAND "${PYTHON}" "${CMAKE_CURRENT_SOURCE_DIR}/gen_esp32part.py" + -q --offset ${PARTITION_TABLE_OFFSET} ${md5_opt} ${flashsize_opt} + ${partition_secure_opt} "${IDF_BUILD_ARTIFACTS_DIR}/partition_table/${unsigned_partition_bin}" + COMMAND ${CMAKE_COMMAND} -E echo "*******************************************************************************" + VERBATIM) else() # If the partition input CSV is not found, create a phony partition_table target that # fails the build. fail_at_build_time also touches CMakeCache.txt to cause a cmake run next time From 1592f338a6e9685cacb9d5c6c84b5e4887f6c528 Mon Sep 17 00:00:00 2001 From: Renz Bagaporo Date: Thu, 5 Mar 2020 11:04:01 +0800 Subject: [PATCH 2/5] ci: add test for partition_table target --- tools/ci/test_build_system_cmake.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/ci/test_build_system_cmake.sh b/tools/ci/test_build_system_cmake.sh index c4553e941..d99efd5a0 100755 --- a/tools/ci/test_build_system_cmake.sh +++ b/tools/ci/test_build_system_cmake.sh @@ -350,6 +350,10 @@ function run_tests() (grep '"command"' build/compile_commands.json | grep -v mfix-esp32-psram-cache-issue) && failure "All commands in compile_commands.json should use PSRAM cache workaround" rm sdkconfig.defaults + print_status "Displays partition table when executing target partition_table" + idf.py partition_table | grep -E "# Espressif .+ Partition Table" + rm -r build + print_status "Make sure a full build never runs '/usr/bin/env python' or similar" OLDPATH="$PATH" PYTHON="$(which python)" From 2d28fd25635ae1bb00c8cf3e7b8f940f33484218 Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Tue, 27 Aug 2019 09:24:17 +0800 Subject: [PATCH 3/5] cmake: fix build failure when git repo is initialized but no first commit Closes https://github.com/espressif/esp-idf/issues/3920 --- .../third_party/GetGitRevisionDescription.cmake.in | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/cmake/third_party/GetGitRevisionDescription.cmake.in b/tools/cmake/third_party/GetGitRevisionDescription.cmake.in index 6d8b708ef..0cf025b14 100644 --- a/tools/cmake/third_party/GetGitRevisionDescription.cmake.in +++ b/tools/cmake/third_party/GetGitRevisionDescription.cmake.in @@ -24,10 +24,12 @@ if(HEAD_CONTENTS MATCHES "ref") if(EXISTS "@GIT_DIR@/${HEAD_REF}") configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) else() - configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) - file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) - if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") - set(HEAD_HASH "${CMAKE_MATCH_1}") + if(EXISTS "@GIT_DIR@/packed-refs") + configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) + file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) + if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") + set(HEAD_HASH "${CMAKE_MATCH_1}") + endif() endif() endif() else() From d497c4babdc9622b0194cc5ec60cb95012225673 Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Tue, 27 Aug 2019 10:26:34 +0800 Subject: [PATCH 4/5] ldgen: fix build issue on make when build dir is a symlink Fixes an issue where build fails if the build directory is a symlink. The issue is caused by the rule target and the final executable dependency not matching. Closes https://github.com/espressif/esp-idf/issues/3626 --- components/esp32/Makefile.projbuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/Makefile.projbuild b/components/esp32/Makefile.projbuild index b99415538..00d5183f5 100644 --- a/components/esp32/Makefile.projbuild +++ b/components/esp32/Makefile.projbuild @@ -43,7 +43,7 @@ ifneq ("$(filter esp32,$(TEST_COMPONENTS_LIST))","") CPPFLAGS += -DESP_TIMER_DYNAMIC_OVERFLOW_VAL endif ESP32_LINKER_SCRIPT_TEMPLATE := $(COMPONENT_PATH)/ld/esp32.project.ld.in -ESP32_LINKER_SCRIPT_OUTPUT_DIR := $(abspath $(BUILD_DIR_BASE)/esp32) +ESP32_LINKER_SCRIPT_OUTPUT_DIR := $(realpath $(BUILD_DIR_BASE)/esp32) # Target to generate linker script generator from fragments presented by each of # the components From 07830df4d36210e0e9a87f2cd6cfbf9f1ba3098d Mon Sep 17 00:00:00 2001 From: Renz Bagaporo Date: Tue, 3 Mar 2020 16:15:29 +0800 Subject: [PATCH 5/5] examples: split source files for one of the ulp examples --- examples/system/ulp/README.md | 2 +- examples/system/ulp/main/CMakeLists.txt | 2 +- examples/system/ulp/main/component.mk | 2 +- examples/system/ulp/main/ulp/pulse_cnt.S | 11 ----------- examples/system/ulp/main/ulp/wake_up.S | 16 ++++++++++++++++ 5 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 examples/system/ulp/main/ulp/wake_up.S diff --git a/examples/system/ulp/README.md b/examples/system/ulp/README.md index 4b2c5341a..f46f3f715 100644 --- a/examples/system/ulp/README.md +++ b/examples/system/ulp/README.md @@ -2,7 +2,7 @@ This example demonstrates how to program the ULP coprocessor to count pulses on an IO while the main CPUs are either running some other code or are in deep sleep. See the README.md file in the upper level 'examples' directory for more information about examples. -ULP program written in assembly can be found in `ulp/pulse_cnt.S`. The build system assembles and links this program, converts it into binary format, and embeds it into the .rodata section of the ESP-IDF application. +ULP program written in assembly can be found across `ulp/pulse_cnt.S` and `ulp/wake_up.S` (demonstrating multiple ULP source files). The build system assembles and links this program, converts it into binary format, and embeds it into the .rodata section of the ESP-IDF application. At runtime, the main code running on the ESP32 (found in main.c) loads ULP program into the `RTC_SLOW_MEM` memory region using `ulp_load_binary` function. Main code configures the ULP program by setting up values of some variables and then starts it using `ulp_run`. Once the ULP program is started, it runs periodically, with the period set by the main program. The main program enables ULP wakeup source and puts the chip into deep sleep mode. diff --git a/examples/system/ulp/main/CMakeLists.txt b/examples/system/ulp/main/CMakeLists.txt index 7b39598ce..77a9493bc 100644 --- a/examples/system/ulp/main/CMakeLists.txt +++ b/examples/system/ulp/main/CMakeLists.txt @@ -15,7 +15,7 @@ set(ULP_APP_NAME ulp_${COMPONENT_NAME}) # 2. Specify all assembly source files here. # Files should be placed into a separate directory (in this case, ulp/), # which should not be added to COMPONENT_SRCS. -set(ULP_S_SOURCES "ulp/pulse_cnt.S") +set(ULP_S_SOURCES "ulp/pulse_cnt.S" "ulp/wake_up.S") # # 3. List all the component source files which include automatically # generated ULP export file, $(ULP_APP_NAME).h: diff --git a/examples/system/ulp/main/component.mk b/examples/system/ulp/main/component.mk index 566757a56..55c5ba352 100644 --- a/examples/system/ulp/main/component.mk +++ b/examples/system/ulp/main/component.mk @@ -11,7 +11,7 @@ ULP_APP_NAME ?= ulp_$(COMPONENT_NAME) # Files should be placed into a separate directory (in this case, ulp/), # which should not be added to COMPONENT_SRCDIRS. ULP_S_SOURCES = $(addprefix $(COMPONENT_PATH)/ulp/, \ - pulse_cnt.S \ + pulse_cnt.S wake_up.S\ ) # # 3. List all the component object files which include automatically diff --git a/examples/system/ulp/main/ulp/pulse_cnt.S b/examples/system/ulp/main/ulp/pulse_cnt.S index 774375e2a..33e6ef686 100644 --- a/examples/system/ulp/main/ulp/pulse_cnt.S +++ b/examples/system/ulp/main/ulp/pulse_cnt.S @@ -144,14 +144,3 @@ edge_detected: jump wake_up, eq /* Not yet. End program */ halt - - .global wake_up -wake_up: - /* Check if the system can be woken up */ - READ_RTC_FIELD(RTC_CNTL_LOW_POWER_ST_REG, RTC_CNTL_RDY_FOR_WAKEUP) - and r0, r0, 1 - jump wake_up, eq - - /* Wake up the SoC, end program */ - wake - halt diff --git a/examples/system/ulp/main/ulp/wake_up.S b/examples/system/ulp/main/ulp/wake_up.S new file mode 100644 index 000000000..ec2e05da4 --- /dev/null +++ b/examples/system/ulp/main/ulp/wake_up.S @@ -0,0 +1,16 @@ +/* ULP assembly files are passed through C preprocessor first, so include directives + and C macros may be used in these files + */ +#include "soc/rtc_cntl_reg.h" +#include "soc/soc_ulp.h" + + .global wake_up +wake_up: + /* Check if the system can be woken up */ + READ_RTC_FIELD(RTC_CNTL_LOW_POWER_ST_REG, RTC_CNTL_RDY_FOR_WAKEUP) + and r0, r0, 1 + jump wake_up, eq + + /* Wake up the SoC, end program */ + wake + halt