New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libraries.libc.newlib test fails #21167
Comments
Note that this issue will be relevant to the Zephyr SDK as well in the near future, as zephyrproject-rtos/sdk-ng#153 builds the normal newlib (
|
The problem is that the newlib full malloc implementation ( After increasing the heap size, this test passes. Nano malloc
Full malloc
|
NEWLIB_LIBC_NANO defaults to y when building with a toolchain that supports nano.specs and this was causing the libraries.libc.newlib test to link with the newlib nano variant (libc_nano.a) when it should be linking with the normal newlib (libc.a). By setting CONFIG_NEWLIB_LIBC_NANO=n in prj_newlib.conf, we make sure that the libraries.libc.newlib test links with the normal newlib. For more details, refer to the issue zephyrproject-rtos#21167. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
The newlib full malloc implementation (i.e. non-nano) requests a relatively large 4096-byte memory chunk through `_sbrk`, which exceeds the configured 512-byte heap size. This commit changes `CONFIG_NEWLIB_LIBC_ALIGNED_HEAP_SIZE` from 512 to 8192 in order to increase the size of the heap memory used by the newlib malloc function. For more details, refer to the issue zephyrproject-rtos#21167. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
NEWLIB_LIBC_NANO defaults to y when building with a toolchain that supports nano.specs and this was causing the libraries.libc.newlib test to link with the newlib nano variant (libc_nano.a) when it should be linking with the normal newlib (libc.a). By setting CONFIG_NEWLIB_LIBC_NANO=n in prj_newlib.conf, we make sure that the libraries.libc.newlib test links with the normal newlib. For more details, refer to the issue #21167. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
The newlib full malloc implementation (i.e. non-nano) requests a relatively large 4096-byte memory chunk through `_sbrk`, which exceeds the configured 512-byte heap size. This commit changes `CONFIG_NEWLIB_LIBC_ALIGNED_HEAP_SIZE` from 512 to 8192 in order to increase the size of the heap memory used by the newlib malloc function. For more details, refer to the issue #21167. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Describe the bug
tests/lib/mem_alloc/libraries.libc.newlib
test fails when actually building with the newlib.NEWLIB_LIBC_NANO
config defaults to y (when building with the GNU ARM Embedded toolchain) andprj_newlib.conf
does not setNEWLIB_LIBC_NANO=n
, so thelibraries.libc.newlib
test was linking with the newlib nano variant (libc_nano.a
) instead of the normal variant (libc.a
), meaninglibraries.libc.newlib
test was never actually tested using the non-nano newlib until now (this in itself needs to be fixed).zephyr/lib/libc/Kconfig
Lines 43 to 51 in 240d519
To Reproduce
Steps to reproduce the behavior:
CONFIG_NEWLIB_LIBC_NANO=n
totests/lib/mem_alloc/prj_newlib.conf
.cd tests/lib/mem_alloc
mkdir build; cd build
cmake -DBOARD=mps2_an385 -DCONF_FILE=prj_newlib.conf ..
make run
Screenshots or console output
Environment (please complete the following information):
Additional context
mps2_an385
board. It also fails in the same manner using a physicalsam_e70_xplained
board.MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT=n
(e.g.qemu_cortex_m3
) becauseNEWLIB_LIBC_ALIGNED_HEAP_SIZE
gets ignored.zephyr/lib/libc/Kconfig
Lines 53 to 56 in 39f2281
--enable-newlib-nano-malloc
.This issue might have something to do with what is being done here:
zephyr/lib/libc/newlib/libc-hooks.c
Lines 23 to 30 in 240d519
The text was updated successfully, but these errors were encountered: