Commit Graph

70 Commits

Author SHA1 Message Date
Brian S. Stephan 99504bfde6
support loading JSON files as configs to edit
Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-20 21:31:14 -05:00
Brian S. Stephan 56eb65dd55
tweak the version flag output to show more package/system info
Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-19 08:11:20 -05:00
Brian S. Stephan 58f2f38546
preliminary support for writing configs direct to JSON
I'm hoping this will allow for editing the JSON configs directly with
edit-config

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-15 20:14:08 -05:00
Brian S. Stephan 2648aebd4f
add --backup flag to concatenate
makes it so that we retain the old file, e.g. GP2040CE.uf2.old if we're
about to write GP2040CE.uf2

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-15 10:13:28 -05:00
Brian S. Stephan 6a802bb232
support reading segmented UF2 files
now that we create segmented UF2 files properly in concatenate, we need
the ability to read them, which we'd previously saved for later; that
time is now. the reader now supports jumps forward (but not backwards,
and I don't know how likely it is we'll ever see this)

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-15 09:25:26 -05:00
Brian S. Stephan e133abc922
concatenate smaller UF2s by using indexed offsets
previous commit added the ability to pass a list of location+binary
combinations to create UF2s, meaning we no longer need to pad the
concatenated UF2 the same way we pad the raw binary output. this makes
for a more sanely-sized UF2 and faster write

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-14 23:26:50 -05:00
Brian S. Stephan 2bb049c442
take multiple binary arguments to convert_binary_to_uf2
this is in preparation for making smaller .uf2 files buy not needing
padding, instead passing multiple location+binary combos to the
converter

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-14 22:54:05 -05:00
Brian S. Stephan 5022616f1d
summarize-gp2040ce --- print information about firmware
can be read from a file or over USB

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-12 20:13:38 -05:00
Brian S. Stephan a0734c9b48
add method to search for version strings in binaries
Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-12 20:01:20 -05:00
Brian S. Stephan 1f65f23a4f
clean up the huge import list in these tests
Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-12 20:01:20 -05:00
Brian S. Stephan 2a40c70b56
cover a bit more TUI in tests, and remove dead branches
Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-12 20:01:20 -05:00
Brian S. Stephan e35d8dbf3d
add some more UF2 tests and sanity checks
Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-12 20:01:20 -05:00
Brian S. Stephan 6bc93f148b
allow for reading UF2 files in visualize-config
Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-12 16:21:20 -05:00
Brian S. Stephan 2ce0c4d7df
don't "optimize" the UF2 until the combination is fixed
naively adding UF2 blocks together is at least wrong by spec; it
produces one file with wrong block counts --- say I'm writing 3770
blocks, the naive uf2(firmware) + uf2(config) solution yields a file
that says it's 3642 blocks for a while, then 128 blocks. picotool kind
of does a "wtf" at this but writes it anyway, but I am not confident
this is safe, so I'll just do the dumb thing again for now (meaning we
pretty much always write 8128 or 8192 blocks when concatenating configs)

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-12 15:27:58 -05:00
Brian S. Stephan 8e6a203398
improve concatenate to create smaller UF2s
the prior version, for the board/user configs, took the whole ~2MB
binary file and converted it to a UF2, which made for a lot of chunks
that were just writing 0s, between the end of the firmware and the start
of the config(s). this changes the logic to build each portion as
separate UF2 chunks and then combine them.

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-12 13:09:02 -05:00
Brian S. Stephan 65ae51af72
rename visualize-storage as visualize-config
Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-12 10:39:29 -05:00
Brian S. Stephan e0f5f8fb5a
rename output file argument to concatenate
to reduce confusion, now that this supports UF2 output, it's not
necessarily a new *binary* file

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-12 07:38:22 -05:00
Brian S. Stephan 3e8209e2a5
update .proto snapshot for v0.7.8
this also clarifies the docs a bit regarding versions supported.

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-04-08 09:07:47 -05:00
Brian S. Stephan 3a55cad86f
implement Save As... in the TUI
this allows for loading an existing GP2040-CE dump or board in BOOTSEL
over USB and saving the parsed configuration to a new .bin/.uf2 file.
might be useful for making quick backups or variants of configs

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-03-26 13:47:30 -05:00
Brian S. Stephan f6d3ad02e0
support writing new configs as .uf2 files via the TUI
`edit-config --filename foo.uf2` can now create standalone config UF2
files. still working on reading UF2s, or maybe what edit-config needs is
a "Save As..." in order to read from a board/config and output it to a
new file, but this is a start

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-03-25 12:01:52 -05:00
Brian S. Stephan a3f9f12e74
move UF2 converter to storage, allow specifying start address
the former is to avoid an upcoming circular dependency, the latter is to
allow for creating an e.g. user-config-only .uf2 by specifying the
proper offset to start the UF2 addressing at.

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-03-25 09:19:58 -05:00
Brian S. Stephan b900e1dd04
relicense as GPLv3
prior MIT-licensed versions can be obtained from the Git history; this
does not revoke those versions

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-03-08 00:02:43 -06:00
Brian S. Stephan df875a5d99
rename GUI Save button as Confirm
more idiomatic this way, since it's really just "set the value", not
actually saving the config

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-02-17 23:05:51 -06:00
Brian S. Stephan b3f6f86950
ship precompiled protobuf files for convenience
current libraries seem to have problems on Windows with thinking files
are duplicated when they are not, making it impossible to compile .proto
files at runtime in this tool on that platform. this adds a fallback of
using shipped, precompiled files in the package. I was already intending
on providing this as an option anyway, so might as well start doing it
now.

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-01-09 09:40:07 -06:00
Brian S. Stephan d6857d5da1
add a method to convert binary content to UF2
will be used in concatenate in order to write .uf2 files

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-01-06 20:51:28 -06:00
Brian S. Stephan 314fc909ff
flag and method to visualize the board config
via file dump or via USB. used to test the writing of the board config
to binary

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-01-06 17:27:33 -06:00
Brian S. Stephan 0d54d3b805
concatenate flags to combine board and user configs
Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-01-06 13:45:12 -06:00
Brian S. Stephan ef71db6f5e
methods to add/retrieve board config to binary
with this, the combining methods can combine both a board and user
config into one binary, which is a step closer to having a command that
does it, and then we can start removing BoardConfig.h from the firmware
build and replace it with patched binaries.

to test it, another retrieval method was added too, and this will
probably be used for more dump commands or a better info or something
like that

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-01-06 11:43:54 -06:00
Brian S. Stephan bc64a6531b
add a method to pad a binary to the spot of the board config
the board config will be the same space as the user config, directly in
front of it in the flash

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-01-05 23:42:45 -06:00
Brian S. Stephan 841c3a38c3
s/get_storage_section/get_user_storage_section/
more renaming to make room for future methods

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-01-05 21:13:14 -06:00
Brian S. Stephan 578fd416da
rename get_config_from_usb as get_user_config_from_usb
this is to distinguish from the board config later

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-01-05 21:13:10 -06:00
Brian S. Stephan 8681a18d26
s/pad_firmware_up_to_storage/pad_binary_up_to_user_config/
this is just to clarify the purpose of this since a related method is
coming soon for the board config

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-01-03 18:13:54 -06:00
Brian S. Stephan 1966f6a71e
option to concatenate to combine a JSON config to a binary
this allows for putting a JSON representation of a config into the user
config area of a binary to be flashed on the board. this allows for
conveying configs as simple JSON files and using them to convey specific
binaries by parts

this is the start of the support to use JSON files on a *new* section of
the binary reserved for board default configs

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-01-03 13:35:26 -06:00
Brian S. Stephan f2ed281053
test parsing config as JSON into a message
this also bumps the proto files in the test directory as a matter of
convenience, so some tests got updated accordingly

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-01-03 12:20:54 -06:00
Brian S. Stephan 23cb5c9e5a
add SPDX-FileCopyrightText
Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-01-02 15:15:55 -06:00
Brian S. Stephan b2bf7984b0
add SPDX-License-Identifier: MIT to all source
Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2023-12-18 10:17:35 -06:00
Brian S. Stephan fc022452f5
replace most references to pico with RP2040 2023-11-07 00:26:51 -06:00
Brian S. Stephan fcb1297139
test with 0.7.5 files, which has an expanded config section 2023-11-06 23:55:01 -06:00
Brian S. Stephan cce165f012
add flag to have concatenate write direct to USB 2023-07-12 17:50:43 -05:00
Brian S. Stephan fb1729a957
write in 4096 byte chunks 2023-07-12 17:33:12 -05:00
Brian S. Stephan 8c5bd4397f
allow edit-config to fallback to new config if old doesn't exist 2023-07-12 00:08:55 -05:00
Brian S. Stephan 6a147aa1d8
attempt to address USB corruption by padding more 2023-07-11 23:28:34 -05:00
Brian S. Stephan a7b8309b33
--replace-extra to overwrite config area when concatenating 2023-07-11 18:36:17 -05:00
Brian S. Stephan b7bb437ae8
command to dump whole GP2040-CE image from USB 2023-07-11 16:27:01 -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