Skip to content
Permalink
Browse files

Build: Build with newlib-nano c library

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 <benoit.leforestier@gmail.com>
  • Loading branch information...
Benichou34 authored and galak committed Jan 25, 2019
1 parent 6357558 commit 472ea92e79e346ad390ebbfc1ff27a5776f4fa25
Showing with 28 additions and 0 deletions.
  1. +10 −0 lib/libc/Kconfig
  2. +10 −0 lib/libc/newlib/CMakeLists.txt
  3. +4 −0 tests/lib/mem_alloc/prj_newlibnano.conf
  4. +4 −0 tests/lib/mem_alloc/testcase.yaml
@@ -16,6 +16,16 @@ config NEWLIB_LIBC
Build with newlib library. The newlib library is expected to be
part of the SDK in this case.

if "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "gnuarmemb"
config NEWLIB_LIBC_NANO
bool "Build with newlib-nano c library"
depends on NEWLIB_LIBC
help
Build with newlib-nano library, for small embedded apps.
The newlib-nano library for ARM embedded processors is a part of the
GNU Tools for ARM Embedded Processors.
endif

config NEWLIB_LIBC_ALIGNED_HEAP_SIZE
int "Newlib aligned heap size"
depends on MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT
@@ -33,3 +33,13 @@ zephyr_link_libraries(
$<$<BOOL:${CONFIG_NEWLIB_LIBC_FLOAT_SCANF}>:-u_scanf_float>
gcc # Lib C depends on libgcc. e.g. libc.a(lib_a-fvwrite.o) references __aeabi_idiv
)

if(CONFIG_NEWLIB_LIBC_NANO)
zephyr_link_libraries(
-specs=nano.specs
)
zephyr_compile_options(
-specs=nano.specs
)
endif()

@@ -0,0 +1,4 @@
CONFIG_ZTEST=y
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_NANO=y
CONFIG_MAIN_STACK_SIZE=1024
@@ -8,3 +8,7 @@ tests:
arch_exclude: posix
filter: TOOLCHAIN_HAS_NEWLIB == 1
tags: clib newlib userspace
libraries.libc.newlibnano:
extra_args: CONF_FILE=prj_newlibnano.conf
toolchain_whitelist: gnuarmemb
tags: clib newlib userspace

0 comments on commit 472ea92

Please sign in to comment.
You can’t perform that action at this time.