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

Reduce AddStatus calls for errors in IMCommandHandler code generation #37110

Merged
merged 6 commits into from
Jan 17, 2025

Conversation

andy31415
Copy link
Contributor

@andy31415 andy31415 commented Jan 17, 2025

IMCommandHandler has a AddStatus for every cluster implementation as well as a final one for invalid clusters. Instead we just need to know if a status needs to be set or not, so I changed the code to use an optional statuscode along with a single invocation of AddStatus.

I started out as std::optional<status> however it turns out optional also has an overhad, so I moved it to have Success mean no status needs to be added and anything else will be added. This should reduce flash overall and not add std::optional overhead at the expense of slight readability (success status is not added).

Expectation is that this saves some Flash.

Testing

CI should validate this as this is generated code for applications

Copy link

Review changes with  SemanticDiff

Copy link

github-actions bot commented Jan 17, 2025

PR #37110: Size comparison from 4fd7215 to 10813fd

Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section 4fd7215 10813fd change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1093164 1092958 -206 -0.0
RAM 103362 103362 0 0.0
bl702 lighting-app bl702+eth FLASH 651226 650970 -256 -0.0
RAM 25365 25365 0 0.0
bl702+wifi FLASH 829150 828894 -256 -0.0
RAM 14105 14105 0 0.0
bl706+mfd+rpc+littlefs FLASH 1056180 1055924 -256 -0.0
RAM 23957 23957 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 889150 888894 -256 -0.0
RAM 18636 18636 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 972164 972164 0 0.0
RAM 16484 16484 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 838436 838364 -72 -0.0
RAM 123536 123536 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 823832 823776 -56 -0.0
RAM 125416 125416 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 771112 770944 -168 -0.0
RAM 113908 113908 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 755308 755204 -104 -0.0
RAM 114108 114108 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 538789 538701 -88 -0.0
RAM 205296 205296 0 0.0
lock CC3235SF_LAUNCHXL FLASH 572677 572533 -144 -0.0
RAM 205432 205432 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 679889 679713 -176 -0.0
RAM 78604 78604 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 699733 699565 -168 -0.0
RAM 81244 81244 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 699733 699565 -168 -0.0
RAM 81244 81244 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 656677 656501 -176 -0.0
RAM 73672 73672 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 616257 616129 -128 -0.0
RAM 71588 71588 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 635893 635765 -128 -0.0
RAM 74132 74132 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 635893 635765 -128 -0.0
RAM 74132 74132 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 635721 635569 -152 -0.0
RAM 74596 74596 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 655429 655285 -144 -0.0
RAM 77140 77140 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 655429 655285 -144 -0.0
RAM 77140 77140 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 612229 612101 -128 -0.0
RAM 68692 68692 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 632089 631961 -128 -0.0
RAM 71324 71324 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 632089 631961 -128 -0.0
RAM 71324 71324 0 0.0
efr32 lock-app BRD4187C FLASH 935080 934856 -224 -0.0
RAM 160004 160004 0 0.0
BRD4338a FLASH 730852 731228 376 0.1
RAM 234844 234844 0 0.0
window-app BRD4187C FLASH 1030520 1030872 352 0.0
RAM 128112 128112 0 0.0
esp32 all-clusters-app c3devkit DRAM 95192 95192 0 0.0
FLASH 1538592 1537654 -938 -0.1
IRAM 82552 82552 0 0.0
m5stack DRAM 116172 116172 0 0.0
FLASH 1545810 1545250 -560 -0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4752 4752 0 0.0
FLASH 2710313 2711143 830 0.0
RAM 133096 133096 0 0.0
all-clusters-app debug unknown 5560 5560 0 0.0
FLASH 5976378 5977516 1138 0.0
RAM 531880 531880 0 0.0
all-clusters-minimal-app debug unknown 5456 5456 0 0.0
FLASH 5324396 5325502 1106 0.0
RAM 242992 242992 0 0.0
bridge-app debug unknown 5472 5472 0 0.0
FLASH 4682624 4683482 858 0.0
RAM 221744 221744 0 0.0
chip-tool debug unknown 5984 5984 0 0.0
FLASH 13045274 13045814 540 0.0
RAM 596634 596634 0 0.0
chip-tool-ipv6only arm64 unknown 21816 21816 0 0.0
FLASH 11125760 11126544 784 0.0
RAM 648168 648168 0 0.0
fabric-admin debug unknown 5808 5808 0 0.0
FLASH 11392249 11392789 540 0.0
RAM 596978 596978 0 0.0
fabric-bridge-app debug unknown 4728 4728 0 0.0
FLASH 4507674 4508476 802 0.0
RAM 208880 208880 0 0.0
fabric-sync debug unknown 4968 4968 0 0.0
FLASH 5610469 5611285 816 0.0
RAM 483656 483656 0 0.0
lighting-app debug+rpc+ui unknown 6136 6136 0 0.0
FLASH 5617953 5618849 896 0.0
RAM 232008 232008 0 0.0
lock-app debug unknown 5408 5408 0 0.0
FLASH 4732582 4733438 856 0.0
RAM 207976 207976 0 0.0
ota-provider-app debug unknown 4768 4768 0 0.0
FLASH 4361282 4362074 792 0.0
RAM 201696 201696 0 0.0
ota-requestor-app debug unknown 4720 4720 0 0.0
FLASH 4498956 4499760 804 0.0
RAM 206280 206280 0 0.0
shell debug unknown 4248 4248 0 0.0
FLASH 3006765 3007901 1136 0.0
RAM 160736 160736 0 0.0
thermostat-no-ble arm64 unknown 9568 9568 0 0.0
FLASH 4102232 4103832 1600 0.0
RAM 246224 246224 0 0.0
tv-app debug unknown 5736 5736 0 0.0
FLASH 5950645 5951701 1056 0.0
RAM 607088 607088 0 0.0
tv-casting-app debug unknown 5312 5312 0 0.0
FLASH 11273101 11273917 816 0.0
RAM 711064 711064 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 914772 914188 -584 -0.1
RAM 143176 143176 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 890116 889348 -768 -0.1
RAM 141363 141363 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 849492 848992 -500 -0.1
RAM 142088 142088 0 0.0
nxp contact k32w0+release FLASH 584456 584520 64 0.0
RAM 70960 70960 0 0.0
mcxw71+release FLASH 600000 599944 -56 -0.0
RAM 63176 63176 0 0.0
light k32w0+release FLASH 611204 610980 -224 -0.0
RAM 70352 70352 0 0.0
k32w1+release FLASH 685744 685528 -216 -0.0
RAM 48768 48768 0 0.0
lock mcxw71+release FLASH 761776 761576 -200 -0.0
RAM 70788 70788 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1648060 1648940 880 0.1
RAM 211624 211624 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1554628 1555540 912 0.1
RAM 208448 208448 0 0.0
light cy8ckit_062s2_43012 FLASH 1470172 1470668 496 0.0
RAM 200416 200416 0 0.0
lock cy8ckit_062s2_43012 FLASH 1468028 1468412 384 0.0
RAM 224760 224760 0 0.0
qpg lighting-app qpg6105+debug FLASH 662560 662272 -288 -0.0
RAM 105296 105296 0 0.0
lock-app qpg6105+debug FLASH 620228 620044 -184 -0.0
RAM 99748 99748 0 0.0
stm32 light STM32WB5MM-DK FLASH 483240 482944 -296 -0.1
RAM 144752 144752 0 0.0
telink bridge-app tlsr9258a FLASH 682280 681982 -298 -0.0
RAM 91092 91092 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 622460 622178 -282 -0.0
RAM 31492 31492 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 771348 771050 -298 -0.0
RAM 49352 49352 0 0.0
light-app-ota-shell-factory-data tl7218x FLASH 775952 775492 -460 -0.1
RAM 99656 99656 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 709734 709406 -328 -0.0
RAM 73384 73384 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 626898 626438 -460 -0.1
RAM 142024 142024 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 812962 812502 -460 -0.1
RAM 99568 99568 0 0.0
tizen all-clusters-app arm unknown 5132 5132 0 0.0
FLASH 1755320 1757936 2616 0.1
RAM 93680 93680 0 0.0
chip-tool-ubsan arm unknown 11044 11044 0 0.0
FLASH 18216926 18218182 1256 0.0
RAM 7958632 7959640 1008 0.0

Copy link

github-actions bot commented Jan 17, 2025

PR #37110: Size comparison from 4fd7215 to f57cec6

Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section 4fd7215 f57cec6 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1093164 1092720 -444 -0.0
RAM 103362 103362 0 0.0
bl702 lighting-app bl702+eth FLASH 651226 650714 -512 -0.1
RAM 25365 25365 0 0.0
bl702+wifi FLASH 829150 828638 -512 -0.1
RAM 14105 14105 0 0.0
bl706+mfd+rpc+littlefs FLASH 1056180 1055924 -256 -0.0
RAM 23957 23957 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 889150 888894 -256 -0.0
RAM 18636 18636 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 972164 971908 -256 -0.0
RAM 16484 16484 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 838436 838204 -232 -0.0
RAM 123536 123536 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 823832 823648 -184 -0.0
RAM 125416 125416 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 771112 770840 -272 -0.0
RAM 113908 113908 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 755308 755108 -200 -0.0
RAM 114108 114108 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 538789 538621 -168 -0.0
RAM 205296 205296 0 0.0
lock CC3235SF_LAUNCHXL FLASH 572677 572477 -200 -0.0
RAM 205432 205432 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 679889 679633 -256 -0.0
RAM 78604 78604 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 699733 699477 -256 -0.0
RAM 81244 81244 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 699733 699477 -256 -0.0
RAM 81244 81244 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 656677 656421 -256 -0.0
RAM 73672 73672 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 616257 616033 -224 -0.0
RAM 71588 71588 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 635893 635669 -224 -0.0
RAM 74132 74132 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 635893 635669 -224 -0.0
RAM 74132 74132 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 635721 635513 -208 -0.0
RAM 74596 74596 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 655429 655229 -200 -0.0
RAM 77140 77140 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 655429 655229 -200 -0.0
RAM 77140 77140 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 612229 612005 -224 -0.0
RAM 68692 68692 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 632089 631865 -224 -0.0
RAM 71324 71324 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 632089 631865 -224 -0.0
RAM 71324 71324 0 0.0
efr32 lock-app BRD4187C FLASH 935080 934728 -352 -0.0
RAM 160004 160004 0 0.0
BRD4338a FLASH 730852 730412 -440 -0.1
RAM 234844 234844 0 0.0
window-app BRD4187C FLASH 1030520 1030136 -384 -0.0
RAM 128112 128112 0 0.0
esp32 all-clusters-app c3devkit DRAM 95192 95192 0 0.0
FLASH 1538592 1537254 -1338 -0.1
IRAM 82552 82552 0 0.0
m5stack DRAM 116172 116172 0 0.0
FLASH 1545810 1544806 -1004 -0.1
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4752 4752 0 0.0
FLASH 2710313 2709891 -422 -0.0
RAM 133096 133096 0 0.0
all-clusters-app debug unknown 5560 5560 0 0.0
FLASH 5976378 5975152 -1226 -0.0
RAM 531880 531880 0 0.0
all-clusters-minimal-app debug unknown 5456 5456 0 0.0
FLASH 5324396 5323196 -1200 -0.0
RAM 242992 242992 0 0.0
bridge-app debug unknown 5472 5472 0 0.0
FLASH 4682624 4682176 -448 -0.0
RAM 221744 221744 0 0.0
chip-tool debug unknown 5984 5984 0 0.0
FLASH 13045274 13045286 12 0.0
RAM 596634 596634 0 0.0
chip-tool-ipv6only arm64 unknown 21816 21816 0 0.0
FLASH 11125760 11125792 32 0.0
RAM 648168 648168 0 0.0
fabric-admin debug unknown 5808 5808 0 0.0
FLASH 11392249 11392261 12 0.0
RAM 596978 596978 0 0.0
fabric-bridge-app debug unknown 4728 4728 0 0.0
FLASH 4507674 4507350 -324 -0.0
RAM 208880 208880 0 0.0
fabric-sync debug unknown 4968 4968 0 0.0
FLASH 5610469 5610149 -320 -0.0
RAM 483656 483656 0 0.0
lighting-app debug+rpc+ui unknown 6136 6136 0 0.0
FLASH 5617953 5617313 -640 -0.0
RAM 232008 232008 0 0.0
lock-app debug unknown 5408 5408 0 0.0
FLASH 4732582 4732060 -522 -0.0
RAM 207976 207976 0 0.0
ota-provider-app debug unknown 4768 4768 0 0.0
FLASH 4361282 4361050 -232 -0.0
RAM 201696 201696 0 0.0
ota-requestor-app debug unknown 4720 4720 0 0.0
FLASH 4498956 4498588 -368 -0.0
RAM 206280 206280 0 0.0
shell debug unknown 4248 4248 0 0.0
FLASH 3006765 3005533 -1232 -0.0
RAM 160736 160736 0 0.0
thermostat-no-ble arm64 unknown 9568 9568 0 0.0
FLASH 4102232 4102152 -80 -0.0
RAM 246224 246224 0 0.0
tv-app debug unknown 5736 5736 0 0.0
FLASH 5950645 5949653 -992 -0.0
RAM 607088 607088 0 0.0
tv-casting-app debug unknown 5312 5312 0 0.0
FLASH 11273101 11272733 -368 -0.0
RAM 711064 711064 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 914772 913884 -888 -0.1
RAM 143176 143176 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 890116 889048 -1068 -0.1
RAM 141363 141363 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 849492 848664 -828 -0.1
RAM 142088 142088 0 0.0
nxp contact k32w0+release FLASH 584456 584424 -32 -0.0
RAM 70960 70960 0 0.0
mcxw71+release FLASH 600000 599832 -168 -0.0
RAM 63176 63176 0 0.0
light k32w0+release FLASH 611204 610884 -320 -0.1
RAM 70352 70352 0 0.0
k32w1+release FLASH 685744 685416 -328 -0.0
RAM 48768 48768 0 0.0
lock mcxw71+release FLASH 761776 761480 -296 -0.0
RAM 70788 70788 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1648060 1647004 -1056 -0.1
RAM 211624 211624 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1554628 1553604 -1024 -0.1
RAM 208448 208448 0 0.0
light cy8ckit_062s2_43012 FLASH 1470172 1469644 -528 -0.0
RAM 200416 200416 0 0.0
lock cy8ckit_062s2_43012 FLASH 1468028 1467596 -432 -0.0
RAM 224760 224760 0 0.0
qpg lighting-app qpg6105+debug FLASH 662560 662144 -416 -0.1
RAM 105296 105296 0 0.0
lock-app qpg6105+debug FLASH 620228 619924 -304 -0.0
RAM 99748 99748 0 0.0
stm32 light STM32WB5MM-DK FLASH 483240 482784 -456 -0.1
RAM 144752 144752 0 0.0
telink bridge-app tlsr9258a FLASH 682280 681828 -452 -0.1
RAM 91092 91092 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 622460 622000 -460 -0.1
RAM 31492 31492 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 771348 770836 -512 -0.1
RAM 49352 49352 0 0.0
light-app-ota-shell-factory-data tl7218x FLASH 775952 775278 -674 -0.1
RAM 99656 99656 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 709734 709216 -518 -0.1
RAM 73384 73384 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 626898 626224 -674 -0.1
RAM 142024 142024 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 812962 812288 -674 -0.1
RAM 99568 99568 0 0.0
tizen all-clusters-app arm unknown 5132 5132 0 0.0
FLASH 1755320 1754928 -392 -0.0
RAM 93680 93680 0 0.0
chip-tool-ubsan arm unknown 11044 11044 0 0.0
FLASH 18216926 18216942 16 0.0
RAM 7958632 7958632 0 0.0

@mergify mergify bot merged commit c389092 into project-chip:master Jan 17, 2025
69 checks passed
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