PelionIoT / mbed-coap

CoAP C library - Builder and Parser for CoAP messages
Apache License 2.0
29 stars 16 forks source link

Mem opt part 3 final #87

Closed TeroJaasko closed 5 years ago

TeroJaasko commented 5 years ago

This is a further improved and rebased version of https://github.com/ARMmbed/mbed-coap/pull/34 and https://github.com/ARMmbed/mbed-coap/pull/83. Aim is to reduce flash usage, but while doing that, the dynamic usage is a also now a bit smaller due to combined structures.

There are no known build or functional breakages with the users (MCC & Thread stack), this passed also the Thread test CI a few weeks ago.

Flash savings with default configuration on MCC example.

ARMC5:

| mbed-coap/source/sn_coap_builder.o      |    1986(-168) |    0(+0) |     0(+0) |
| mbed-coap/source/sn_coap_header_check.o |       142(+0) |    0(+0) |     0(+0) |
| mbed-coap/source/sn_coap_parser.o       |     1678(-32) |    0(+0) |     0(+0) |
| mbed-coap/source/sn_coap_protocol.o     |    5106(-872) |    2(+0) |     0(+0) |

-1072 bytes

GCC 6.3:

| mbed-coap/source/sn_coap_builder.o      |    2074(-114) |    0(+0) |     0(+0) |
| mbed-coap/source/sn_coap_header_check.o |        84(+0) |    0(+0) |     0(+0) |
| mbed-coap/source/sn_coap_parser.o       |     1664(-32) |    0(+0) |     0(+0) |
| mbed-coap/source/sn_coap_protocol.o     |    5314(-962) |    0(+0) |     2(+0) |

-1108 bytes

Further savings are possible on MCC by disabling unused code by setting SN_COAP_BLOCKWISE_INTERNAL_BLOCK_2_HANDLING_ENABLED=0

ARMC5:

| mbed-coap/source/sn_coap_builder.o      |     1986(+0) |    0(+0) |      0(+0) |
| mbed-coap/source/sn_coap_header_check.o |      142(+0) |    0(+0) |      0(+0) |
| mbed-coap/source/sn_coap_parser.o       |     1678(+0) |    0(+0) |      0(+0) |
| mbed-coap/source/sn_coap_protocol.o     |   4798(-308) |    2(+0) |      0(+0) |

-308 bytes

GCC 6.3:

| mbed-coap/source/sn_coap_builder.o      |     2074(+0) |    0(+0) |     0(+0) |
| mbed-coap/source/sn_coap_header_check.o |       84(+0) |    0(+0) |     0(+0) |
| mbed-coap/source/sn_coap_parser.o       |     1664(+0) |    0(+0) |     0(+0) |
| mbed-coap/source/sn_coap_protocol.o     |   4950(-364) |    0(+0) |     2(+0) |

-364 bytes

TeroJaasko commented 5 years ago

TestMds

anttiylitokola commented 5 years ago

@TeroJaasko Did the MDS run pass, I can't see results anywhere?

TeroJaasko commented 5 years ago

TestMds