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

[chip-tool] Add write-by-id, command-by-id and a custom payload builder #14398

Merged

Conversation

vivien-apple
Copy link
Contributor

Problem

chip-tool can not issue commands to cluster or commands that are not enabled into the zap file.
This PR exposes adds command-by-id and write-by-id that lets you build commands from the command line directly.

As an example one could do:

$ ./out/debug/standalone/chip-tool onoff write-by-id 0x0 '"u:5"' 0x12345 1 # You need "u:" to specify that it is an unsigned
or much more complex such as:
$ ./out/debug/standalone/chip-tool testcluster write-by-id 0x8000 '[{"255": "2"}, {"1": "hex:0000010202", "3": {"4": [1, 2, 3, {"1": "foo"]} }]' 0x12345 1

Change overview

  • Add command-by-id
  • Add write-by-id
  • Add a custom payload parser that allow building a payload directly from a json-like value on the command line

Testing

I have manually validated that those commands are properly generated and does what is expected. Not as good as building some YAMLs tests but I still need to convert the YAML framework to uses delegates instead of Invoke like calls that strongly typed in order to add some tests...

@github-actions
Copy link

PR #14398: Size comparison from 40cc421 to f0a3381

Full report (8 builds for cyw30739, k32w, qpg, telink)
platform target config section 40cc421 f0a3381 change % change
cyw30739 lock-app CYW30739 (read/write) 538446 538446 0 0.0
.app_xip_area 444884 444884 0 0.0
.bss 76348 76348 0 0.0
.data 560 560 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
light cyw930739m2evb_01 (read/write) 580442 580442 0 0.0
.app_xip_area 485336 485336 0 0.0
.bss 77852 77852 0 0.0
.data 596 596 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
k32w light k32w061+release (read/write) 665224 665224 0 0.0
.bss 77628 77628 0 0.0
.data 1868 1868 0 0.0
.text 579928 579928 0 0.0
lock k32w061+release (read/write) 666192 666192 0 0.0
.bss 77892 77892 0 0.0
.data 1892 1892 0 0.0
.text 580608 580608 0 0.0
qpg lighting-app qpg6105+debug (read only) 572036 572036 0 0.0
(read/write) 146936 146936 0 0.0
.bss 89840 89840 0 0.0
.data 1060 1060 0 0.0
.text 566716 566716 0 0.0
lock-app qpg6105+debug (read only) 518164 518164 0 0.0
(read/write) 146940 146940 0 0.0
.bss 89312 89312 0 0.0
.data 992 992 0 0.0
.text 512844 512844 0 0.0
persistent-storage-app qpg6105+debug (read only) 107140 107140 0 0.0
(read/write) 146940 146940 0 0.0
.bss 38504 38504 0 0.0
.data 288 288 0 0.0
.text 101820 101820 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 848158 848158 0 0.0
bss 87640 87640 0 0.0
noinit 37160 37160 0 0.0
text 592932 592932 0 0.0

@vivien-apple vivien-apple force-pushed the ChipTool_WriteByIdAndCommandById branch from f0a3381 to 88616d3 Compare January 27, 2022 11:44
@github-actions
Copy link

PR #14398: Size comparison from 40cc421 to 88616d3

Full report (8 builds for cyw30739, k32w, qpg, telink)
platform target config section 40cc421 88616d3 change % change
cyw30739 lock-app CYW30739 (read/write) 538446 538446 0 0.0
.app_xip_area 444884 444884 0 0.0
.bss 76348 76348 0 0.0
.data 560 560 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
light cyw930739m2evb_01 (read/write) 580442 580442 0 0.0
.app_xip_area 485336 485336 0 0.0
.bss 77852 77852 0 0.0
.data 596 596 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
k32w light k32w061+release (read/write) 665224 665224 0 0.0
.bss 77628 77628 0 0.0
.data 1868 1868 0 0.0
.text 579928 579928 0 0.0
lock k32w061+release (read/write) 666192 666192 0 0.0
.bss 77892 77892 0 0.0
.data 1892 1892 0 0.0
.text 580608 580608 0 0.0
qpg lighting-app qpg6105+debug (read only) 572036 572036 0 0.0
(read/write) 146936 146936 0 0.0
.bss 89840 89840 0 0.0
.data 1060 1060 0 0.0
.text 566716 566716 0 0.0
lock-app qpg6105+debug (read only) 518164 518164 0 0.0
(read/write) 146940 146940 0 0.0
.bss 89312 89312 0 0.0
.data 992 992 0 0.0
.text 512844 512844 0 0.0
persistent-storage-app qpg6105+debug (read only) 107140 107140 0 0.0
(read/write) 146940 146940 0 0.0
.bss 38504 38504 0 0.0
.data 288 288 0 0.0
.text 101820 101820 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 848158 848158 0 0.0
bss 87640 87640 0 0.0
noinit 37160 37160 0 0.0
text 592932 592932 0 0.0

@vivien-apple vivien-apple force-pushed the ChipTool_WriteByIdAndCommandById branch from 88616d3 to 9412d0f Compare January 27, 2022 12:15
@vivien-apple vivien-apple force-pushed the ChipTool_WriteByIdAndCommandById branch from 9412d0f to 1024dd5 Compare January 27, 2022 12:32
@github-actions
Copy link

github-actions bot commented Jan 27, 2022

PR #14398: Size comparison from 40cc421 to 1024dd5

Increases above 0.2%:

platform target config section 40cc421 1024dd5 change % change
linux chip-tool-ipv6only arm64 (read only) 6537388 6556916 19528 0.3
.text 5598724 5616820 18096 0.3
Increases (1 build for linux)
platform target config section 40cc421 1024dd5 change % change
linux chip-tool-ipv6only arm64 (read only) 6537388 6556916 19528 0.3
(read/write) 275153 275345 192 0.1
.data.rel.ro 174424 174552 128 0.1
.got 40472 40520 48 0.1
.rodata 377140 377644 504 0.1
.text 5598724 5616820 18096 0.3
Full report (33 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 40cc421 1024dd5 change % change
cyw30739 light cyw930739m2evb_01 (read/write) 580442 580442 0 0.0
.app_xip_area 485336 485336 0 0.0
.bss 77852 77852 0 0.0
.data 596 596 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
lock-app CYW30739 (read/write) 538446 538446 0 0.0
.app_xip_area 444884 444884 0 0.0
.bss 76348 76348 0 0.0
.data 560 560 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
efr32 lighting-app BRD4161A (read only) 843492 843492 0 0.0
(read/write) 127396 127396 0 0.0
.bss 125496 125496 0 0.0
.data 1900 1900 0 0.0
.text 843484 843484 0 0.0
BRD4161A+rpc (read only) 830864 830864 0 0.0
(read/write) 144056 144056 0 0.0
.bss 142056 142056 0 0.0
.data 2000 2000 0 0.0
.text 830856 830856 0 0.0
window-app BRD4161A (read only) 816108 816108 0 0.0
(read/write) 126052 126052 0 0.0
.bss 124196 124196 0 0.0
.data 1856 1856 0 0.0
.text 816100 816100 0 0.0
esp32 all-clusters-app c3devkit (read only) 923298 923298 0 0.0
(read/write) 1384986 1384986 0 0.0
.dram0.bss 70880 70880 0 0.0
.dram0.data 14252 14252 0 0.0
.flash.rodata 180936 180936 0 0.0
.flash.text 923298 923298 0 0.0
.iram0.text 62056 62056 0 0.0
m5stack (read only) 972227 972227 0 0.0
(read/write) 452016 452016 0 0.0
.dram0.bss 75624 75624 0 0.0
.dram0.data 34032 34032 0 0.0
.flash.rodata 210232 210232 0 0.0
.flash.text 966843 966843 0 0.0
.iram0.text 123399 123399 0 0.0
k32w light k32w061+release (read/write) 665224 665224 0 0.0
.bss 77628 77628 0 0.0
.data 1868 1868 0 0.0
.text 579928 579928 0 0.0
lock k32w061+release (read/write) 666192 666192 0 0.0
.bss 77892 77892 0 0.0
.data 1892 1892 0 0.0
.text 580608 580608 0 0.0
linux chip-tool-ipv6only arm64 (read only) 6537388 6556916 19528 0.3
(read/write) 275153 275345 192 0.1
.bss 55377 55377 0 0.0
.data 1128 1128 0 0.0
.data.rel.ro 174424 174552 128 0.1
.dynamic 560 560 0 0.0
.got 40472 40520 48 0.1
.init 24 24 0 0.0
.init_array 200 200 0 0.0
.rodata 377140 377644 504 0.1
.text 5598724 5616820 18096 0.3
thermostat-no-ble arm64 (read only) 2082804 2082804 0 0.0
(read/write) 151873 151873 0 0.0
.bss 69585 69585 0 0.0
.data 960 960 0 0.0
.data.rel.ro 74208 74208 0 0.0
.dynamic 560 560 0 0.0
.got 4144 4144 0 0.0
.init 24 24 0 0.0
.init_array 336 336 0 0.0
.rodata 131940 131940 0 0.0
.text 1733616 1733616 0 0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2357384 2357384 0 0.0
.bss 189588 189588 0 0.0
.data 5296 5296 0 0.0
.text 1319984 1319984 0 0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2341088 2341088 0 0.0
.bss 181104 181104 0 0.0
.data 5584 5584 0 0.0
.text 1303688 1303688 0 0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2307840 2307840 0 0.0
.bss 181000 181000 0 0.0
.data 5568 5568 0 0.0
.text 1270440 1270440 0 0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139712 1139712 0 0.0
.bss 11756 11756 0 0.0
.data 4368 4368 0 0.0
.text 103096 103096 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2294044 2294044 0 0.0
.bss 177732 177732 0 0.0
.data 5384 5384 0 0.0
.text 1256616 1256616 0 0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 983707 983707 0 0.0
bss 120860 120860 0 0.0
rodata 116480 116480 0 0.0
text 668576 668576 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 967571 967571 0 0.0
bss 117904 117904 0 0.0
rodata 108016 108016 0 0.0
text 663248 663248 0 0.0
nrf52840dongle_nrf52840 (read/write) 999827 999827 0 0.0
bss 122032 122032 0 0.0
rodata 115332 115332 0 0.0
text 674004 674004 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 892930 892930 0 0.0
bss 117648 117648 0 0.0
rodata 109780 109780 0 0.0
text 584756 584756 0 0.0
lock-app nrf52840dk_nrf52840 (read/write) 916323 916323 0 0.0
bss 119240 119240 0 0.0
rodata 105120 105120 0 0.0
text 614560 614560 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 826358 826358 0 0.0
bss 116056 116056 0 0.0
rodata 98344 98344 0 0.0
text 531512 531512 0 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 541835 541835 0 0.0
bss 52588 52588 0 0.0
rodata 50104 50104 0 0.0
text 376940 376940 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 919187 919187 0 0.0
bss 118992 118992 0 0.0
rodata 105632 105632 0 0.0
text 617096 617096 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 914371 914371 0 0.0
bss 119016 119016 0 0.0
rodata 104736 104736 0 0.0
text 613132 613132 0 0.0
shell nrf52840dk_nrf52840 (read/write) 798203 798203 0 0.0
bss 109776 109776 0 0.0
rodata 78288 78288 0 0.0
text 533640 533640 0 0.0
p6 all-clusters-app default (read/write) 2418240 2418240 0 0.0
.bss 117932 117932 0 0.0
.data 2592 2592 0 0.0
.text 1376504 1376504 0 0.0
light-app default (read/write) 2339064 2339064 0 0.0
.bss 105684 105684 0 0.0
.data 2408 2408 0 0.0
.text 1297328 1297328 0 0.0
lock-app default (read/write) 2304584 2304584 0 0.0
.bss 105428 105428 0 0.0
.data 2360 2360 0 0.0
.text 1262848 1262848 0 0.0
qpg lighting-app qpg6105+debug (read only) 572036 572036 0 0.0
(read/write) 146936 146936 0 0.0
.bss 89840 89840 0 0.0
.data 1060 1060 0 0.0
.text 566716 566716 0 0.0
lock-app qpg6105+debug (read only) 518164 518164 0 0.0
(read/write) 146940 146940 0 0.0
.bss 89312 89312 0 0.0
.data 992 992 0 0.0
.text 512844 512844 0 0.0
persistent-storage-app qpg6105+debug (read only) 107140 107140 0 0.0
(read/write) 146940 146940 0 0.0
.bss 38504 38504 0 0.0
.data 288 288 0 0.0
.text 101820 101820 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 848158 848158 0 0.0
bss 87640 87640 0 0.0
noinit 37160 37160 0 0.0
text 592932 592932 0 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, given this is adding tooling to unblock testing.

@woody-apple woody-apple merged commit fcc1c7d into project-chip:master Jan 27, 2022
selissia pushed a commit to selissia/connectedhomeip that referenced this pull request Jan 28, 2022
…er (project-chip#14398)

* [chip-tool] Add write-by-id, command-by-id and a custom payload builder

* Update generated content
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.

2 participants