esp-rs / espflash

Serial flasher utility for Espressif SoCs and modules based on esptool.py
Apache License 2.0
455 stars 110 forks source link

`espflash` should look at parent/workspace directories for `espflash.toml` #593

Closed marsfan closed 4 months ago

marsfan commented 4 months ago

Looking at the release notes for espflash v3.0.0-rc1, it seems that the partition table can now be specified in the espflash.toml file. (As added in #551)

However, it seems that espflash will only look for this file in the current directory, or the user's main configuration directory (See these lines of code. It should support looking at parent directories so as to support cargo workspaces with multiple crates.

This is especially useful if cargo test is used, as that command will execute in the individual crates sub-directories in the workspace. With the current search method used by espflash, this would require creating an additional espflash.toml in each crate's directory, instead of a single espflash.toml in the workspace directory.

SergioGasquez commented 4 months ago

Hi @marsfan! Just opened #595, mind testing it and verifying that it solves your request?

marsfan commented 4 months ago

@SergioGasquez Two questions regarding testing.

  1. How do I test a version that is not released to crates.io yet (I'm still learning my way around the Rust ecosystem).
  2. When using options configured in the file (such as the option for a partition table file), will it search from the same directory that the file is in, or the directory that espflash was invoked from? I ask this as the cargo test command will invoke espflash from the individual crates directories, as opposed to the workspace directory.
SergioGasquez commented 4 months ago
  1. How do I test a version that is not released to crates.io yet (I'm still learning my way around the Rust ecosystem).

You have two options:

  1. When using options configured in the file (such as the option for a partition table file), will it search from the same directory that the file is in, or the directory that espflash was invoked from? I ask this as the cargo test command will invoke espflash from the individual crates directories, as opposed to the workspace directory.

If you use local path to file, you should specify it from the directory where you are executing espflash... I'd say.