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

[Android] Use templated reads and writes #12127

Merged
merged 1 commit into from
Nov 23, 2021
Merged

Conversation

austinh0
Copy link
Contributor

Problem

  • Android read/writes don't support nullable/optional.

Change overview

  • Use templated reads and writes. Read callback/write parameters can be annotated as @Nullable or return an Optional (in practice this is not generated yet).
  • Add helper if_in_global_responses, which allows us to reuse basic type read callback classes (e.g. CHIPBooleanAttributeCallback), while generating a custom callback class for types that are not covered by the global responses.
  • The cluster interaction tool will not work on invocation for nullable/optional reads and writes, but this PR is already big so would prefer to fix this in a separate PR.

Testing

  • Manually tested with TestCluster.

@github-actions
Copy link

github-actions bot commented Nov 23, 2021

PR #12127: Size comparison from 2e16d32 to 2e6fcd6

Full report (38 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 2e16d32 2e6fcd6 change % change
efr32 lighting-app BRD4161A (read only) 751376 751376 0 0.0
(read/write) 119692 119692 0 0.0
.bss 117884 117884 0 0.0
.data 1808 1808 0 0.0
.text 751368 751368 0 0.0
BRD4161A+rpc (read only) 738884 738884 0 0.0
(read/write) 136320 136320 0 0.0
.bss 134388 134388 0 0.0
.data 1932 1932 0 0.0
.text 738876 738876 0 0.0
lock-app BRD4161A (read only) 728448 728448 0 0.0
(read/write) 117476 117476 0 0.0
.bss 115708 115708 0 0.0
.data 1764 1764 0 0.0
.text 728440 728440 0 0.0
window-app BRD4161A (read only) 731896 731896 0 0.0
(read/write) 117836 117836 0 0.0
.bss 116060 116060 0 0.0
.data 1772 1772 0 0.0
.text 731888 731888 0 0.0
esp32 all-clusters-app c3devkit (read only) 833664 833664 0 0.0
(read/write) 1222106 1222106 0 0.0
.dram0.bss 57760 57760 0 0.0
.dram0.data 14100 14100 0 0.0
.flash.rodata 164992 164992 0 0.0
.flash.text 833664 833664 0 0.0
.iram0.text 61394 61394 0 0.0
m5stack (read only) 904711 904711 0 0.0
(read/write) 421400 421400 0 0.0
.dram0.bss 63120 63120 0 0.0
.dram0.data 34064 34064 0 0.0
.flash.rodata 192936 192936 0 0.0
.flash.text 899327 899327 0 0.0
.iram0.text 122943 122943 0 0.0
k32w lighting-app k32w061+se05x+release (read/write) 707928 707928 0 0.0
.bss 77212 77212 0 0.0
.data 1920 1920 0 0.0
.text 622996 622996 0 0.0
lock-app k32w061+debug (read/write) 599368 599368 0 0.0
.bss 67724 67724 0 0.0
.data 1888 1888 0 0.0
.text 523956 523956 0 0.0
shell k32w061+debug (read/write) 664744 664744 0 0.0
.bss 78884 78884 0 0.0
.data 1856 1856 0 0.0
.text 578204 578204 0 0.0
linux all-clusters-app debug (read only) 1748801 1748801 0 0.0
(read/write) 128688 128688 0 0.0
.bss 58576 58576 0 0.0
.data 1042 1042 0 0.0
.data.rel.ro 63760 63760 0 0.0
.dynamic 592 592 0 0.0
.got 4112 4112 0 0.0
.init 27 27 0 0.0
.init_array 568 568 0 0.0
.rodata 138549 138549 0 0.0
.text 1473874 1473874 0 0.0
bridge-app debug+rpc (read only) 1328645 1328645 0 0.0
(read/write) 76760 76760 0 0.0
.bss 41552 41552 0 0.0
.data 1584 1584 0 0.0
.data.rel.ro 28608 28608 0 0.0
.dynamic 592 592 0 0.0
.got 3984 3984 0 0.0
.init 27 27 0 0.0
.init_array 416 416 0 0.0
.rodata 113116 113116 0 0.0
.text 1117381 1117381 0 0.0
chip-tool debug (read only) 5875885 5875885 0 0.0
(read/write) 195936 195936 0 0.0
.bss 39896 39896 0 0.0
.data 2288 2288 0 0.0
.data.rel.ro 148192 148192 0 0.0
.dynamic 592 592 0 0.0
.got 4456 4456 0 0.0
.init 27 27 0 0.0
.init_array 480 480 0 0.0
.rodata 278778 278778 0 0.0
.text 5216741 5216741 0 0.0
lighting-app debug+rpc (read only) 1597849 1597849 0 0.0
(read/write) 109976 109976 0 0.0
.bss 47216 47216 0 0.0
.data 1234 1234 0 0.0
.data.rel.ro 56208 56208 0 0.0
.dynamic 608 608 0 0.0
.got 4136 4136 0 0.0
.init 27 27 0 0.0
.init_array 544 544 0 0.0
.rodata 130833 130833 0 0.0
.text 1331266 1331266 0 0.0
ota-provider-app debug (read only) 1279465 1279465 0 0.0
(read/write) 75376 75376 0 0.0
.bss 44128 44128 0 0.0
.data 800 800 0 0.0
.data.rel.ro 25336 25336 0 0.0
.dynamic 592 592 0 0.0
.got 4048 4048 0 0.0
.init 27 27 0 0.0
.init_array 456 456 0 0.0
.rodata 114903 114903 0 0.0
.text 1065890 1065890 0 0.0
ota-requestor-app debug (read only) 1375729 1375729 0 0.0
(read/write) 79240 79240 0 0.0
.bss 46592 46592 0 0.0
.data 864 864 0 0.0
.data.rel.ro 26664 26664 0 0.0
.dynamic 592 592 0 0.0
.got 4032 4032 0 0.0
.init 27 27 0 0.0
.init_array 480 480 0 0.0
.rodata 126312 126312 0 0.0
.text 1147954 1147954 0 0.0
shell debug (read only) 804577 804577 0 0.0
(read/write) 66160 66160 0 0.0
.bss 23336 23336 0 0.0
.data 274 274 0 0.0
.data.rel.ro 38008 38008 0 0.0
.dynamic 592 592 0 0.0
.got 3560 3560 0 0.0
.init 27 27 0 0.0
.init_array 352 352 0 0.0
.rodata 79279 79279 0 0.0
.text 620194 620194 0 0.0
tv-app debug (read only) 1890329 1890329 0 0.0
(read/write) 318832 318832 0 0.0
.bss 249848 249848 0 0.0
.data 2784 2784 0 0.0
.data.rel.ro 60520 60520 0 0.0
.dynamic 592 592 0 0.0
.got 4432 4432 0 0.0
.init 27 27 0 0.0
.init_array 624 624 0 0.0
.rodata 159389 159389 0 0.0
.text 1584754 1584754 0 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2290672 2290672 0 0.0
.bss 180308 180308 0 0.0
.data 5232 5232 0 0.0
.heap 850904 850904 0 0.0
.text 1253272 1253272 0 0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2274800 2274800 0 0.0
.bss 172212 172212 0 0.0
.data 5584 5584 0 0.0
.heap 858648 858648 0 0.0
.text 1237400 1237400 0 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2250632 2250632 0 0.0
.bss 171092 171092 0 0.0
.data 5576 5576 0 0.0
.heap 859776 859776 0 0.0
.text 1213232 1213232 0 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139744 1139744 0 0.0
.bss 11752 11752 0 0.0
.data 4368 4368 0 0.0
.heap 1020328 1020328 0 0.0
.text 103128 103128 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2050872 2050872 0 0.0
.bss 156280 156280 0 0.0
.data 4976 4976 0 0.0
.heap 875192 875192 0 0.0
.text 1013472 1013472 0 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 865667 865667 0 0.0
bss 110616 110616 0 0.0
rodata 95980 95980 0 0.0
text 583444 583444 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 828035 828035 0 0.0
bss 106972 106972 0 0.0
rodata 87164 87164 0 0.0
text 557612 557612 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 790706 790706 0 0.0
bss 111992 111992 0 0.0
rodata 91236 91236 0 0.0
text 512912 512912 0 0.0
lock-app nrf52840dk_nrf52840 (read/write) 841099 841099 0 0.0
bss 109640 109640 0 0.0
rodata 92452 92452 0 0.0
text 563540 563540 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 766386 766386 0 0.0
bss 111052 111052 0 0.0
rodata 87756 87756 0 0.0
text 493096 493096 0 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 497327 497327 0 0.0
bss 51824 51824 0 0.0
rodata 45780 45780 0 0.0
text 339436 339436 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 847207 847207 0 0.0
bss 109780 109780 0 0.0
rodata 94160 94160 0 0.0
text 567720 567720 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 840799 840799 0 0.0
bss 109676 109676 0 0.0
rodata 92408 92408 0 0.0
text 563160 563160 0 0.0
shell nrf52840dk_nrf52840 (read/write) 778639 778639 0 0.0
bss 109160 109160 0 0.0
rodata 73196 73196 0 0.0
text 521668 521668 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 693662 693662 0 0.0
bss 110144 110144 0 0.0
rodata 67840 67840 0 0.0
text 442276 442276 0 0.0
p6 all-clusters-app default (read/write) 2303656 2303656 0 0.0
.bss 113296 113296 0 0.0
.data 2536 2536 0 0.0
.heap 917512 917512 0 0.0
.text 1261920 1261920 0 0.0
lock-app default (read/write) 2216840 2216840 0 0.0
.bss 100952 100952 0 0.0
.data 2408 2408 0 0.0
.heap 929984 929984 0 0.0
.text 1175104 1175104 0 0.0
qpg lighting-app qpg6100+debug (read only) 494680 494680 0 0.0
(read/write) 114144 114144 0 0.0
.bss 50264 50264 0 0.0
.data 1016 1016 0 0.0
.text 489360 489360 0 0.0
lock-app qpg6100+debug (read only) 469660 469660 0 0.0
(read/write) 114140 114140 0 0.0
.bss 49200 49200 0 0.0
.data 972 972 0 0.0
.text 464340 464340 0 0.0
persistent-storage-app qpg6100+debug (read only) 105408 105408 0 0.0
(read/write) 114142 114142 0 0.0
.bss 8986 8986 0 0.0
.data 272 272 0 0.0
.text 100088 100088 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 769042 769042 0 0.0
bss 79136 79136 0 0.0
noinit 37160 37160 0 0.0
text 534004 534004 0 0.0

@andy31415
Copy link
Contributor

fast track: platform specific change created by platform owner.

@austinh0 - merge conflicts

@github-actions
Copy link

github-actions bot commented Nov 23, 2021

PR #12127: Size comparison from c1b032a to e10042e

Full report (38 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section c1b032a e10042e change % change
efr32 lighting-app BRD4161A (read only) 754832 754832 0 0.0
(read/write) 119796 119796 0 0.0
.bss 117980 117980 0 0.0
.data 1812 1812 0 0.0
.text 754824 754824 0 0.0
BRD4161A+rpc (read only) 742292 742292 0 0.0
(read/write) 136420 136420 0 0.0
.bss 134484 134484 0 0.0
.data 1936 1936 0 0.0
.text 742284 742284 0 0.0
lock-app BRD4161A (read only) 730688 730688 0 0.0
(read/write) 117508 117508 0 0.0
.bss 115740 115740 0 0.0
.data 1768 1768 0 0.0
.text 730680 730680 0 0.0
window-app BRD4161A (read only) 734136 734136 0 0.0
(read/write) 117868 117868 0 0.0
.bss 116092 116092 0 0.0
.data 1776 1776 0 0.0
.text 734128 734128 0 0.0
esp32 all-clusters-app c3devkit (read only) 834242 834242 0 0.0
(read/write) 1222658 1222658 0 0.0
.dram0.bss 57832 57832 0 0.0
.dram0.data 14100 14100 0 0.0
.flash.rodata 165464 165464 0 0.0
.flash.text 834242 834242 0 0.0
.iram0.text 61394 61394 0 0.0
m5stack (read only) 905103 905103 0 0.0
(read/write) 421956 421956 0 0.0
.dram0.bss 63224 63224 0 0.0
.dram0.data 34064 34064 0 0.0
.flash.rodata 193388 193388 0 0.0
.flash.text 899719 899719 0 0.0
.iram0.text 122943 122943 0 0.0
k32w lighting-app k32w061+se05x+release (read/write) 710268 710268 0 0.0
.bss 77316 77316 0 0.0
.data 1924 1924 0 0.0
.text 625228 625228 0 0.0
lock-app k32w061+debug (read/write) 600480 600480 0 0.0
.bss 67756 67756 0 0.0
.data 1892 1892 0 0.0
.text 525032 525032 0 0.0
shell k32w061+debug (read/write) 665960 665960 0 0.0
.bss 78916 78916 0 0.0
.data 1860 1860 0 0.0
.text 579384 579384 0 0.0
linux all-clusters-app debug (read only) 1752673 1752673 0 0.0
(read/write) 129432 129432 0 0.0
.bss 58576 58576 0 0.0
.data 1138 1138 0 0.0
.data.rel.ro 64400 64400 0 0.0
.dynamic 592 592 0 0.0
.got 4112 4112 0 0.0
.init 27 27 0 0.0
.init_array 576 576 0 0.0
.rodata 138485 138485 0 0.0
.text 1476178 1476178 0 0.0
bridge-app debug+rpc (read only) 1331405 1331405 0 0.0
(read/write) 77408 77408 0 0.0
.bss 41488 41488 0 0.0
.data 1680 1680 0 0.0
.data.rel.ro 29200 29200 0 0.0
.dynamic 592 592 0 0.0
.got 3984 3984 0 0.0
.init 27 27 0 0.0
.init_array 424 424 0 0.0
.rodata 113044 113044 0 0.0
.text 1118581 1118581 0 0.0
chip-tool debug (read only) 5939053 5939053 0 0.0
(read/write) 196776 196776 0 0.0
.bss 39896 39896 0 0.0
.data 2384 2384 0 0.0
.data.rel.ro 148936 148936 0 0.0
.dynamic 592 592 0 0.0
.got 4456 4456 0 0.0
.init 27 27 0 0.0
.init_array 488 488 0 0.0
.rodata 283922 283922 0 0.0
.text 5272773 5272773 0 0.0
lighting-app debug+rpc (read only) 1602017 1602017 0 0.0
(read/write) 110688 110688 0 0.0
.bss 47216 47216 0 0.0
.data 1330 1330 0 0.0
.data.rel.ro 56800 56800 0 0.0
.dynamic 608 608 0 0.0
.got 4136 4136 0 0.0
.init 27 27 0 0.0
.init_array 552 552 0 0.0
.rodata 131409 131409 0 0.0
.text 1333202 1333202 0 0.0
ota-provider-app debug (read only) 1296153 1296153 0 0.0
(read/write) 75928 75928 0 0.0
.bss 44128 44128 0 0.0
.data 880 880 0 0.0
.data.rel.ro 25784 25784 0 0.0
.dynamic 592 592 0 0.0
.got 4048 4048 0 0.0
.init 27 27 0 0.0
.init_array 464 464 0 0.0
.rodata 114831 114831 0 0.0
.text 1081282 1081282 0 0.0
ota-requestor-app debug (read only) 1392673 1392673 0 0.0
(read/write) 79792 79792 0 0.0
.bss 46592 46592 0 0.0
.data 944 944 0 0.0
.data.rel.ro 27112 27112 0 0.0
.dynamic 592 592 0 0.0
.got 4032 4032 0 0.0
.init 27 27 0 0.0
.init_array 488 488 0 0.0
.rodata 126240 126240 0 0.0
.text 1163602 1163602 0 0.0
shell debug (read only) 820313 820313 0 0.0
(read/write) 66584 66584 0 0.0
.bss 23272 23272 0 0.0
.data 338 338 0 0.0
.data.rel.ro 38440 38440 0 0.0
.dynamic 592 592 0 0.0
.got 3560 3560 0 0.0
.init 27 27 0 0.0
.init_array 360 360 0 0.0
.rodata 79119 79119 0 0.0
.text 634770 634770 0 0.0
tv-app debug (read only) 1901081 1901081 0 0.0
(read/write) 319704 319704 0 0.0
.bss 249976 249976 0 0.0
.data 2880 2880 0 0.0
.data.rel.ro 61184 61184 0 0.0
.dynamic 592 592 0 0.0
.got 4432 4432 0 0.0
.init 27 27 0 0.0
.init_array 632 632 0 0.0
.rodata 159317 159317 0 0.0
.text 1593874 1593874 0 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2293064 2293064 0 0.0
.bss 180388 180388 0 0.0
.data 5240 5240 0 0.0
.heap 850816 850816 0 0.0
.text 1255664 1255664 0 0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2277344 2277344 0 0.0
.bss 172292 172292 0 0.0
.data 5592 5592 0 0.0
.heap 858560 858560 0 0.0
.text 1239944 1239944 0 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2251664 2251664 0 0.0
.bss 171108 171108 0 0.0
.data 5576 5576 0 0.0
.heap 859760 859760 0 0.0
.text 1214264 1214264 0 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139744 1139744 0 0.0
.bss 11752 11752 0 0.0
.data 4368 4368 0 0.0
.heap 1020328 1020328 0 0.0
.text 103128 103128 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2051224 2051224 0 0.0
.bss 156320 156320 0 0.0
.data 4984 4984 0 0.0
.heap 875144 875144 0 0.0
.text 1013824 1013824 0 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 870183 870183 0 0.0
bss 112640 112640 0 0.0
rodata 96784 96784 0 0.0
text 585136 585136 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 832551 832551 0 0.0
bss 108992 108992 0 0.0
rodata 87968 87968 0 0.0
text 559304 559304 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 795222 795222 0 0.0
bss 114012 114012 0 0.0
rodata 92040 92040 0 0.0
text 514600 514600 0 0.0
lock-app nrf52840dk_nrf52840 (read/write) 842299 842299 0 0.0
bss 109672 109672 0 0.0
rodata 92788 92788 0 0.0
text 564380 564380 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 767586 767586 0 0.0
bss 111084 111084 0 0.0
rodata 88076 88076 0 0.0
text 493936 493936 0 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 497327 497327 0 0.0
bss 51824 51824 0 0.0
rodata 45780 45780 0 0.0
text 339436 339436 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 848407 848407 0 0.0
bss 109812 109812 0 0.0
rodata 94496 94496 0 0.0
text 568560 568560 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 841999 841999 0 0.0
bss 109708 109708 0 0.0
rodata 92744 92744 0 0.0
text 564000 564000 0 0.0
shell nrf52840dk_nrf52840 (read/write) 778907 778907 0 0.0
bss 109184 109184 0 0.0
rodata 73304 73304 0 0.0
text 521828 521828 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 693962 693962 0 0.0
bss 110168 110168 0 0.0
rodata 67948 67948 0 0.0
text 442436 442436 0 0.0
p6 all-clusters-app default (read/write) 2306904 2306904 0 0.0
.bss 113376 113376 0 0.0
.data 2536 2536 0 0.0
.heap 917432 917432 0 0.0
.text 1265168 1265168 0 0.0
lock-app default (read/write) 2218904 2218904 0 0.0
.bss 100968 100968 0 0.0
.data 2416 2416 0 0.0
.heap 929960 929960 0 0.0
.text 1177168 1177168 0 0.0
qpg lighting-app qpg6100+debug (read only) 497012 497012 0 0.0
(read/write) 114140 114140 0 0.0
.bss 50360 50360 0 0.0
.data 1020 1020 0 0.0
.text 491692 491692 0 0.0
lock-app qpg6100+debug (read only) 470916 470916 0 0.0
(read/write) 114144 114144 0 0.0
.bss 49232 49232 0 0.0
.data 976 976 0 0.0
.text 465596 465596 0 0.0
persistent-storage-app qpg6100+debug (read only) 105408 105408 0 0.0
(read/write) 114142 114142 0 0.0
.bss 8986 8986 0 0.0
.data 272 272 0 0.0
.text 100088 100088 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 771514 771514 0 0.0
bss 79216 79216 0 0.0
noinit 37160 37160 0 0.0
text 535570 535570 0 0.0

@austinh0 austinh0 merged commit 2e85d48 into project-chip:master Nov 23, 2021
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