Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idf_monitor does not respect port setting when flashing (IDFGH-2479) #4591

Closed
KloolK opened this issue Jan 6, 2020 · 3 comments
Closed

idf_monitor does not respect port setting when flashing (IDFGH-2479) #4591

KloolK opened this issue Jan 6, 2020 · 3 comments
Assignees
Labels
Type: Bug bugs in IDF

Comments

@KloolK
Copy link

KloolK commented Jan 6, 2020

Environment

  • Development Kit: none
  • Module or chip used: ESP32 (Heltec WiFi LoRa 32 V2)
  • IDF version: v4.1-dev-1757-g826b9f638
  • Build System: idf.py
  • Compiler version: xtensa-esp32-elf-gcc (crosstool-NG esp-2019r2) 8.2.0
  • Operating System: Linux
  • Using an IDE?: CLion, but just for coding. Building and flashing is done from the terminal.
  • Power Supply: USB

Problem Description

I am using two Heltec WiFi LoRa 32 (V2) connected to the same PC (/dev/ttyUSB0 and /dev/ttyUSB1). I open the monitor with the following command:
idf.py monitor -p /dev/ttyUSBx with x = 0 and x = 1 in a second terminal.
I use Ctrl+T, Ctrl+A/Ctrl+F to build and flash.

Expected Behavior

The code is rebuilt and flashed to the device connected to the port specified with the -p switch.

Actual Behavior

The code is rebuilt and always flashed to the device on port /dev/ttyUSB1. The -p setting is ignored.

Steps to reproduce

  1. Connect two devices to the same PC. They should be assigned /dev/ttyUSB0 and /dev/ttyUSB1.
  2. Open the monitor for both devices with the following two commands:
  • idf.py monitor -p /dev/ttyUSB0
  • idf.py monitor -p /dev/ttyUSB1
  1. Press Ctrl+T, Ctrl+A in the monitor for /dev/ttyUSB0.
  2. The code is built successfully, but flashed to the wrong device (/dev/ttyUSB1)

Code to reproduce this issue

Any project.

Debug Logs

No crashes.

Other items if possible

N/A

@KloolK KloolK added the Type: Bug bugs in IDF label Jan 6, 2020
@github-actions github-actions bot changed the title idf_monitor does respect port setting when flashing idf_monitor does respect port setting when flashing (IDFGH-2479) Jan 6, 2020
@KloolK KloolK changed the title idf_monitor does respect port setting when flashing (IDFGH-2479) idf_monitor does not respect port setting when flashing (IDFGH-2479) Jan 6, 2020
@KloolK
Copy link
Author

KloolK commented Jan 6, 2020

I just noticed that when reversing the order of the arguments to idf.py -p /dev/ttyUSBx monitor it works as it should. However, I think this behavior is strange and maybe a consistent handling of the parameters regardless of the order should be considered.

@dobairoland
Copy link
Collaborator

Hi @KloolK. Yes you're right and flashing from IDF monitor should use the port specified for monitor. We already noticed this issue and the fix is under way. This GH issue will be closed when the fix gets pushed to GH.

I just noticed that when reversing the order of the arguments to idf.py -p /dev/ttyUSBx monitor it works as it should. However, I think this behavior is strange and maybe a consistent handling of the parameters regardless of the order should be considered.

No, this is the intended behavior. Arguments after idf.py are global and local after a subcommand. At this moment using a global port bypasses the related bug.

For example, port1 is a global port and port2 is a locally overridden one for monitor in

idf.py -p port1 monitor -p port2

Also, --print-filter is a local argument for monitor, i.e. idf.py monitor --print-filter xy can be used but idf.py --print-filter xy monitor makes no sense.

@dobairoland dobairoland assigned dobairoland and ginkgm and unassigned dobairoland Jan 7, 2020
@Alvin1Zhang
Copy link
Collaborator

@KloolK Thanks for reporting and sorry for the slow turnaround. Really appreciate your patience in waiting for the fix. The fix has been merged internally in our repo. and this issue will be automatically closed when the fix lands on Github. For your information. Thanks.

espressif-bot pushed a commit to espressif/esp-idf-monitor that referenced this issue Jan 16, 2023
This commit make idf_monitor overwrite the ESPPORT environment variable
with the port it's using, and re-run make with the modified environment
variable. In this way, the make invoked will inherit the idf_monitor's
port.

Closes espressif/esp-idf#4591
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

4 participants