Skip to content

Commit 2b371db

Browse files
committed
DNM: Switch Matter samples to picolibc
Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
1 parent cb40b0d commit 2b371db

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

config/nrfconnect/chip-module/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ else()
125125
set(DATA_MODEL_INTERFACE "disabled")
126126
endif()
127127

128+
# Force libstdc++_nano
129+
130+
set_linker_property(PROPERTY c++_library "-lstdc++_nano")
131+
128132
# ==============================================================================
129133
# Generate configuration for CHIP GN build system
130134
# ==============================================================================

config/nrfconnect/chip-module/Kconfig.defaults

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ if CHIP
2525
# ==============================================================================
2626

2727
choice LIBC_IMPLEMENTATION
28-
default NEWLIB_LIBC
28+
default PICOLIBC
2929
endchoice
3030

31+
config NEWLIB_LIBC_NANO
32+
default n
33+
3134
config ASSERT
3235
default y
3336

config/zephyr/Kconfig

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ menuconfig CHIP
2929
select CPP
3030
imply REQUIRES_FULL_LIBCPP
3131
imply REQUIRES_FULL_LIBC
32-
imply NEWLIB_LIBC_NANO
3332
imply CBPRINTF_LIBC_SUBSTS
3433
imply POSIX_API if !ARCH_POSIX && !CHIP_NRF_PLATFORM
3534
imply EVENTFD if !ARCH_POSIX

src/platform/Zephyr/SysHeapMalloc.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ EXTERNALLY_VISIBLE void * WRAP(calloc)(size_t num, size_t size) ALIAS("_ZN4chip1
184184
EXTERNALLY_VISIBLE void * WRAP(realloc)(void * mem, size_t size) ALIAS("_ZN4chip11DeviceLayer6Malloc7ReallocEPvj");
185185
EXTERNALLY_VISIBLE void WRAP(free)(void * mem) ALIAS("_ZN4chip11DeviceLayer6Malloc4FreeEPv");
186186

187+
#ifdef CONFIG_NEWLIB_LIBC
187188
EXTERNALLY_VISIBLE void * WRAP(_malloc_r)(_reent *, size_t size)
188189
{
189190
return WRAP(malloc)(size);
@@ -203,6 +204,7 @@ EXTERNALLY_VISIBLE void WRAP(_free_r)(_reent *, void * mem)
203204
{
204205
WRAP(free)(mem);
205206
}
207+
#endif // CONFIG_NEWLIB_LIBC
206208

207209
} // extern "C"
208210

0 commit comments

Comments
 (0)