I am using a third-party program to build the binary file and upload it under Arduino IDE's GUI, meaning I am not using the built-in avr-gcc nor avrdude for building and uploading. As there is a on-board DAP chip, uploading binary file is done by copy&paste the binary file into the flash memory recognized as a removable storage by the OS.

However, this make reading user's current port selection very difficult because the IDE is written in Java, but the thrid-party program I am using is in C++.

Knowing which port the user has currently selected is very important to me, as sometimes I need to program multiple boards at the same time and monitor their received data on the serial port.

If someone can point me into the right direction or link me to the previously-solved similar question , it will be much appreciated!

PS: I am working under Ubuntu&Windows10 OS and using latest Arduino IDE.

  • I don't understand. What port does the user select if the upload target is the drive?
    – Juraj
    Nov 11, 2019 at 14:21
  • Hi Juraj, it doesn't matter which port the user select, the uploading program will always simply copy & paste the binary into the drive whose path already specified in the source code of the uploading program, this differs from arduino who uses serial port to upload binary instead of DAP(Debug Access Port).
    – Simon X
    Nov 13, 2019 at 1:57
  • yes, and then what is the question?
    – Juraj
    Nov 13, 2019 at 6:51
  • Hi Juraj, its ok I ve found the solution, thx :)
    – Simon X
    Nov 14, 2019 at 8:40

1 Answer 1


After someone from Github gave me a link, I think I ve found the way to read the real-time port selection even using third party uploading program.

The key is command line argument in the "Platform.txt" file located under "arduino15" folder. If you have the same issue as mine, try look up this link, where you will find loads of useful information: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification

PS: rmb, after you change the command lines in the txt file, always close and restart your arduino IDE before those changes you made take effect.

  • Please be a bit more specific, so that future users can learn more from your answer, and also because links might die somewhere in the future.
    – chrisl
    Nov 14, 2019 at 8:49
  • thanks for the reminder, but I think my case is kinda rare so not many will run into the same problem as ours unless their dev board uses DAP chip for uploading as well.
    – Simon X
    Nov 15, 2019 at 9:06
  • anyway, this key is to get the serial port through command lines arguments written in "Platform.txt" (you can find it in your C drive).
    – Simon X
    Nov 15, 2019 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.