Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Zephyr] Support heap watermark for non-default malloc #19385

Merged
merged 2 commits into from
Jun 9, 2022

Conversation

Damian-Nordic
Copy link
Contributor

Problem

Zephyr platform doesn't support Heap Watermark feature because the default newlib libc malloc doesn't provide such statistic. However, the feature can be supported if non-default malloc is used.

Change overview

When non-default malloc implementation, based on Zephyr's sys_heap is used, support CurrentHeapHighWatermark attribute
and ResetWatermarks command.

Testing

Verified that both the attribute and command work properly when nRF Connect all-clusters-app is built with -DCONFIG_CHIP_MALLOC_SYS_HEAP=y. Also, verified that FeatureMap is initialized correctly in that case.

When non-default malloc implementation, based on Zephyr's
sys_heap is used, support CurrentHeapHighWatermark attribute
and ResetWatermarks command. This is because sys_heap
exposes max_allocated_bytes statistic.

Signed-off-by: Damian Krolik <[email protected]>
@github-actions
Copy link

github-actions bot commented Jun 9, 2022

PR #19385: Size comparison from ac7e2f7 to e8a2c36

Increases (4 builds for cc13x2_26x2, esp32)
platform target config section ac7e2f7 e8a2c36 change % change
cc13x2_26x2 lock-ftd LP_CC2652R7 (read only) 683455 683463 8 0.0
.text 584788 584796 8 0.0
pump-app LP_CC2652R7 (read only) 664899 664907 8 0.0
.text 578052 578060 8 0.0
pump-controller-app LP_CC2652R7 (read only) 655483 655491 8 0.0
.text 570748 570756 8 0.0
esp32 all-clusters-app c3devkit (read only) 1007740 1007744 4 0.0
.flash.text 1007740 1007744 4 0.0
Decreases (16 builds for cc13x2_26x2, cyw30739, nrfconnect, telink)
platform target config section ac7e2f7 e8a2c36 change % change
cc13x2_26x2 lock-ftd LP_CC2652R7 (read/write) 159376 159368 -8 -0.0
pump-app LP_CC2652R7 (read/write) 178844 178836 -8 -0.0
pump-controller-app LP_CC2652R7 (read/write) 188364 188356 -8 -0.0
cyw30739 ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 599446 599438 -8 -0.0
.app_xip_area 459372 459364 -8 -0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1192051 1192019 -32 -0.0
text 817112 817092 -20 -0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1139775 1139759 -16 -0.0
text 789188 789168 -20 -0.0
lighting-app nrf52840dk_nrf52840 (read/write) 1153335 1153303 -32 -0.0
text 808788 808768 -20 -0.0
nrf52840dk_nrf52840+rpc (read/write) 1120715 1120699 -16 -0.0
text 783956 783936 -20 -0.0
nrf52840dongle_nrf52840 (read/write) 1059671 1059655 -16 -0.0
text 736688 736672 -16 -0.0
nrf5340dk_nrf5340_cpuapp (read/write) 1057042 1057010 -32 -0.0
text 721512 721492 -20 -0.0
lock-app nrf52840dk_nrf52840 (read/write) 1104995 1104979 -16 -0.0
text 754120 754096 -24 -0.0
nrf5340dk_nrf5340_cpuapp (read/write) 1008986 1008970 -16 -0.0
text 666916 666892 -24 -0.0
pump-app nrf52840dk_nrf52840 (read/write) 1066303 1066287 -16 -0.0
text 738524 738504 -20 -0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 1058887 1058871 -16 -0.0
text 732512 732488 -24 -0.0
telink light-switch-app tlsr9518adk80d (read/write) 781696 781664 -32 -0.0
text 552576 552544 -32 -0.0
lighting-app tlsr9518adk80d (read/write) 801716 801684 -32 -0.0
text 569298 569266 -32 -0.0
Full report (33 builds for cc13x2_26x2, cyw30739, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section ac7e2f7 e8a2c36 change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 689943 689943 0 0.0
(read/write) 161824 161824 0 0.0
.bss 74660 74660 0 0.0
.data 3392 3392 0 0.0
.rodata 112327 112327 0 0.0
.text 577304 577304 0 0.0
all-clusters-minimal-app LP_CC2652R7 (read only) 640599 640599 0 0.0
(read/write) 158132 158132 0 0.0
.bss 73884 73884 0 0.0
.data 3332 3332 0 0.0
.rodata 89367 89367 0 0.0
.text 550912 550912 0 0.0
lock-ftd LP_CC2652R7 (read only) 683455 683463 8 0.0
(read/write) 159376 159368 -8 -0.0
.bss 72612 72612 0 0.0
.data 3256 3256 0 0.0
.rodata 98183 98183 0 0.0
.text 584788 584796 8 0.0
lock-mtd LP_CC2652R7 (read only) 632879 632879 0 0.0
(read/write) 145720 145720 0 0.0
.bss 68348 68348 0 0.0
.data 3256 3256 0 0.0
.rodata 98071 98071 0 0.0
.text 534316 534316 0 0.0
pump-app LP_CC2652R7 (read only) 664899 664907 8 0.0
(read/write) 178844 178836 -8 -0.0
.bss 72756 72756 0 0.0
.data 3292 3292 0 0.0
.rodata 86363 86363 0 0.0
.text 578052 578060 8 0.0
pump-controller-app LP_CC2652R7 (read only) 655483 655491 8 0.0
(read/write) 188364 188356 -8 -0.0
.bss 72860 72860 0 0.0
.data 3252 3252 0 0.0
.rodata 84251 84251 0 0.0
.text 570748 570756 8 0.0
shell LP_CC2652R7 (read only) 682230 682230 0 0.0
(read/write) 165032 165032 0 0.0
.bss 76956 76956 0 0.0
.data 3396 3396 0 0.0
.rodata 108926 108926 0 0.0
.text 572992 572992 0 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 602562 602562 0 0.0
.app_xip_area 461508 461508 0 0.0
.bss 84008 84008 0 0.0
.data 732 732 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
lock cyw930739m2evb_01 (read/write) 599646 599646 0 0.0
.app_xip_area 458456 458456 0 0.0
.bss 84176 84176 0 0.0
.data 700 700 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 599446 599438 -8 -0.0
.app_xip_area 459372 459364 -8 -0.0
.bss 83140 83140 0 0.0
.data 616 616 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
esp32 all-clusters-app c3devkit (read only) 1007740 1007744 4 0.0
(read/write) 1481834 1481834 0 0.0
.dram0.bss 69168 69168 0 0.0
.dram0.data 14656 14656 0 0.0
.flash.rodata 212584 212584 0 0.0
.flash.text 1007740 1007744 4 0.0
.iram0.text 62902 62902 0 0.0
m5stack (read only) 1062491 1062491 0 0.0
(read/write) 483968 483968 0 0.0
.dram0.bss 74688 74688 0 0.0
.dram0.data 34200 34200 0 0.0
.flash.rodata 243084 243084 0 0.0
.flash.text 1057107 1057107 0 0.0
.iram0.text 123267 123267 0 0.0
k32w light k32w061+release (read/write) 653784 653784 0 0.0
.bss 70044 70044 0 0.0
.data 2004 2004 0 0.0
.text 575936 575936 0 0.0
lock k32w061+release (read/write) 714876 714876 0 0.0
.bss 70484 70484 0 0.0
.data 1976 1976 0 0.0
.text 636616 636616 0 0.0
linux chip-tool-no-interactive-ipv6only arm64 (read only) 9502940 9502940 0 0.0
(read/write) 678033 678033 0 0.0
.bss 43681 43681 0 0.0
.data 1152 1152 0 0.0
.data.rel.ro 614464 614464 0 0.0
.dynamic 528 528 0 0.0
.got 14936 14936 0 0.0
.init 24 24 0 0.0
.init_array 192 192 0 0.0
.rodata 467916 467916 0 0.0
.text 7486692 7486692 0 0.0
thermostat-no-ble arm64 (read only) 2544060 2544060 0 0.0
(read/write) 183057 183057 0 0.0
.bss 91409 91409 0 0.0
.data 1512 1512 0 0.0
.data.rel.ro 82120 82120 0 0.0
.dynamic 528 528 0 0.0
.got 4992 4992 0 0.0
.init 24 24 0 0.0
.init_array 400 400 0 0.0
.rodata 160164 160164 0 0.0
.text 2147040 2147040 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2429656 2429656 0 0.0
.bss 202692 202692 0 0.0
.data 5872 5872 0 0.0
.text 1392300 1392300 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1192051 1192019 -32 -0.0
bss 141362 141362 0 0.0
rodata 154644 154644 0 0.0
text 817112 817092 -20 -0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1139775 1139759 -16 -0.0
bss 140579 140579 0 0.0
rodata 131136 131136 0 0.0
text 789188 789168 -20 -0.0
lighting-app nrf52840dk_nrf52840 (read/write) 1153335 1153303 -32 -0.0
bss 143936 143936 0 0.0
rodata 121736 121736 0 0.0
text 808788 808768 -20 -0.0
nrf52840dk_nrf52840+rpc (read/write) 1120715 1120699 -16 -0.0
bss 144177 144177 0 0.0
rodata 113252 113252 0 0.0
text 783956 783936 -20 -0.0
nrf52840dongle_nrf52840 (read/write) 1059671 1059655 -16 -0.0
bss 151167 151167 0 0.0
rodata 90808 90808 0 0.0
text 736688 736672 -16 -0.0
nrf5340dk_nrf5340_cpuapp (read/write) 1057042 1057010 -32 -0.0
bss 140307 140307 0 0.0
rodata 114160 114160 0 0.0
text 721512 721492 -20 -0.0
lock-app nrf52840dk_nrf52840 (read/write) 1104995 1104979 -16 -0.0
bss 133864 133864 0 0.0
rodata 138268 138268 0 0.0
text 754120 754096 -24 -0.0
nrf5340dk_nrf5340_cpuapp (read/write) 1008986 1008970 -16 -0.0
bss 130267 130267 0 0.0
rodata 130752 130752 0 0.0
text 666916 666892 -24 -0.0
pump-app nrf52840dk_nrf52840 (read/write) 1066303 1066287 -16 -0.0
bss 133847 133847 0 0.0
rodata 115104 115104 0 0.0
text 738524 738504 -20 -0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 1058887 1058871 -16 -0.0
bss 133624 133624 0 0.0
rodata 113976 113976 0 0.0
text 732512 732488 -24 -0.0
p6 all-clusters-app default (read/write) 2544632 2544632 0 0.0
.bss 137120 137120 0 0.0
.data 2808 2808 0 0.0
.text 1502896 1502896 0 0.0
all-clusters-minimal-app default (read/write) 2489440 2489440 0 0.0
.bss 136328 136328 0 0.0
.data 2752 2752 0 0.0
.text 1447704 1447704 0 0.0
light-app default (read/write) 2421312 2421312 0 0.0
.bss 129432 129432 0 0.0
.data 2600 2600 0 0.0
.text 1379576 1379576 0 0.0
lock-app default (read/write) 2441648 2441648 0 0.0
.bss 129256 129256 0 0.0
.data 2576 2576 0 0.0
.text 1399912 1399912 0 0.0
telink light-switch-app tlsr9518adk80d (read/write) 781696 781664 -32 -0.0
bss 70636 70636 0 0.0
noinit 40416 40416 0 0.0
text 552576 552544 -32 -0.0
lighting-app tlsr9518adk80d (read/write) 801716 801684 -32 -0.0
bss 70888 70888 0 0.0
noinit 40416 40416 0 0.0
text 569298 569266 -32 -0.0

Copy link
Contributor

@woody-apple woody-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fast tracking platform changes

@woody-apple woody-apple merged commit ac8bdbf into project-chip:master Jun 9, 2022
mkardous-silabs pushed a commit to mkardous-silabs/connectedhomeip that referenced this pull request Jun 10, 2022
…19385)

* [Zephyr] Support heap watermark for non-default malloc

When non-default malloc implementation, based on Zephyr's
sys_heap is used, support CurrentHeapHighWatermark attribute
and ResetWatermarks command. This is because sys_heap
exposes max_allocated_bytes statistic.

Signed-off-by: Damian Krolik <[email protected]>

* Restyled by clang-format

Co-authored-by: Restyled.io <[email protected]>
rochaferraz pushed a commit to rochaferraz/connectedhomeip that referenced this pull request Jun 15, 2022
…19385)

* [Zephyr] Support heap watermark for non-default malloc

When non-default malloc implementation, based on Zephyr's
sys_heap is used, support CurrentHeapHighWatermark attribute
and ResetWatermarks command. This is because sys_heap
exposes max_allocated_bytes statistic.

Signed-off-by: Damian Krolik <[email protected]>

* Restyled by clang-format

Co-authored-by: Restyled.io <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants