RFC: Replace TinyCBOR with ZCBOR within Zephyr

Ermel, Dominik



I have logged proposal (https://github.com/zephyrproject-rtos/zephyr/issues/40591) for replacement of TinyCBOR in Zephyr source tree with zcbor.

Currently there is only one in-tree user of the TinyCBOR: mcumgr for the SMP implementation.

The mcuboot and tfm are already using zcbor for the SMP (tfm also uses QSBOR for some other things).

The TinyCBOR we have is not actually the Intel TinyCBOR implementation, but variant extracted from the internal code of Mynewt
(https://github.com/apache/mynewt-core/tree/master/encoding/tinycbor), which itself Is older Intel TinyCBOR that has been imported

into the core of Mynewt and become internal code.
Because mcumgr SMP has been written to relay on this significantly modified TinyCBOR implementation we could not directly move

to using Intel TinyCBOR; additionally TinyCBOR itself is quite flash heavy and zcbor is better in this matter.
zcbor has some API compatibility with TinyCBOR and transition should not be that painful: such transition has already been done in mcuboot as proof of concept.

zcbor also allows to describe CBOR data in CDDL language and generate CBOR stream parsing code automatically, to some extent.

Because zcbor is already used in mcuboot’s SMP implementation, and mcuboot is Zephyr application, this means that we are actually using two implementations

of CBOR library in Zephyr (three if we count QCBOR in tfm).


My proposal is to replace TinyCBOR within mcumgr SMP implementation with zcbor and remove TinyCBOR from modules – this move would

reduce number of CBOR implementations we use for SMP to one.


Best regards,

Dominik Ermel

Dominik ERMEL | Senior Software Engineer
Kraków, Poland
nordicsemi.com | devzone.nordicsemi.com