Code size analysis#

pw_hdlc: Simple, robust, and efficient serial communication

pw_hdlc currently optimizes for robustness and flexibility instead of binary size or performance.

The HDLC encode and decode size report shows the cost of everything needed to use pw_hdlc, including the dependencies on common modules like CRC32 from pw_checksum and variable-length integer handling from pw_varint.

The HDLC encode and decode, ignoring CRC and varint size report shows the cost of pw_hdlc if your application is already linking CRC32 and variable-length integer handling. pw_varint is commonly used since it’s necessary for protocol buffer handling, so it’s often already present.

Label

Segment

Delta

HDLC encode and decode

FLASH

+24

__aeabi_dmul

+64

pw::size_report::HdlcSizeReport()

-2

pw::tokenizer::EncodedMessage<>::EncodedMessage()

+20

pw::stream::Stream::Write()

+4

p05.0

NEW

+1,024

_pw_checksum_InternalCrc32EightBit::kCrc32Table

NEW

+200

pw::hdlc::Decoder::Process()

NEW

+138

pw_varint_DecodeCustom

NEW

+130

std::__find_if<>()

NEW

+96

pw::hdlc::Encoder::WriteData()

NEW

+96

pw::hdlc::Frame::Parse()

NEW

+88

pw::hdlc::WriteUIFrame()

NEW

+88

pw_varint_EncodeCustom

NEW

+76

pw::hdlc::Decoder::CheckFrame()

NEW

+76

pw::hdlc::Encoder::StartFrame()

NEW

+66

pw::hdlc::Decoder::AppendByte()

NEW

+60

pw::hdlc::MaxEncodedFrameSize()

NEW

+46

pw::hdlc::Decoder::VerifyFrameCheckSequence()

NEW

+40

pw::hdlc::EscapeAndWrite()

NEW

+36

_pw_checksum_InternalCrc32EightBit

NEW

+36

pw::checksum::Crc32Impl<>::Update()

NEW

+36

pw::span<>::subspan()

NEW

+34

pw::hdlc::Encoder::FinishFrame()

NEW

+30

pw::hdlc::EscapedSize()

NEW

+24

pw_assert_tokenized_HandleCheckFailure

NEW

+20

pw::span<>::first()

NEW

+20

pw::varint::Encode()

NEW

+18

pw::span<>::operator[]()

NEW

+16

pw::varint::Decode()

NEW

+14

_ZN2pw15internal_result12StatusOrDataINS_4hdlc5FrameELb1EEC2INS_6StatusETnNSt9enable_ifIXsr3std16is_constructibleIS6_OT_EE5valueEiE4typeELi0EEES9_

NEW

+14

pw::hdlc::NeedsEscaping()

NEW

+12

pw::hdlc::Encoder::StartUnnumberedFrame()

NEW

+2

pw::hdlc::kEscapedEscape

NEW

+2

pw::hdlc::kEscapedFlag

+2,648

HDLC encode and decode, ignoring CRC and varint

FLASH

+4

quorem

+64

pw::size_report::HdlcSizeReport()

+18

pw::checksum::Crc32Impl<>::Update()

+20

pw::stream::Stream::Write()

+4

p05.0

+16

pw::varint::Decode()

NEW

+200

pw::hdlc::Decoder::Process()

NEW

+138

pw_varint_DecodeCustom

NEW

+130

std::__find_if<>()

NEW

+96

pw::hdlc::Encoder::WriteData()

NEW

+96

pw::hdlc::Frame::Parse()

NEW

+88

pw::hdlc::WriteUIFrame()

NEW

+88

pw_varint_EncodeCustom

NEW

+76

pw::hdlc::Decoder::CheckFrame()

NEW

+76

pw::hdlc::Encoder::StartFrame()

NEW

+66

pw::hdlc::Decoder::AppendByte()

NEW

+60

pw::hdlc::MaxEncodedFrameSize()

NEW

+46

pw::hdlc::Decoder::VerifyFrameCheckSequence()

NEW

+40

pw::hdlc::EscapeAndWrite()

NEW

+34

pw::hdlc::Encoder::FinishFrame()

NEW

+34

pw::span<>::subspan()

NEW

+30

pw::hdlc::EscapedSize()

NEW

+24

pw_assert_tokenized_HandleCheckFailure

NEW

+20

pw::span<>::first()

NEW

+20

pw::varint::Encode()

NEW

+18

pw::span<>::operator[]()

NEW

+16

_ZN2pw15internal_result12StatusOrDataINS_4hdlc5FrameELb1EEC2INS_6StatusETnNSt9enable_ifIXsr3std16is_constructibleIS6_OT_EE5valueEiE4typeELi0EEES9_

NEW

+14

pw::hdlc::NeedsEscaping()

NEW

+12

pw::hdlc::Encoder::StartUnnumberedFrame()

NEW

+2

pw::hdlc::kEscapedEscape

NEW

+2

pw::hdlc::kEscapedFlag

+1,552

More pw_hdlc docs#

Get started & guides

How to set up and use pw_hdlc

API reference

Reference details about the pw_hdlc API

Design

Design details about pw_hdlc

Code size analysis

The code size impact of pw_hdlc

RPC over HDLC example

A step-by-step example of sending RPCs over HDLC

Experimental async router

An experimental asynchronous HDLC router using pw_channel