Skip to content

Commit adb01cf

Browse files
authored
Compile error if CONFIG_FREERTOS_HZ != 1000 (espressif#6955)
* Compile error if CONFIG_FREERTOS_HZ != 1000 * add a check at the CMake level, per feedback * Set CONFIG_FREERTOS_HZ=1000 in CI test of Arduino-as-component
1 parent d22bcb7 commit adb01cf

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

Diff for: .github/workflows/push.yml

+1
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,5 @@ jobs:
104104
run: |
105105
. ${IDF_PATH}/export.sh
106106
idf.py create-project test
107+
echo CONFIG_FREERTOS_HZ=1000 > test/sdkconfig.defaults
107108
idf.py -C test -DEXTRA_COMPONENT_DIRS=$PWD/components build

Diff for: CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@ set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support openssl b
210210

211211
idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires})
212212

213+
if(NOT CONFIG_FREERTOS_HZ EQUAL 1000 AND NOT "$ENV{ARDUINO_SKIP_TICK_CHECK}")
214+
# See delay() in cores/esp32/esp32-hal-misc.c.
215+
message(FATAL_ERROR "esp32-arduino requires CONFIG_FREERTOS_HZ=1000 "
216+
"(currently ${CONFIG_FREERTOS_HZ})")
217+
endif()
218+
213219
string(TOUPPER ${CONFIG_ARDUINO_VARIANT} idf_target_caps)
214220
target_compile_options(${COMPONENT_TARGET} PUBLIC
215221
-DARDUINO=10812

Diff for: docs/source/esp-idf_component.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ If you are writing code that does not require Arduino to compile and you want yo
140140
FreeRTOS Tick Rate (Hz)
141141
-----------------------
142142

143-
You might notice that Arduino-esp32's `delay()` function will only work in multiples of 10ms. That is because, by default, esp-idf handles task events 100 times per second.
144-
To fix that behavior, you need to set FreeRTOS tick rate to 1000Hz in `make menuconfig` -> `Component config` -> `FreeRTOS` -> `Tick rate`.
143+
The Arduino component requires the FreeRTOS tick rate `CONFIG_FREERTOS_HZ` set to 1000Hz in `make menuconfig` -> `Component config` -> `FreeRTOS` -> `Tick rate`.
145144

146145
Compilation Errors
147146
------------------

0 commit comments

Comments
 (0)