Skip to content

espflash doesn't have --log-format argument #618

@HaoboGu

Description

@HaoboGu

Hello! I'm trying to use espflash together with defmt, espflash's doc says there's an argument --log-format: https://github.com/esp-rs/espflash/blob/main/espflash/README.md#logging-format

But actually, there is no argument here:

$ espflash flash -h
Flash an application in ELF format to a connected target device

Usage: espflash.exe flash [OPTIONS] <IMAGE>

Arguments:
  <IMAGE>  ELF image to flash

Options:
  -b, --baud <BAUD>               Baud rate at which to communicate with target device [env:
                                  ESPFLASH_BAUD=]
  -p, --port <PORT>               Serial port connected to target device [env: ESPFLASH_PORT=]
      --no-stub                   Do not use the RAM stub for loading
  -f, --flash-freq <FREQ>         Flash frequency [possible values: 12mhz, 15mhz, 16mhz, 20mhz,
                                  24mhz, 26mhz, 30mhz, 40mhz, 48mhz, 60mhz, 80mhz]
  -m, --flash-mode <MODE>         Flash mode to use [possible values: qio, qout, dio, dout]
  -s, --flash-size <SIZE>         Flash size of the target [possible values: 256kb, 512kb, 1mb, 2mb,
                                  4mb, 8mb, 16mb, 32mb, 64mb, 128mb, 256mb]
      --bootloader <FILE>         Path to a binary (.bin) bootloader file
      --erase-parts <LABELS>      Erase partitions by label
      --erase-data-parts <PARTS>  Erase specified data partitions
      --format <FORMAT>           Image format to flash [possible values: esp-bootloader,
                                  direct-boot]
  -M, --monitor                   Open a serial monitor after flashing
      --monitor-baud <BAUD>       Baud rate at which to read console output
      --partition-table <FILE>    Path to a CSV file containing partition table
      --ram                       Load the application to RAM instead of Flash
  -h, --help                      Print help (see more with '--help')
  -V, --version                   Print version

It seems only cargo espflash has this argument, not espflash:

$ cargo espflash flash -h
Flash an application in ELF format to a target device

Usage: cargo espflash flash [OPTIONS]

Options:
      --bin <BIN>
          Binary to build and flash
      --example <EXAMPLE>
          Example to build and flash
      --features <FEATURES>
          Comma delimited list of build features
      --frozen
          Require Cargo.lock and cache are up to date
      --locked
          Require Cargo.lock is up to date
      --package <PACKAGE>
          Specify a (binary) package within a workspace to be built
      --release
          Build the application using the release profile
      --target <TARGET>
          Target to build for
      --target-dir <TARGET_DIR>
          Directory for all generated artifacts
  -Z <UNSTABLE>
          Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details
  -f, --flash-freq <FREQ>
          Flash frequency [possible values: 12mhz, 15mhz, 16mhz, 20mhz, 24mhz, 26mhz, 30mhz, 40mhz,
          48mhz, 60mhz, 80mhz]
  -m, --flash-mode <MODE>
          Flash mode to use [possible values: qio, qout, dio, dout]
  -s, --flash-size <SIZE>
          Flash size of the target [possible values: 256kb, 512kb, 1mb, 2mb, 4mb, 8mb, 16mb, 32mb,
          64mb, 128mb, 256mb]
  -a, --after <AFTER>
          Reset operation to perform after connecting to the target [default: hard-reset] [possible
          values: hard-reset, no-reset, no-reset-no-stub]
  -B, --baud <BAUD>
          Baud rate at which to communicate with target device [env: ESPFLASH_BAUD=]
  -b, --before <BEFORE>
          Reset operation to perform before connecting to the target [default: default-reset]
          [possible values: default-reset, no-reset, no-reset-no-sync, usb-reset]
  -c, --chip <CHIP>
          Target device [possible values: esp32, esp32c2, esp32c3, esp32c6, esp32h2, esp32p4,
          esp32s2, esp32s3]
  -C, --confirm-port
          Require confirmation before auto-connecting to a recognized device
      --list-all-ports
          List all available ports
      --no-stub
          Do not use the RAM stub for loading
  -p, --port <PORT>
          Serial port connected to target device [env: ESPFLASH_PORT=]
      --bootloader <FILE>
          Path to a binary (.bin) bootloader file
      --erase-parts <LABELS>
          Erase partitions by label
      --erase-data-parts <PARTS>
          Erase specified data partitions
  -L, --log-format <LOG_FORMAT>
          Logging format [default: serial] [possible values: defmt, serial]
      --min-chip-rev <MIN_CHIP_REV>
          Minimum chip revision supported by image, in format: major.minor [default: 0.0]
  -M, --monitor
          Open a serial monitor after flashing
      --monitor-baud <BAUD>
          Baud rate at which to read console output
      --partition-table <FILE>
          Path to a CSV file containing partition table
      --target-app-partition <LABEL>
          Label of target app partition
      --partition-table-offset <OFFSET>
          Partition table offset
      --ram
          Load the application to RAM instead of Flash
      --no-verify
          Don't verify the flash contents after flashing
      --no-skip
          Don't skip flashing of parts with matching checksum
  -h, --help
          Print help (see more with '--help')
  -V, --version
          Print version

The problem is, cargo espflash cannot be used as cargo's runner, that means I cannot use a simple cargo run command to run the program and get logs from defmt. I have to use cargo espflash flash --monitor --log-format defmt only. IMO espflash should provide --log-format argument as well as cargo espflash

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions