Skip to content

Conversation

@stephanosio
Copy link
Member

@stephanosio stephanosio commented Dec 4, 2019

tests: lib: mem_alloc: Fix incorrect newlib variant usage

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 <[email protected]>
tests: lib: mem_alloc: Increase malloc heap size for newlib test

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 <[email protected]>

Closes #21167

@stephanosio stephanosio requested a review from nashif as a code owner December 4, 2019 08:41
@zephyrbot zephyrbot added the area: Tests Issues related to a particular existing or missing test label Dec 4, 2019
@stephanosio
Copy link
Member Author

stephanosio commented Dec 4, 2019

NOTE: This PR only fixes the incorrect test runtime library linkage issue. The actual test failure for libraries.libc.newlib when linking with the non-nano newlib needs to be addressed separately (see #21167).

@stephanosio
Copy link
Member Author

stephanosio commented Dec 4, 2019

NOTE: This issue will apply to the Zephyr SDK as well in the near future (see #21098).

@stephanosio stephanosio added the DNM This PR should not be merged (Do Not Merge) label Dec 4, 2019
@stephanosio stephanosio added this to the v2.2.0 milestone Dec 9, 2019
@stephanosio stephanosio added the bug The issue is a bug, or the PR is fixing a bug label Feb 12, 2020
@galak galak modified the milestones: v2.2.0, v2.3.0 Feb 12, 2020
@stephanosio stephanosio modified the milestones: v2.3.0, v2.2.0 Feb 13, 2020
@stephanosio stephanosio removed the DNM This PR should not be merged (Do Not Merge) label Feb 13, 2020
@stephanosio
Copy link
Member Author

stephanosio commented Feb 13, 2020

The newlib test failure issue has been addressed. This PR can now be merged.

@galak
Copy link
Contributor

galak commented Feb 13, 2020

Under what conditions is this failing? we aren't seeing any issues in CI w/sanitycheck on the qemu platforms.

Copy link
Contributor

@galak galak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking this 'request for change' while we figure out when this failure is triggered.

@stephanosio
Copy link
Member Author

stephanosio commented Feb 13, 2020

Under what conditions is this failing? we aren't seeing any issues in CI w/sanitycheck on the qemu platforms.

@galak It was failing until I added the commit "tests: lib: mem_alloc: Increase malloc heap size for newlib test".

Try running the test with only "tests: lib: mem_alloc: Fix incorrect newlib variant usage" and you will see the failure reported in #21167.

@stephanosio
Copy link
Member Author

@galak #21167 (comment)

@stephanosio stephanosio requested a review from galak February 13, 2020 11:01
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 <[email protected]>
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 <[email protected]>
@galak galak merged commit ecfd787 into zephyrproject-rtos:master Feb 14, 2020
@stephanosio stephanosio deleted the fix_newlib_tests branch April 23, 2020 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Memory Management area: Tests Issues related to a particular existing or missing test bug The issue is a bug, or the PR is fixing a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

libraries.libc.newlib test fails

5 participants