From a93b32999e6ed0657cc9d471e1537c921b11ce63 Mon Sep 17 00:00:00 2001 From: Hajime Fujimoto Date: Sat, 15 Nov 2025 17:07:44 +0900 Subject: [PATCH 1/2] loader: add symbols for Arduino_JSON library --- loader/llext_exports.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/loader/llext_exports.c b/loader/llext_exports.c index c9bbc142..af7c6f4f 100644 --- a/loader/llext_exports.c +++ b/loader/llext_exports.c @@ -17,6 +17,8 @@ EXPORT_SYMBOL(strstr); EXPORT_SYMBOL(strncmp); EXPORT_SYMBOL(strncpy); EXPORT_SYMBOL(strcasecmp); +EXPORT_SYMBOL(strtod); +EXPORT_SYMBOL(strtol); EXPORT_SYMBOL(strtoul); EXPORT_SYMBOL(strcmp); EXPORT_SYMBOL(strlen); @@ -232,6 +234,7 @@ EXPORT_SYMBOL(sprintf); EXPORT_SYMBOL(snprintf); EXPORT_SYMBOL(cbvprintf); FORCE_EXPORT_SYM(abort); +EXPORT_SYMBOL(sscanf); #if defined(CONFIG_RING_BUFFER) EXPORT_SYMBOL(ring_buf_get); @@ -274,6 +277,7 @@ FORCE_EXPORT_SYM(__aeabi_dcmpge); #if defined (CONFIG_CPP) FORCE_EXPORT_SYM(__cxa_pure_virtual); +FORCE_EXPORT_SYM(__assert_no_args); #endif #if defined(CONFIG_BOARD_ARDUINO_UNO_Q) From 7037c1d13400ed30455e2ad039d9f83e5114a8d8 Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Thu, 18 Dec 2025 17:57:42 +0100 Subject: [PATCH 2/2] loader: additional fixes for Arduino_JSON Minor fixes for Arduino_JSON library compatibility: - '__assert_no_args' and 'exit' are actually libc symbols, so the guards prevented their export in certain situations. - _exit, stdin, stdout, stderr symbols are also exported to cover the dynamic link case. - an 'undefined reference to _ctype_' error occurred because the libc is compiled with -Os, while the sketches are NOT - this creates an issue because the size optimization auto-selects a different version of ctype functions in picolibc. -D_PICOLIBC_CTYPE_SMALL=1 forces the small version to be used. Signed-off-by: Luca Burelli --- loader/llext_exports.c | 8 ++++++-- platform.txt | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/loader/llext_exports.c b/loader/llext_exports.c index af7c6f4f..62f10fbd 100644 --- a/loader/llext_exports.c +++ b/loader/llext_exports.c @@ -190,7 +190,6 @@ FORCE_EXPORT_SYM(close); FORCE_EXPORT_SYM(accept); FORCE_EXPORT_SYM(bind); FORCE_EXPORT_SYM(listen); -EXPORT_SYMBOL(exit); FORCE_EXPORT_SYM(inet_pton); FORCE_EXPORT_SYM(sendto); FORCE_EXPORT_SYM(recvfrom); @@ -235,6 +234,12 @@ EXPORT_SYMBOL(snprintf); EXPORT_SYMBOL(cbvprintf); FORCE_EXPORT_SYM(abort); EXPORT_SYMBOL(sscanf); +EXPORT_SYMBOL(exit); +FORCE_EXPORT_SYM(_exit); +FORCE_EXPORT_SYM(__assert_no_args); +EXPORT_SYMBOL(stdin); +EXPORT_SYMBOL(stdout); +EXPORT_SYMBOL(stderr); #if defined(CONFIG_RING_BUFFER) EXPORT_SYMBOL(ring_buf_get); @@ -277,7 +282,6 @@ FORCE_EXPORT_SYM(__aeabi_dcmpge); #if defined (CONFIG_CPP) FORCE_EXPORT_SYM(__cxa_pure_virtual); -FORCE_EXPORT_SYM(__assert_no_args); #endif #if defined(CONFIG_BOARD_ARDUINO_UNO_Q) diff --git a/platform.txt b/platform.txt index 888ee402..73d0705a 100644 --- a/platform.txt +++ b/platform.txt @@ -17,13 +17,13 @@ compiler.warning_flags.all=-Wall -Wextra compiler.path={build.compiler_path} compiler.c.cmd={build.crossprefix}gcc -compiler.c.flags=-g -c {compiler.warning_flags} {compiler.zephyr.macros} "@{compiler.zephyr.cflags_file}" -MMD -mcpu={build.mcu} {build.float-abi} {build.fpu} +compiler.c.flags=-g -c {compiler.define} {compiler.warning_flags} {compiler.zephyr.macros} "@{compiler.zephyr.cflags_file}" -MMD -mcpu={build.mcu} {build.float-abi} {build.fpu} compiler.c.elf.cmd={build.crossprefix}g++ compiler.c.elf.flags=-Wl,--gc-sections -mcpu={build.mcu} {build.float-abi} {build.fpu} -std=gnu++17 compiler.S.cmd={build.crossprefix}g++ compiler.S.flags=-c -x assembler-with-cpp -mcpu={build.mcu} {build.fpu} compiler.cpp.cmd={build.crossprefix}g++ -compiler.cpp.flags=-g -Os -std=gnu++17 -c {compiler.warning_flags} {compiler.zephyr.macros} "@{compiler.zephyr.cxxflags_file}" {compiler.zephyr.common_ldflags} {compiler.zephyr.extra_ldflags} {compiler.zephyr.common_cxxflags} {compiler.zephyr.extra_cxxflags} -MMD -mcpu={build.mcu} {build.float-abi} {build.fpu} +compiler.cpp.flags=-g -Os -std=gnu++17 -c {compiler.define} {compiler.warning_flags} {compiler.zephyr.macros} "@{compiler.zephyr.cxxflags_file}" {compiler.zephyr.common_ldflags} {compiler.zephyr.extra_ldflags} {compiler.zephyr.common_cxxflags} {compiler.zephyr.extra_cxxflags} -MMD -mcpu={build.mcu} {build.float-abi} {build.fpu} compiler.ar.cmd={build.crossprefix}ar compiler.ar.flags=rcs compiler.objcopy.cmd= @@ -34,7 +34,7 @@ compiler.elf2hex.cmd={build.crossprefix}objcopy compiler.ldflags= compiler.libraries.ldflags= compiler.size.cmd={build.crossprefix}size -compiler.define=-DARDUINO= +compiler.define=-D_PICOLIBC_CTYPE_SMALL=1 compiler.zephyr.includes_file={build.variant.path}/includes.txt compiler.zephyr.cflags_file={build.variant.path}/cflags.txt