How to fix static assertion failed: "Retargetable locking must be enabled" and warnings in newlib #54889
Unanswered
VineetaNarkhede-eaton
asked this question in
Q&A
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am migrating to zephyr 3.2.0 from zephyr 3.1.0. Compiling custom watchdog code on ESP32.
Getting assert failure and warnings in newlib
Error:
C:/Workspace/edgertos_zephyr/zephyr-v3.2.0/zephyr/include/zephyr/toolchain/gcc.h:77:36: error: static assertion failed: "Retargetable locking must be enabled" #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG) ^~~~~~~~~~~~~~ C:/Workspace/edgertos_zephyr/zephyr-v3.2.0/zephyr/lib/libc/newlib/libc-hooks.c:310:1: note: in expansion of macro 'BUILD_ASSERT' BUILD_ASSERT(IS_ENABLED(_RETARGETABLE_LOCKING), "Retargetable locking must be enabled"); ^~~~~~~~~~~~
warnings:
C:/Workspace/edgertos_zephyr/zephyr-v3.2.0/zephyr/lib/libc/newlib/libc-hooks.c: In function '__retarget_lock_init': C:/Workspace/edgertos_zephyr/zephyr-v3.2.0/zephyr/lib/libc/newlib/libc-hooks.c:367:8: warning: assignment to '_LOCK_T' {aka 'int'} from 'void *' makes integer from pointer without a cast [-Wint-conversion] *lock = malloc(sizeof(struct k_sem)); ^ C:/Workspace/edgertos_zephyr/zephyr-v3.2.0/zephyr/lib/libc/newlib/libc-hooks.c: In function '__retarget_lock_init_recursive': C:/Workspace/edgertos_zephyr/zephyr-v3.2.0/zephyr/lib/libc/newlib/libc-hooks.c:383:8: warning: assignment to '_LOCK_T' {aka 'int'} from 'void *' makes integer from pointer without a cast [-Wint-conversion] *lock = malloc(sizeof(struct k_mutex)); ^ C:/Workspace/edgertos_zephyr/zephyr-v3.2.0/zephyr/lib/libc/newlib/libc-hooks.c: In function '__retarget_lock_close': C:/Workspace/edgertos_zephyr/zephyr-v3.2.0/zephyr/lib/libc/newlib/libc-hooks.c:397:7: warning: passing argument 1 of 'free' makes pointer from integer without a cast [-Wint-conversion] In file included from C:/Workspace/edgertos_zephyr/zephyr-v3.2.0/zephyr/lib/libc/newlib/libc-hooks.c:10: c:\users\e0511444\.espressif\tools\zephyr\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\malloc.h:45:19: note: expected 'void *' but argument is of type '_LOCK_T' {aka 'int'} C:/Workspace/edgertos_zephyr/zephyr-v3.2.0/zephyr/lib/libc/newlib/libc-hooks.c: In function '__retarget_lock_close_recursive': C:/Workspace/edgertos_zephyr/zephyr-v3.2.0/zephyr/lib/libc/newlib/libc-hooks.c:408:7: warning: passing argument 1 of 'free' makes pointer from integer without a cast [-Wint-conversion] In file included from C:/Workspace/edgertos_zephyr/zephyr-v3.2.0/zephyr/lib/libc/newlib/libc-hooks.c:10: c:\users\e0511444\.espressif\tools\zephyr\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\malloc.h:45:19: note: expected 'void *' but argument is of type '_LOCK_T' {aka 'int'} extern void free (void *);
I tried to update esp32 toolchain through west espressif install and update but these commands are not working in zephyr 3.2.0. getting below error,
usage: west espressif [-h] [-b BAUD] [-p PORT] [-e ELF] {monitor} west espressif: error: argument command: invalid choice: 'install' (choose from 'monitor')
It's not working even after running west update successfully.
I ran install.bat from "\zephyr-v3.2.0\modules\hal\espressif", but running into other errors.
west espressif install and update working partially in zephyr 3.1.0, it is installing only openocd-esp32, I somehow managed to get other tools as shown below

Environment :
OS: Windows
Toolchain Zephyr SDK 0.15.2 , espressif : esp-2020r3-8.4.0 (C:\Users<username>.espressif\tools\zephyr)
Zephyr version: 3.2.0
Please suggest the solution for above error and warnings
Beta Was this translation helpful? Give feedback.
All reactions