Compile error if CONFIG_FREERTOS_HZ != 1000 (#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
This commit is contained in:
Daniel Egnor 2022-08-26 01:14:59 -07:00 committed by GitHub
parent d22bcb765b
commit adb01cf0c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View file

@ -104,4 +104,5 @@ jobs:
run: | run: |
. ${IDF_PATH}/export.sh . ${IDF_PATH}/export.sh
idf.py create-project test idf.py create-project test
echo CONFIG_FREERTOS_HZ=1000 > test/sdkconfig.defaults
idf.py -C test -DEXTRA_COMPONENT_DIRS=$PWD/components build idf.py -C test -DEXTRA_COMPONENT_DIRS=$PWD/components build

View file

@ -210,6 +210,12 @@ set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support openssl b
idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires}) idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires})
if(NOT CONFIG_FREERTOS_HZ EQUAL 1000 AND NOT "$ENV{ARDUINO_SKIP_TICK_CHECK}")
# See delay() in cores/esp32/esp32-hal-misc.c.
message(FATAL_ERROR "esp32-arduino requires CONFIG_FREERTOS_HZ=1000 "
"(currently ${CONFIG_FREERTOS_HZ})")
endif()
string(TOUPPER ${CONFIG_ARDUINO_VARIANT} idf_target_caps) string(TOUPPER ${CONFIG_ARDUINO_VARIANT} idf_target_caps)
target_compile_options(${COMPONENT_TARGET} PUBLIC target_compile_options(${COMPONENT_TARGET} PUBLIC
-DARDUINO=10812 -DARDUINO=10812

View file

@ -140,8 +140,7 @@ If you are writing code that does not require Arduino to compile and you want yo
FreeRTOS Tick Rate (Hz) FreeRTOS Tick Rate (Hz)
----------------------- -----------------------
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. The Arduino component requires the FreeRTOS tick rate `CONFIG_FREERTOS_HZ` set to 1000Hz in `make menuconfig` -> `Component config` -> `FreeRTOS` -> `Tick rate`.
To fix that behavior, you need to set FreeRTOS tick rate to 1000Hz in `make menuconfig` -> `Component config` -> `FreeRTOS` -> `Tick rate`.
Compilation Errors Compilation Errors
------------------ ------------------