Skip to content

Commit

Permalink
DNM: Switch Matter samples to picolibc
Browse files Browse the repository at this point in the history
Signed-off-by: Damian Krolik <[email protected]>
  • Loading branch information
Damian-Nordic committed Feb 13, 2025
1 parent 9dc37b1 commit 33ce7f9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions config/nrfconnect/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ else()
set(DATA_MODEL_INTERFACE "disabled")
endif()

# Force libstdc++_nano

set_linker_property(PROPERTY c++_library "-lstdc++_nano")

# ==============================================================================
# Generate configuration for CHIP GN build system
# ==============================================================================
Expand Down
5 changes: 4 additions & 1 deletion config/nrfconnect/chip-module/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ if CHIP
# ==============================================================================

choice LIBC_IMPLEMENTATION
default NEWLIB_LIBC
default PICOLIBC
endchoice

config NEWLIB_LIBC_NANO
default n

config ASSERT
default y

Expand Down
1 change: 0 additions & 1 deletion config/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ menuconfig CHIP
select CPP
imply REQUIRES_FULL_LIBCPP
imply REQUIRES_FULL_LIBC
imply NEWLIB_LIBC_NANO
imply CBPRINTF_LIBC_SUBSTS
imply POSIX_API if !ARCH_POSIX && !CHIP_NRF_PLATFORM
imply EVENTFD if !ARCH_POSIX
Expand Down
2 changes: 2 additions & 0 deletions src/platform/Zephyr/SysHeapMalloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ EXTERNALLY_VISIBLE void * WRAP(calloc)(size_t num, size_t size) ALIAS("_ZN4chip1
EXTERNALLY_VISIBLE void * WRAP(realloc)(void * mem, size_t size) ALIAS("_ZN4chip11DeviceLayer6Malloc7ReallocEPvj");
EXTERNALLY_VISIBLE void WRAP(free)(void * mem) ALIAS("_ZN4chip11DeviceLayer6Malloc4FreeEPv");

#ifdef CONFIG_NEWLIB_LIBC
EXTERNALLY_VISIBLE void * WRAP(_malloc_r)(_reent *, size_t size)
{
return WRAP(malloc)(size);
Expand All @@ -203,6 +204,7 @@ EXTERNALLY_VISIBLE void WRAP(_free_r)(_reent *, void * mem)
{
WRAP(free)(mem);
}
#endif // CONFIG_NEWLIB_LIBC

} // extern "C"

Expand Down

0 comments on commit 33ce7f9

Please sign in to comment.