Skip to content

Commit

Permalink
fix: place trace.log in root directory
Browse files Browse the repository at this point in the history
  • Loading branch information
higaski committed Apr 10, 2024
1 parent 148b58c commit a45138f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ It currently supports the following ESP microcontrollers:

## Features
- GUI flashes either
- an [esp-idf](https://github.com/espressif/esp-idf) build folder
- an [ESP-IDF](https://github.com/espressif/esp-idf) build directory
- a [flasher_args.json](https://github.com/espressif/esp-idf/blob/master/components/esptool_py/flasher_args.json.in) file
- a .zip archive
- single/multiple loose binaries
Expand All @@ -49,20 +49,21 @@ Most options are supported equally by CLI and GUI. The following table contains
| Option | Description |
| --------------- | --------------------------------------------------------------- |
| `-c`, `--chip` | Target chip type |
| `-p`, `--port` | Serial port baud rate |
| `-p`, `--port` | Serial port device |
| `-b`, `--baud` | Serial port baud rate |
| `--before` | What to do before connecting to the chip |
| `-a`, `--after` | What to do after QtESPFlasher is finished |
| `--no-stub` | Disable launching the flasher stub, only talk to ROM bootloader |
| `-t`, `--trace` | Enable trace-level output of QtESPFlasher interactions |
| `-l`, `--list` | List all available serial interfaces |
| `-l`, `--list` | List all available serial devices |

The following screenshot shows the GUI options.
And this screenshot shows how the options are displayed in the GUI.
![options](data/images/options.png)

### Reset modes
By default, QtESPFlasher tries to hard reset the chip into bootloader mode before it starts and hard resets the chip to run the normal program once it is complete. The `--before` and `--after` options allow this behavior to be changed.

#### Reset before operation
#### Reset before operation
The `--before` argument allows you to specify whether the chip needs resetting into bootloader mode before QtESPFlasher talks to it.
- `--before default_reset` is the default, which uses DTR & RTS serial control lines to try to reset the chip into bootloader mode.
- `--before no_reset` will skip DTR/RTS control signal assignments and just start sending a serial synchronization command to the chip. This is useful if your chip doesn't have DTR/RTS, or for some serial interfaces (like Arduino board onboard serial) which behave differently when DTR/RTS are toggled.
Expand All @@ -76,7 +77,7 @@ The `--after` argument allows you to specify whether the chip should be reset af
The `--no-stub` option disables uploading of a software "stub loader" that manages flash operations, and only talks directly to the loader in ROM.

### Trace
QtESPFlasher has a `--trace` option which can be supplied in the first group of arguments (before the command). This will dump all traffic sent and received via the serial port to a log file next to the executable called `trace.txt`.
QtESPFlasher has a `--trace` option which can be supplied in the first group of arguments (before the command). This will dump all traffic sent and received via the serial port to a log file called `trace.txt` in the application root directory.

### Chip type
The target chip type can be selected using the `-c`, `--chip` option. If no `-c` option is specified, QtESPFlasher automatically detects the chip type when connecting.
Expand All @@ -85,7 +86,7 @@ The target chip type can be selected using the `-c`, `--chip` option. If no `-c`
The serial port is selected using the `-p`, `--port` option. If no `-p` option is specified, QtESPFlasher will enumerate all connected serial ports and try each one until it finds an Espressif device connected.

### Baud rate
The default QtESPFlasher baud rate is 115200. Slower rates may be set using `-b`, `--baud`. It is recommend to only set the baud rate if you're experiencing transmission errors during flashing. If left at default QtESPFlasher tries to change the baud rate to 460800 when running.
The default QtESPFlasher baud rate is 115200. Slower rates may be set using `-b`, `--baud`. It is **recommend** to only set the baud rate if you're experiencing transmission errors during flashing. If left at default QtESPFlasher tries to change the baud rate to 460800 when running to considerably reduce flash times.

## Usage
### CLI
Expand Down Expand Up @@ -124,11 +125,16 @@ Done
```

### GUI
#### Add folder
![usage add dir](data/images/usage_add_dir.gif)
QtESPFlasher offers a few different ways to select binaries for flashing.

#### Add binaries
![usage add bin](data/images/usage_add_bin.gif)
#### Add directory
The build directory of an ESP-IDF project can be selected directly using the ![folder open](data/images/folder_open.png) symbol. ESP-IDF builds generate a file called flasher_args.json which contains project flash information in JSON format. This file is red by QtESPFlasher to obtain all of the projects binaries and their offsets.
![usage add dir](data/images/usage_add_dir.gif)

#### Add .zip archive
![usage add zip](data/images/usage_add_zip.gif)
A zipped ESP-IDF build directory can also be selected directly using the ![file](data/images/file.png) symbol. The .zip file must contain a flasher_args.json file, just like when adding a directory.
![usage add zip](data/images/usage_add_zip.gif)

#### Add binaries
If there is no flasher_args.json file available, binaries can also be added directly. This is done by selecting .bin files with the ![file](data/images/file.png) symbol. Please note that in this case the offset must be entered **manually**. Offsets in the C language convention, such as “0x” for base 16 or “0b” for base 2, are supported.
![usage add bin](data/images/usage_add_bin.gif)
Binary file added data/images/file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/folder_open.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/esp_flasher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ void EspFlasher::transfer_debug_print(uint8_t const* data,
if (_trace != "trace") return;

static auto const log_path{
QCoreApplication::applicationDirPath().toStdString() + "/trace.txt"};
QCoreApplication::applicationDirPath().toStdString() + "/../trace.log"};
static auto fd{fopen(log_path.c_str(), "w")};
static gsl::final_action close{[&fd] { fclose(fd); }};

Expand Down

0 comments on commit a45138f

Please sign in to comment.