Buffer overflow when using NEWLIB_LIBC

Hi,

I have a GNSS based application, which parses NMEA sentences to a buffer and extracts information (latitude, longitude etc.).

Everything works fine until I enable CONFIG_NEWLIB_LIBC=y in my prj.conf

When it's enabled, I get the error * buffer overflow detected *

I'm assuming the issue is related to the increasing of the stack size requirements for the NEWLIB_LIBC. I've tried increasing the stack sizes in my prj.conf and increase the buffer size in my application, but neither work.

My error log is:

[00:00:05.312,255] <err> os: r0/a1:  0x00000003  r1/a2:  0x00000000  r2/a3:  0x00000001
[00:00:05.312,286] <err> os: r3/a4:  0x20003f4f r12/ip:  0x0000001a r14/lr:  0x00007ebd
[00:00:05.312,286] <err> os:  xpsr:  0x61000000
[00:00:05.312,316] <err> os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000
[00:00:05.312,316] <err> os: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
[00:00:05.312,347] <err> os: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000000
[00:00:05.312,347] <err> os: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0x00000000
[00:00:05.312,377] <err> os: fpscr:  0x00000000
[00:00:05.312,377] <err> os: Faulting instruction address (r15/pc): 0x000069b6
[00:00:05.312,438] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
[00:00:05.312,469] <err> os: Current thread: 0x20000d00 (unknown)
[00:00:06.536,590] <err> os: Halting system

My current prj.conf is:

CONFIG_REBOOT=y
CONFIG_RESET=y
CONFIG_RESET_ON_FATAL_ERROR=n


CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_NEWLIB_LIBC_FLOAT_SCANF=y
CONFIG_CBPRINTF_FP_SUPPORT=y

CONFIG_ADC=y
CONFIG_SENSOR=y

CONFIG_SPI=y

CONFIG_BOARD_ENABLE_DCDC=n
CONFIG_BOARD_ENABLE_DCDC_HV=n
CONFIG_UART_ASYNC_API=y

CONFIG_BOOT_BANNER=n

CONFIG_FPU=y
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_IDLE_STACK_SIZE=2048

CONFIG_LOG=y

Removing CONFIG_NEWLIB_LIBC=y, the application works, but I need the library for other parts of the application. Any help would be really appreciated.

Related