Skip to content

Commit d57e9bd

Browse files
committed
ext: lib: tinycbor: Add req Zephyr specific files
Include both build an configuration files required to build TinyCBOR with Zephyr. Signed-off-by: Vipul Rahane <[email protected]>
1 parent 717ad15 commit d57e9bd

File tree

5 files changed

+129
-1
lines changed

5 files changed

+129
-1
lines changed

ext/lib/encoding/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory_if_kconfig(tinycbor)

ext/lib/encoding/Kconfig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
menu "Encoding"
21+
22+
source "ext/lib/encoding/tinycbor/Kconfig"
23+
24+
endmenu
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
zephyr_interface_library_named(TINYCBOR)
2+
3+
target_include_directories(TINYCBOR INTERFACE src)
4+
5+
zephyr_library()
6+
zephyr_library_sources(
7+
src/cbor_buf_reader.c
8+
src/cbor_buf_writer.c
9+
src/cborencoder.c
10+
src/cborerrorstrings.c
11+
src/cborparser.c
12+
)
13+
zephyr_library_sources_ifdef(CONFIG_NEWLIB_LIBC src/cborparser_dup_string.c)
14+
15+
zephyr_library_link_libraries(TINYCBOR)
16+
target_link_libraries(TINYCBOR INTERFACE zephyr_interface)

ext/lib/encoding/tinycbor/Kconfig

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
config TINYCBOR
21+
bool
22+
prompt "tinyCBOR Support"
23+
default n
24+
help
25+
This option enables the tinyCBOR library.
26+
27+
if TINYCBOR
28+
29+
config CBOR_NO_DFLT_WRITER
30+
bool
31+
prompt "No default writer support"
32+
default n
33+
help
34+
This option specifies whether a default writer exists.
35+
36+
config CBOR_NO_DFLT_READER
37+
bool
38+
prompt "No default reader support"
39+
default n
40+
help
41+
This option specifies whether a default reader exists.
42+
43+
config CBOR_ENCODER_NO_CHECK_USER
44+
bool
45+
prompt "No encoder checks for user args for validity"
46+
default n
47+
help
48+
This option specifies whether a check user exists for a cbor encoder.
49+
50+
config CBOR_PARSER_MAX_RECURSIONS
51+
int
52+
prompt "Parser max recursions"
53+
default 1024
54+
help
55+
This option specifies max recursions for the parser.
56+
57+
config CBOR_PARSER_NO_STRICT_CHECKS
58+
bool
59+
prompt "No strict parser checks"
60+
default n
61+
help
62+
This option enables the strict parser checks.
63+
64+
config CBOR_NO_FLOATING_POINT
65+
bool
66+
select NEWLIB_LIBC
67+
prompt "No Floating point support"
68+
default y
69+
help
70+
This option enables floating point support.
71+
72+
config CBOR_NO_HALF_FLOAT_TYPE
73+
bool
74+
select NEWLIB_LIBC
75+
prompt "No Half float type support"
76+
default y
77+
help
78+
This option enables half float type support.
79+
80+
config CBOR_WITHOUT_OPEN_MEMSTREAM
81+
bool
82+
prompt "Without open memstream"
83+
default y
84+
help
85+
This option enables open memstream support.
86+
87+
endif #TINYCBOR

ext/lib/encoding/tinycbor/src/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
/** This option enables floating point support **/
4949
#ifdef CONFIG_CBOR_NO_FLOATING_POINT
50-
#define CBOR_NO_FLOATINGPOINT CONFIG_CBOR_NO_FLOATING_POINT
50+
#define CBOR_NO_FLOATING_POINT CONFIG_CBOR_NO_FLOATING_POINT
5151
#endif
5252

5353
/** This option enables half float type support **/

0 commit comments

Comments
 (0)