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

Add JSON as a format option for targets command in build_examples.py #25810

Merged
merged 9 commits into from
Mar 25, 2023

Conversation

nekleo
Copy link
Contributor

@nekleo nekleo commented Mar 23, 2023

The targets command outputs the targets that are available for the build and gen commands in a string format that is easy to read but hard to parse. This change adds a option for the targets command to output JSON so that the available targets can be more easily parsed. To do this, ToDict methods were added to BuildTarget and TargetPart classes. When the --format json option is used with the targets command build_examples.py calls the ToDict method of each BuildTarget object and outputs to stdout a list of Dicts in JSON, one for each BuildTarget.

The `targets` command outputs the targets that are available for the
`build` and `gen` commands in a string format that is easy to read but
hard to parse. This change adds a option for the `targets` command to
output JSON so that the available targets can be more easily parsed.
To do this, ToDict methods were added to BuildTarget and TargetPart
classes. When the `--format json` option is used with the `targets`
command `build_examples.py` calls the ToDict method of each BuildTarget
object and outputs to stdout a list of Dicts in JSON, one for each
BuildTarget.
@CLAassistant
Copy link

CLAassistant commented Mar 23, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

PR #25810: Size comparison from a4a407b to ba31e34

Full report (1 build for cc32xx)
platform target config section a4a407b ba31e34 change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 645825 645825 0 0.0
(read/write) 203848 203848 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197248 197248 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 930266 930266 0 0.0
.debug_aranges 87376 87376 0 0.0
.debug_frame 300288 300288 0 0.0
.debug_info 20229260 20229260 0 0.0
.debug_line 2661728 2661728 0 0.0
.debug_loc 2806516 2806516 0 0.0
.debug_ranges 283400 283400 0 0.0
.debug_str 3028246 3028246 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 105993 105993 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 380469 380469 0 0.0
.symtab 257408 257408 0 0.0
.text 537712 537712 0 0.0

@nekleo nekleo marked this pull request as ready for review March 23, 2023 23:53
@nekleo nekleo marked this pull request as draft March 23, 2023 23:54
@github-actions
Copy link

PR #25810: Size comparison from a4a407b to 7ab15e0

Full report (1 build for cc32xx)
platform target config section a4a407b 7ab15e0 change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 645825 645825 0 0.0
(read/write) 203848 203848 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197248 197248 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 930266 930266 0 0.0
.debug_aranges 87376 87376 0 0.0
.debug_frame 300288 300288 0 0.0
.debug_info 20229260 20229260 0 0.0
.debug_line 2661728 2661728 0 0.0
.debug_loc 2806516 2806516 0 0.0
.debug_ranges 283400 283400 0 0.0
.debug_str 3028246 3028246 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 105993 105993 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 380469 380469 0 0.0
.symtab 257408 257408 0 0.0
.text 537712 537712 0 0.0

Simplied the code that ceates dictionaries and lists from data contained
within the BuildTarget and TargetPart objects. Also, corrected
some comments, and put List and Dict types where appropriate.
@github-actions
Copy link

PR #25810: Size comparison from a4a407b to ccf235c

Full report (1 build for cc32xx)
platform target config section a4a407b ccf235c change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 645825 645825 0 0.0
(read/write) 203848 203848 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197248 197248 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 930266 930266 0 0.0
.debug_aranges 87376 87376 0 0.0
.debug_frame 300288 300288 0 0.0
.debug_info 20229260 20229260 0 0.0
.debug_line 2661728 2661728 0 0.0
.debug_loc 2806516 2806516 0 0.0
.debug_ranges 283400 283400 0 0.0
.debug_str 3028246 3028246 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 105993 105993 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 380469 380469 0 0.0
.symtab 257408 257408 0 0.0
.text 537712 537712 0 0.0

scripts/build/build/target.py Outdated Show resolved Hide resolved
scripts/build/build/target.py Outdated Show resolved Hide resolved
nekleo and others added 2 commits March 24, 2023 12:29
BuildTarget ToDict method was incorrectly converting the
fixed_targets list to a dictionary, losing data.
@github-actions
Copy link

PR #25810: Size comparison from 275dbe1 to 2a9f942

Full report (1 build for cc32xx)
platform target config section 275dbe1 2a9f942 change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 645737 645737 0 0.0
(read/write) 203848 203848 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197248 197248 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 930282 930282 0 0.0
.debug_aranges 87392 87392 0 0.0
.debug_frame 300360 300360 0 0.0
.debug_info 20225165 20225165 0 0.0
.debug_line 2661721 2661721 0 0.0
.debug_loc 2806103 2806103 0 0.0
.debug_ranges 283440 283440 0 0.0
.debug_str 3022279 3022279 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 105953 105953 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 380574 380574 0 0.0
.symtab 257456 257456 0 0.0
.text 537664 537664 0 0.0

scripts/build/build/target.py Outdated Show resolved Hide resolved
nekleo and others added 2 commits March 24, 2023 14:38
Each time AppendFixedTargets method of BuildTarget is called, a list of
TargetPart objects is appended to the fixed_targets list. This change
perserves the developer's intent by keeping the list of lists structure
intact rather than flatting it out into one list.
@github-actions
Copy link

PR #25810: Size comparison from 7326cf8 to 466bdab

Decreases (1 build for cc32xx)
platform target config section 7326cf8 466bdab change % change
cc32xx lock CC3235SF_LAUNCHXL .debug_info 20225166 20225165 -1 -0.0
Full report (1 build for cc32xx)
platform target config section 7326cf8 466bdab change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 645737 645737 0 0.0
(read/write) 203848 203848 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197248 197248 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 930282 930282 0 0.0
.debug_aranges 87392 87392 0 0.0
.debug_frame 300360 300360 0 0.0
.debug_info 20225166 20225165 -1 -0.0
.debug_line 2661721 2661721 0 0.0
.debug_loc 2806103 2806103 0 0.0
.debug_ranges 283440 283440 0 0.0
.debug_str 3022279 3022279 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 105953 105953 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 380574 380574 0 0.0
.symtab 257456 257456 0 0.0
.text 537664 537664 0 0.0

@github-actions
Copy link

PR #25810: Size comparison from 7326cf8 to 3f775cf

Decreases (1 build for cc32xx)
platform target config section 7326cf8 3f775cf change % change
cc32xx lock CC3235SF_LAUNCHXL .debug_info 20225166 20225165 -1 -0.0
Full report (1 build for cc32xx)
platform target config section 7326cf8 3f775cf change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 645737 645737 0 0.0
(read/write) 203848 203848 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197248 197248 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 930282 930282 0 0.0
.debug_aranges 87392 87392 0 0.0
.debug_frame 300360 300360 0 0.0
.debug_info 20225166 20225165 -1 -0.0
.debug_line 2661721 2661721 0 0.0
.debug_loc 2806103 2806103 0 0.0
.debug_ranges 283440 283440 0 0.0
.debug_str 3022279 3022279 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 105953 105953 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 380574 380574 0 0.0
.symtab 257456 257456 0 0.0
.text 537664 537664 0 0.0

@andy31415 andy31415 merged commit 2b65794 into project-chip:master Mar 25, 2023
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.

5 participants