zephyr/lib/utils/Kconfig
Christoph Winklhofer fc37c02eb1 json: improve parsing and serializing of 'float' and 'double'
Up to now, the handling of type float was offloaded to the users of the
JSON utility, with the token JSON_TOK_FLOAT.

Improve handling of floating point types and support the types 'float'
and 'double' in a built-in way so that they can be directly parsed to
and serialized from variables (of type float or double).

The types are serialized in the shortest representation, either as a
decimal number or in scientific notation:
  * float (with JSON_TOK_FLOAT_FP): encoded with maximal 9 digits
  * double (with JSON_TOK_DOUBLE_FP): encoded with maximal 16 digits
  * NaN, Infinity, -Infinity: encoded and decoded as:
    {"nan_val":NaN,"inf_pos":Infinity,"inf_neg":-Infinity}

Enable the floating point functionality with the Kconfig option:
  JSON_LIBRARY_FP_SUPPORT=y

It requires a libc implementation with support for floating point
functions: strtof(), strtod(), isnan() and isinf().

Fixes: #59412
Signed-off-by: Christoph Winklhofer <cj.winklhofer@gmail.com>
2025-04-09 22:05:14 +02:00

85 lines
2.4 KiB
Plaintext

# Copyright (c) 2016 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
menu "Utility Library"
config JSON_LIBRARY
bool "Build JSON library"
help
Build a minimal JSON parsing/encoding library. Used by sample
applications such as the NATS client.
config JSON_LIBRARY_FP_SUPPORT
bool "Floating point support in JSON library"
depends on JSON_LIBRARY
select CBPRINTF_FP_SUPPORT
select REQUIRES_FULL_LIBC
help
Build the JSON library with support for floating point types.
Requires a libc implementation with support for floating point
functions: strtof(), strtod(), isnan() and isinf().
config RING_BUFFER
bool "Ring buffers"
help
Provide highly efficient ring buffer management for arbitrary data.
Some facilities such as kernel pipes are built on top of this.
May be used directly e.g. when the pipe overhead is unnecessary.
config RING_BUFFER_LARGE
bool "Allow large ring buffer sizes"
depends on RING_BUFFER
help
Increase maximum buffer size from 32KB to 2GB. When this is enabled,
all struct ring_buf instances become 12 bytes bigger.
config NOTIFY
bool "Asynchronous Notifications"
help
Use this API to support async transactions.
config BASE64
bool "Base64 encoding and decoding"
help
Enable base64 encoding and decoding functionality
config ONOFF
bool "On-Off Manager"
select NOTIFY
help
An on-off manager supports an arbitrary number of clients of a
service which has a binary state. Example applications are power
rails, clocks, and binary device power management.
config WINSTREAM
bool "Lockless shared memory window byte stream"
help
Winstream is a byte stream IPC for use in shared memory
"windows", generally for transmit to non-Zephyr contexts that
can't share Zephyr APIs or data structures.
if WINSTREAM
config WINSTREAM_STDLIB_MEMCOPY
bool "Use standard memcpy() in winstream"
help
The sys_winstream utility is sometimes used in early boot
environments before the standard library is usable. By
default it uses a simple internal bytewise memcpy(). Set
this to use the one from the standard library.
endif
config UTF8
bool "UTF-8 string operation supported"
help
Enable the utf8 API. The API implements functions to specifically
handle UTF-8 encoded strings.
config COBS
bool "Consistent overhead byte stuffing"
select NET_BUF
help
Enable consistent overhead byte stuffing
endmenu