I am currently working on an avrdude interface under Linux with Purebasic. (Fuse calculator almost working)
I have a trouble with obtaining messages display from AVRdude, which works fine in commandline on my system, but I cannot obtain any message from this app with PureBasic, I find the doc is not sufficiently explicit and tried various examples working on this forum, but do not work with AVRdude.
The final objective is to intercept the infos strings sent and displayed in the terminal by AVRdude while programming the chip (and the next step will consist in displaying them in an editorgadget), but I cannot reach any result exept obtaining the exitcode to 0.
I tried this following code, which gives the exitcode only BUT does not display the avrdude help lines as requested (/usr/bin/avrdude -?). The interrogation mark is the help request in this program, not "-h" or "--help"
The code I use to do this trial comes from the PB forum and is:
Code: Select all
Prog = RunProgram("/usr/bin/avrdude", "-?", "", #PB_Program_Open | #PB_Program_Read | #PB_Program_UTF8)
;Prog = RunProgram("/usr/bin/purebasic", "-h", "", #PB_Program_Open | #PB_Program_Read | #PB_Program_UTF8)
If Prog
While ProgramRunning(Prog)
If AvailableProgramOutput(Prog)
Output$ + ReadProgramString(Prog) + #LF$
EndIf
Wend
Output$ + "Exitcode: " + Str(ProgramExitCode(Prog))
CloseProgram(Prog)
Debug Output$
EndIf
- This same code applied with the call to purebasic help works fine (in remark), the PB help is displayed.
- I do not need to run as admin as I am already in the dialout goup.
- I made successfully some months ago an graphic interface to program various arduinos and AVR based system to interface with Geany which does its uploading task correctly, but has the same problem: It displays the compile results from GCC/arduino compiler BUT NOT THE avrdude results. (It anyways uploads the program correctly).
- The problem for me is to intercept the commandline messages, not only the exitCode.
- The AVRdude version I use is 6.3. Linux version is Linux Mint 19.1
- Executing "avrdude -?" in a terminal works well and displays its help as well as the real programming results in the terminal, OR the same in a logfile if the" -l" flag is used
The standard Command line result for this help request is:
- kuki@kuki-HP-14-Notebook-PC:~$ avrdude -?
Usage: avrdude [options]
Options:
-p <partno> Required. Specify AVR device.
-b <baudrate> Override RS-232 baud rate.
-B <bitclock> Specify JTAG/STK500v2 bit clock period (us).
-C <config-file> Specify location of configuration file.
-c <programmer> Specify programmer type.
-D Disable auto erase for flash memory
-i <delay> ISP Clock Delay [in microseconds]
-P <port> Specify connection port.
-F Override invalid signature check.
-e Perform a chip erase.
-O Perform RC oscillator calibration (see AVR053).
-U <memtype>:r|w|v:<filename>[:format]
Memory operation specification.
Multiple -U options are allowed, each request
is performed in the order specified.
-n Do not write anything to the device.
-V Do not verify.
-u Disable safemode, default when running from a script.
-s Silent safemode operation, will not ask you if
fuses should be changed back.
-t Enter terminal mode.
-E <exitspec>[,<exitspec>] List programmer exit specifications.
-x <extended_param> Pass <extended_param> to programmer.
-y Count # erase cycles in EEPROM.
-Y <number> Initialize erase cycle # in EEPROM.
-v Verbose output. -v -v for more.
-q Quell progress output. -q -q for less.
-l logfile Use logfile rather than stderr for diagnostics.
-? Display this usage.
avrdude version 6.3-20171130, URL: <http://savannah.nongnu.org/projects/avrdude/>
Best regards