-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Build: Build with newlib-nano c library #12735
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12735 +/- ##
==========================================
- Coverage 52.3% 52.26% -0.04%
==========================================
Files 307 307
Lines 45408 45408
Branches 10504 10504
==========================================
- Hits 23749 23733 -16
- Misses 16874 16886 +12
- Partials 4785 4789 +4
Continue to review full report at Codecov.
|
1d8fb14
to
8727fee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a test that makes sure that this does not regress.
8727fee
to
9ac775d
Compare
Do you want me to add a test to all /tests/kernel/directories ? |
CMakeLists.txt
Outdated
@@ -191,6 +191,12 @@ zephyr_ld_options( | |||
) | |||
endif() | |||
|
|||
if(CONFIG_NEWLIB_LIBC_NANO) | |||
zephyr_ld_options( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zephyr_ld_options will test and skip the flag if it is not supported.
In this situation, we don't want the users configuration to be silently ignored, so we should use 'zephyr_link_libraries' instead.
CMakeLists.txt
Outdated
@@ -191,6 +191,12 @@ zephyr_ld_options( | |||
) | |||
endif() | |||
|
|||
if(CONFIG_NEWLIB_LIBC_NANO) | |||
zephyr_ld_options( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation.
CMakeLists.txt
Outdated
zephyr_ld_options( | ||
-specs=nano.specs | ||
) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this into libc/libc/newlib/CMakeLists.txt
since nano depends on newlib.
tests/lib/mem_alloc/testcase.yaml
Outdated
libraries.libc.newlibnano: | ||
extra_args: CONF_FILE=prj_newlibnano.conf | ||
arch_whitelist: arm | ||
platform_exclude: qemu_x86_64 # No newlib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't the 'arm' whitelist prevent qemu_x86_64 from being run already?
No, what we have now is enough. |
tests/lib/mem_alloc/testcase.yaml
Outdated
@@ -8,3 +8,8 @@ tests: | |||
arch_exclude: posix | |||
platform_exclude: qemu_x86_64 # No newlib | |||
tags: clib newlib | |||
libraries.libc.newlibnano: | |||
extra_args: CONF_FILE=prj_newlibnano.conf | |||
arch_whitelist: arm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need a toolchain whitelist, I believe I observed that nano was not supported by the zephyr-sdk (but gnuarmemb does support it).
5f417e7
to
66d336d
Compare
-specs=nano.specs | ||
) | ||
endif() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want to pass that flag also for compiling using zephyr_compile_options
, so that the nano headers defined in the spec file are used instead of the default ones.
Note however that it is currently broken by PR #13538
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that " --specs=nano.specs" is only a linker option.
Please see Nano libraries usage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked at the documentation, but at the content of nano.specs
on my system
*cpp_unique_options:
-isystem /usr/include/newlib/nano %(nano_cpp_unique_options)
This adds a new system include path pointing to /usr/include/newlib/nano
. This directory contains a single file newlib.h
containing the newlib configuration. In the nano version a few options have been disabled. Some of those defines are used by other newlib headers changing the signature of some functions, so I believe this is something important to do.
Note however that the Zephyr SDK 0.10.0 provides a nano.specs
file, but the include path added by this file is not present. It looks like a packaging issue, I'll investigate and fill a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the "zephyr_compile_options" into the "CMakeLists.txt"
66d336d
to
65dfe24
Compare
All checks are passing now. Review history of this comment for details about previous failed status. |
80e5931
to
71cd6d2
Compare
Hello @SebastianBoe, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets only expose the Kconfig option on the ARM embedded toolchain for now.
fa4551a
to
8af608c
Compare
Add an option for building with newlib-nano library. The newlib-nano library for ARM embedded processors is a part of the GNU Tools for ARM Embedded Processors. Add mem_alloc tests with newlib nano. Signed-off-by: Benoit Leforestier <[email protected]>
Add codeowners for /test/lib Signed-off-by: Benoit Leforestier <[email protected]>
Add an option for building with newlib-nano library.
The newlib-nano library for ARM embedded processors is a part of the
GNU Tools for ARM Embedded Processors.