Commit Graph

155 Commits

Author SHA1 Message Date
Brian S. Stephan 853283e69c
edit-config over USB 2023-07-09 10:47:27 -05:00
Brian S. Stephan 2c446f595a
a bit more coverage around USB interactions (aka lots of mocks) 2023-07-09 10:41:40 -05:00
Brian S. Stephan 5bcb3dba3f
method to write the config over USB at the proper alignment 2023-07-09 10:03:44 -05:00
Brian S. Stephan 2d024c5b34
pico.write must happen at 256 byte boundaries
there's no good way to tell if the payload should be padded or if it
should just be realigned, so raise an exception and make the caller
figure it out
2023-07-09 09:16:55 -05:00
Brian S. Stephan c25f6f4fd3
add command for writing to the BOOTSEL Pico 2023-07-08 23:48:47 -05:00
Brian S. Stephan a1e3955a1f
add command to erase a section of flash
used by picotool as part of the write, so we'll do the same
2023-07-08 23:25:38 -05:00
Brian S. Stephan fcb68a1b24
it's not possible to mock a run() invocation, bss, you silly man 2023-07-08 23:23:00 -05:00
Brian S. Stephan 654bebdeb6
test an invocation of dump-config 2023-07-07 20:21:58 -05:00
Brian S. Stephan 7a9d5ad1d1
dump-config tool to easily backup a board's config section
doesn't require picotool, doesn't include padding, does include the
footer
2023-07-07 20:09:00 -05:00
Brian S. Stephan e2ad75371e
DRY: convenience method to get config from USB 2023-07-07 20:03:41 -05:00
Brian S. Stephan 61aadae2ca
tiny README organization change 2023-07-07 19:00:12 -05:00
Brian S. Stephan 0378269a00
--usb flag to edit-config direct off the board 2023-07-07 18:58:25 -05:00
Brian S. Stephan 70d3ce8be0
--usb flag to visualize-storage direct off the board 2023-07-07 18:31:13 -05:00
Brian S. Stephan 10dcd149cc
add methods to read directly off the board over USB 2023-07-07 16:45:07 -05:00
Brian S. Stephan 772ae953f0
add method to reboot a pico (in BOOTSEL) 2023-07-06 16:07:06 -05:00
Brian S. Stephan 188976474a
update installation instructions 2023-07-06 00:06:38 -05:00
Brian S. Stephan 6580990380
pyproject.toml tweaks for publishing as a package 2023-07-05 23:56:59 -05:00
Brian S. Stephan 221f45557e
support the adding of new repeated elements
take for instance:
repeated AlternativePinMappings alternativePinMappings = 1 [(nanopb).max_count = 3];

this, in C, creates a three-struct-sized array alternativePinMappings[].
in python, this is the same idea, where profileOptions' field is a
special container to which AlternativePinMappings can be added. this
allows adding elements via the UI. it does *NOT* implement limits (yet?)
so you can add more (and I think the board will just ignore them and
drop them on write)
2023-07-01 17:05:19 -05:00
Brian S. Stephan 91db1b169c
update test .protos with main + repeated example 2023-07-01 14:45:32 -05:00
Brian S. Stephan c60a5e784d
refactor to retain field_value in case it is a message
we can save some config lookups in this case (in particular in the case
where we are working with repeateds and the lookup against an iterable
won't work)
2023-07-01 13:00:48 -05:00
Brian S. Stephan 71f6af624e
refactor to add a node outside of the main tree builder 2023-07-01 12:24:31 -05:00
Brian S. Stephan 7aee99ef4f
allow for "opening" an empty config from file 2023-06-30 23:12:53 -05:00
Brian S. Stephan 7d5052e811
add edit-config, a Textual TUI for editing a configuration
this tree UI allows for viewing and basic editing of a configuration
section from a board. it does a decent job of displaying most of the
settings, and editing is equally convenient, as in it tries to handle
enums correctly, but doesn't validate pins or handle long binary strings
well.

saving is done in place --- if a config/storage section was opened, a
config section (no padding) is what results. if a whole board was
opened, the whole binary is rewritten with the new offset config
section. this way, a whole board dump can be changed in place, or a new
config can be made for use in e.g. concatenate to build an image

many enhancements to come over time
2023-06-30 02:01:01 -05:00
Brian S. Stephan 9b43ac824d
add more methods for writing a config to file
these allow for adding a config to the proper section of an existing
binary file, or writing a config to a new config-only binary file
2023-06-29 14:43:46 -05:00
Brian S. Stephan cbf0f52841
add method to generate a serialized + footer config 2023-06-28 19:21:27 -05:00
Brian S. Stephan 1345e8b18d
add length info to exceptions complaining about length 2023-06-28 14:38:13 -05:00
Brian S. Stephan 39fa558741
check the config's CRC32 checksum while reading 2023-06-28 14:38:10 -05:00
Brian S. Stephan 51445163a8
add mypy (with some overrides) to tox 2023-06-28 12:55:50 -05:00
Brian S. Stephan 095fac19f1
properly account for combining config section with firmware
prior to this, the concatenate assumed it was concatenating a firmware
with a full *storage section*, e.g. the already-padded 8192 bytes, but
it's equally valuable now that I'm creating configs to have just a
config section + footer, which needs to be padded 8192. now concatenate
supports both
2023-06-28 12:52:49 -05:00
Brian S. Stephan 85d84144fc
concatenate command: combine firmware and storage into one file 2023-06-26 15:32:32 -05:00
Brian S. Stephan c9b443f993
test/check to make sure I don't check in PS4 stuff 2023-06-26 14:53:37 -05:00
Brian S. Stephan 229092dd66
custom config validation exceptions
might be useful when allowing for ignoring specific sanity checks
2023-06-22 00:08:12 -05:00
Brian S. Stephan 1b02e458e2
visualize-storage flag to print as JSON
closes #3
2023-06-21 18:21:22 -05:00
Brian S. Stephan 88ca5c5152
more tests for command invocations 2023-06-21 17:54:27 -05:00
Brian S. Stephan 5b8dc456f1
option to get the config out of a whole board dump
now you don't need to fiddle with specific byte ranges of a dump, you
can just dump the whole board if that's more convenient, and
visualize-storage will parse that

also more testing in general
2023-06-21 15:20:21 -05:00
Brian S. Stephan 3dcc0d4c59
trivial requirements-dev.txt version bump 2023-06-21 12:35:22 -05:00
Brian S. Stephan d31c451d0c
tox for local CI, with coverage and bandit checks added 2023-06-21 12:31:58 -05:00
Brian S. Stephan e6f6a888a5
bump minimum python to 3.9, we're using subscriptable type hints 2023-06-21 09:11:05 -05:00
Brian S. Stephan a088cdcd73
unit tests for config parsing out of storage
closes #1
2023-06-20 20:01:22 -05:00
Brian S. Stephan 54035de00a
add pytest, test creation/import of config_pb2 module 2023-06-20 19:57:38 -05:00
Brian S. Stephan 0c7ed1fcea
improve storage parsing by using footer for sanity
magic is checked for sanity, and then the size is used for reading the
whole section rather than simply ignoring null bytes

closes #2
2023-06-20 19:57:28 -05:00
Brian S. Stephan 8404ec0d54
add mypy to the development tools 2023-06-20 18:26:29 -05:00
Brian S. Stephan a55bea087c
add help text to the --version flag 2023-06-20 18:19:50 -05:00
Brian S. Stephan dbd392cade
set up some sane-ish logging defaults 2023-06-20 18:17:46 -05:00
Brian S. Stephan 518aae359d
provide shortcut for the proto file path option 2023-06-20 15:45:31 -05:00
Brian S. Stephan 35abad327e
dynamically generate version number based on git 2023-06-20 15:43:21 -05:00
Brian S. Stephan 1302cb914c
correct wording of what get_config_pb2 is doing 2023-06-20 13:30:48 -05:00
Brian S. Stephan d201855841
remove my goofy .bin filename from the example
c'mon bss
2023-06-20 13:27:22 -05:00
Brian S. Stephan 8e8feae77a
clarify that users *probably* want picotool 2023-06-20 13:24:24 -05:00
Brian S. Stephan d6657fa750
sample visualize-storage output, doc on dumping storage 2023-06-20 13:20:49 -05:00