722 Commits

Author SHA1 Message Date
Jesse Braham
8dea4e67c4
Add chip detection using security info (#814)
* Add the ability to create a `Chip` from its corresponding chip ID

* Attempt to detect chip using security info first, and use magic value if this fails

* Update timeouts in HIL workflow

* Update `CHANGELOG.md`

* Increase more timeouts for HIL
2025-03-26 11:54:18 +00:00
Dániel Buga
a9c1686f30
Handle key events in non-interactive mode, too (#819) 2025-03-25 14:34:53 +00:00
Dániel Buga
17aa6f16af
Option to supply custom defmt formats (#818)
* Add output format argument

* Load defmt location data

* Use user-provided defmt format

* Changelog
2025-03-25 14:34:36 +00:00
Dániel Buga
b028c5295e
Detect log format metadata (#809)
* Detect log format metadata

* Match section name

* Update HIL test

* Changelog
2025-03-25 09:33:24 +00:00
Dániel Buga
ee954b2c7b
Fix connecting to S2 over USB (#813) 2025-03-24 15:00:24 +00:00
Kirill Mikhailov
dc81d8f5be
Add ROM version of read-flash command (#812)
* Add `ROM` version of `read-flash` command

* changelog entry

* dumb
2025-03-24 08:04:19 +00:00
Jesse Braham
dad60cf3ad
Remove unused dependencies, deduplicate some functions (#811)
* Remove unused dependencies from `cargo-espflash`

* Move common functions from binaries to `cli` module
2025-03-21 07:55:47 +00:00
Juraj Sadel
fa6b970e01
Implement new USB Serial JTAG reset strategy (#779)
* Add watchdog reset experiment

* changelog

* Add bitflags dependency and cleanup

* fix register values, ... again

* Add P4

* reviews

* move connection_is_usb_otg to Connection struct and rename it to is_using_usb_otg

* fix ci

* Use latest version of `bitflags`

* Move and improve the `RtcWdtReset` trait

* Introduce `UsbOtg` trait for targets

* Fix some warnings

* Cleanup

---------

Co-authored-by: Jesse Braham <jesse@beta7.io>
2025-03-12 12:53:55 +00:00
Sergio Gasquez Arcos
ba14587fb0
Fix readmes links (#805)
* docs: Add missing link

* docs: Fix links

* docs: Update docstrings

* docs: fix typo

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>

* docs: Update docstrings

* docs: Udpate usage

---------

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
2025-03-06 12:07:20 +00:00
Kirill Mikhailov
b7d9849b85
Fix read-flash which didn't work with some lengths (#804)
* wip

* finalize + hil test

hil test

* changelog entry

* fix
2025-03-06 07:28:30 +00:00
Jesse Braham
eb963d709d
Refactoring: remove the FirmwareImage trait and eliminate the elf module (#802)
* Use `ElfFile` instead of `dyn FirmwareImage` where able

* Convert the `image_format` module to a directory

* Eliminate the `elf` module, move its contents to `image_format`

* Eliminate the `FirmwareImage` trait

* Update `CHANGELOG.md`
2025-03-05 12:01:48 +00:00
Sergio Gasquez Arcos
6db4b06945
feat: Remove publish to crates.io job (#801) 2025-03-05 08:40:22 +00:00
Jesse Braham
d8ab6ac5d1
Update cargo dependency in cargo-espflash (#800) 2025-03-05 08:35:40 +00:00
Kirill Mikhailov
b1483867b4
add --monitor option to write-bin (#783)
* changelog entry

* rebase

* fix

* update hil test

* increase timeout

increase timeout even more

* Fix CHANGELOG.md

Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com>

* play around timer....

increase timer

---------

Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com>
2025-03-04 12:53:31 +00:00
Sergio Gasquez Arcos
f86b149e81
Update flash size (#797)
* feat: Update flash size if not provided and read from the target

* feat: Move logic inside make_flash_settings

* docs: Udpate changelog

* Don't require passing `Flasher` struct around

---------

Co-authored-by: Jesse Braham <jesse@beta7.io>
2025-03-04 09:59:34 +00:00
Jesse Braham
0df6d25d92
Don't expose PartitionTable struct in public APIs, simplify IdfBootloaderFormat constructor (#798)
* Simplify `IdfBootloaderFormat` constructor, make `default_partition_table` private

* Move `parse_partition_table` to the `cli` module

* Update `CHANGELOG.md`
2025-03-03 12:00:11 +00:00
Jesse Braham
f73fef444f
Refactor and simplify the elf module a bit (#796)
* Eliminate the `ElfFirmwareImage` struct

* Eliminate redundant `RomSegment` struct, rename `CodeSegment` to `Segment`

* Re-export types which need to be public from `elf` module

* Update `CHANGELOG.md`

* Remove unused `segments_with_load_addresses` function
2025-02-28 11:01:53 +00:00
Jesse Braham
11a5b7bb83
Minor error handling and function naming improvements (#795)
* Remove unnecessary `Result` from return type, don't leak constants from `connection` module

* Improve error handling when receiving an invalid command response type

* Update `CHANGELOG.md`
2025-02-28 10:06:08 +00:00
Jesse Braham
acf2034f80
Update HIL workflow to use ubuntu-22.04, build in container to resolve GLIBC errors (#791) 2025-02-27 10:41:20 +00:00
Sergio Gasquez Arcos
1b23853a4f
[cargo-espflash]: Add write-bin subcommand (#789)
* feat: Add write-bin subcommand

* docs: Update changelog

* docs: Add docstring
2025-02-27 09:47:02 +00:00
Sergio Gasquez Arcos
e41be4f5eb
Fix write-bin padding (#788)
* feat: Update the way we pad bins

* tests: Add HIL test for writting bins

* ci: Fix timeouts

* test: Fix HIL write-bin  test

* docs: Update changelog

* docs: Remove outdate file

* feat: Avoid vec allocation
2025-02-26 15:00:50 +00:00
Juraj Sadel
473701c5e6
Fix write-bin for files whose lengths are not divisible by 4 by padding FF bytes (#780)
* Fix write-bin for files whose lengths are not divisible by 4 by pading FF bytes

* changelog
2025-02-25 10:06:10 +00:00
Jesse Braham
7e9662884a
Fix typos in error variants names, resolve clippy warnings (#782)
* Fix typos in error variant names

* Resolve clippy errors

* Update `CHANGELOG.md`
2025-02-25 09:48:10 +00:00
Jesse Braham
b5b2e044dd
Update addr2line and crossterm dependencies (#778) 2025-02-18 12:12:47 +00:00
Juraj Sadel
e50c880982
Add timeout to HIL tests (#776)
* Add timeout to HIL tests

* Increase timeout for save-image_write-bin test
2025-02-18 10:54:24 +00:00
Juraj Sadel
529b438468
Mention WSL2 in READMEs (#775)
* Mention WSL2 in READMEs

* reviews
2025-02-18 09:59:12 +00:00
Jesse Braham
be1ff81b15
Refactor: make more modules private (#772)
* Move `command` module into `connection` module

* Make the `elf` and `error` modules private

* Don't document the modules/types behind the `cli` feature

* Clean up some imports

* Remove unused code

* Miscellaneous cleanup

* Update `CHANGELOG.md`
2025-02-17 11:23:07 +00:00
Sergio Gasquez Arcos
7495637db0
Improve HIL tests (#773)
* tests: Add log-format test

* ci: Add list-ports test

* feat: Read a larger flash section

* feat: Update how we check the erase-region command

* fix: Elf paths

* fix: Typo

* feat: Add defmt_log level

* feat: Update defmt elf

* docs: Add instructions to build defmt elf

* feat: Change test order to keep a non-defmt elf flashed on c6
2025-02-17 10:45:00 +00:00
Juraj Sadel
403b93d2e2
erase-region: Check if the address and size is multiple of 4096 and add HIL test (#771)
* erase-region: Check if the address and size is multiple of 4096 and add test

* changelog

* reviews

* updated test
2025-02-17 08:41:09 +00:00
AVee
7b6e5e1164
Add list-ports command to show the available serial ports. (#761) 2025-02-14 14:43:25 +00:00
Sergio Gasquez Arcos
e765bd8636
Normalize similar arguments (#759)
* feat: Normalize similar arguments

* feat: Remove unnecesary value_names

* feat: Remove some short version of arguments

* docs: Update changelog

* tests: Fix arguments

* feat: Use elf for MonitorConfigArgs to avoid duplication

* feat: Rename monitor_baud arg

* fix: Allow using log-format with custom runner

* feat: Add help for NoElf error

* clippy: Remove too_many_args expection
2025-02-14 10:30:55 +00:00
Jesse Braham
bba904084f
Remove special handling of MUSL Linux now that we no longer use libudev (#749) 2025-02-13 14:29:09 +00:00
Juraj Sadel
158764f82d
Add get-security-info command (#758)
* Add get-security-info command

* changelog

* fix clippy

* reviews

* Update HIL for get_security_info

* update changelog

* reviews

* HIL

* reviews

* fmt

* revert

* refactor error handling

* rebase and update S2 response length check

* fix S2 when no-stub flag is used, address comments

* Hack around strange command responses, make security info work with and without stub

---------

Co-authored-by: Jesse Braham <jesse@beta7.io>
2025-02-13 12:50:46 +00:00
Sergio Gasquez Arcos
da99a6df5c
Improve monitoring (#737)
* feat: Make non-interactive available in other commands

* feat: Use monitor_args in monitor()

* feat: Move elf arg to MonitorConfigArgs

* docs: Udpate changelog

* docs: Update readmes

* feat: Use parse_u32

* tests: Add espflash flash --monitor tests

* feat: Allow underscores in parse_u32
2025-02-12 11:43:10 +00:00
Jesse Braham
4ee4b59862
Swap out the flasher stubs with the legacy C stubs (#763) 2025-02-12 10:53:05 +00:00
Jesse Braham
d4da01ecc2
Remove the dependency on parse_int in favour of from_str_radix (#756)
* Remove the dependency on `parse_int` in favour of `from_str_radix`

* Add a unit test for the `parse_u32` function
2025-02-11 10:09:32 +00:00
Sergio Gasquez Arcos
6f3c96d11b
Improve HIL (#754)
* ci: Use job.env to avoid duplications

* ci: Add erase-region, hold-in-reset, reset and checksum-md5 tests

* ci: Use bash scripts

* cI: Update workflow

* feat: Udpate testing elfs

* test: Read 0x2000 bytes of flash

* docs: Add TODOs for issue #697

* fix: Typo

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>

* docs: Improve the todo comment

---------

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
2025-02-11 08:20:47 +00:00
Jesse Braham
ad1cb9f03b
Remove the dependency on lazy_static in favour of buildt-in LazyLock (#755) 2025-02-10 12:32:31 +00:00
Jesse Braham
c73ea4dbe9
Additional improvements to CI workflow (#750) 2025-02-07 15:25:31 +00:00
Jesse Braham
258e46bef9
Deny missing debug implementation and Rust 2018 idioms (#751)
* Deny missing debug implementations

* Deny Rust 2018 idioms
2025-02-07 10:31:25 +00:00
Jesse Braham
c34197f492
Remove duplicate function definition in cli module (#747) 2025-02-06 13:19:23 +00:00
Jesse Braham
cc7c43df58
Check for conflicting command-line option names in CI (#746)
* Run `completions` subcommand in CI to check for conflicting option names

* Fix conflicting short option name for `checksum-md5` subcommand
2025-02-06 12:43:58 +00:00
Jesse Braham
a105cb01b4
Remove the dependency on libudev and its corresponding feature (#742)
* No longer require `libudev`

* Update `CHANGELOG.md`
2025-02-06 09:33:18 +00:00
Jesse Braham
aab2ad4b2d
Add rustfmt.toml and format packages (#744)
* Add `rustfmt.toml`

* Format `cargo-espflash` and `espflash` packages

* Use `nightly` for `rustfmt` checks in CI
2025-02-05 14:52:29 +00:00
Jesse Braham
74f6f807a0
Add Taplo config file and format Cargo manifests (#743) 2025-02-05 14:33:09 +00:00
wcampbell
83d342e54d
Use hex fmt for command debug print (#735) 2025-01-30 07:09:32 +00:00
Jesse Braham
3c56608a8a
Update license files and top-level README.md, move test binaries to tests/ directory (#734)
* Update license files

* Move the test binaries to the tests/ directory

* Remove outdated notice from top-level `README.md`
2025-01-29 12:33:08 +00:00
Sergio Gasquez Arcos
9a45e19966
Avoid running hil twice and add --no-skip to espflash flash command (#732)
* ci: Avoid running  hil twice and add --no-skip to espflash flash command

* ci: Avoid running ci twice
2025-01-29 09:15:15 +00:00
Sergio Gasquez Arcos
30953a70b6
[cargo-espflash]: Fix -s collision (#731)
* fix: `-s` collision

* docs: Update changelog
2025-01-28 13:44:04 +00:00
chris-subtlebytes
c9183ffaf3
Calculate end of bootloader to update SHA256 (#716)
The current implementation uses the last 32 bytes of the bootloader
file. When Secure Boot V2 is enabled, the bootloader is padded. The
new implementation walks through the segments to find the end and adds
the 16-byte aligned 1-byte checksum to update the SHA256 instead of
incorrectly updating the padding.

Closes #715
2025-01-28 12:20:28 +00:00