call avrdude from the ZBasic IDE?

Discussion of issues related to writing ZBasic applications for targets other than ZX devices, i.e. generic targets.
Post Reply
stevech
Posts: 715
Joined: 22 February 2006, 20:56 PM

call avrdude from the ZBasic IDE?

Post by stevech »

Anyone ever determined how to call avrdude from the ZBasic IDE?
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

See Section 8.7 "Setting the Downloader Command" of the ZBasic Language Reference Manual that was installed with the Beta compiler. It gives an example of how to invoke the stk500.exe command to program a device. Setting it up for avrdude should be the same idea, substituting the proper parameter names/values, etc.
- Don Kinzer
stevech
Posts: 715
Joined: 22 February 2006, 20:56 PM

Post by stevech »

Thanks. Sorry I didn't see that in the manual.

Took me a l-o-n-g time to figure this out
Using a mega328P with an Arduino compatible bootloader, which says it's in turn compatible with STK500 v1 - just won't work with STK500.exe. And it looks like STK500.exe won't use a COM port higher than COM8? I also didn't see an STK500 command line option for baud rate (so I tried changing the default baud rate in W7's device manager). I know I could force COM11 to be a lower number, but to heck with it.

So back to using Avrdude... after a long time, I found that if the flash/EEP file name is in fact a path name (as is needed for the IDE's go command macro), then a path name with a Windows drive letter such as Y:\path\to\file\me.hex, the colon after Y: confuses AVRdude. So in the fine print, AVRdude says if the path name contains a : then you must explicitly state the file format by adding :i (intel hex) on the end of the file name. Without this, an arcane error message came out of AVRdude.

Well, it finally works.
Back to the programming already in progress!
Don_Kirby
Posts: 341
Joined: 15 October 2006, 3:48 AM
Location: Long Island, New York

Post by Don_Kirby »

So far, the only issue I've found with AVRDude is that it won't accept the (target_device), as it is expecting the slightly more cryptic AVRDude device designation.
AVRDude wrote: >"C:\Program Files\WinAVR-20100110\bin\avrdude.exe" -c usbtiny -p(target_device)
avrdude.exe: AVR Part "(target_device)" not found.

Valid parts are:
t10 = ATtiny10 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:15443]
t8 = ATtiny9 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:15403]
t5 = ATtiny5 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:15363]
t4 = ATtiny4 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:15323]
ucr2 = 32UC3A0512 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:15302]
x128a4 = ATXMEGA128A4 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:15204]
x64a4 = ATXMEGA64A4 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:15107]
x32a4 = ATXMEGA32A4 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:15010]
x16a4 = ATXMEGA16A4 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:14913]
x256a3b = ATXMEGA256A3B [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:14816]
x256a3 = ATXMEGA256A3 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:14719]
x192a3 = ATXMEGA192A3 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:14622]
x128a3 = ATXMEGA128A3 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:14525]
x64a3 = ATXMEGA64A3 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:14428]
x256a1 = ATXMEGA256A1 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:14331]
x192a1 = ATXMEGA192A1 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:14234]
x128a1d = ATXMEGA128A1REVD [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:14137]
x128a1 = ATXMEGA128A1 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:14040]
x64a1 = ATXMEGA64A1 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:13943]
m6450 = ATMEGA6450 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:13754]
m3250 = ATMEGA3250 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:13565]
m645 = ATMEGA645 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:13376]
m325 = ATMEGA325 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:13187]
usb82 = AT90USB82 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:13007]
usb162 = AT90USB162 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:12823]
usb1287 = AT90USB1287 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:12634]
usb1286 = AT90USB1286 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:12445]
usb647 = AT90USB647 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:12257]
usb646 = AT90USB646 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:12068]
m32u4 = ATmega32U4 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:11880]
t84 = ATtiny84 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:11697]
t44 = ATtiny44 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:11515]
t24 = ATtiny24 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:11333]
m128rfa1 = ATMEGA128RFA1 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:11145]
m2561 = ATMEGA2561 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:10951]
m2560 = ATMEGA2560 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:10758]
m1281 = ATMEGA1281 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:10570]
m1280 = ATMEGA1280 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:10381]
m640 = ATMEGA640 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:10193]
t85 = ATtiny85 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:10012]
t45 = ATtiny45 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:9833]
t25 = ATtiny25 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:9653]
pwm3b = AT90PWM3B [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:9472]
pwm2b = AT90PWM2B [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:9289]
pwm3 = AT90PWM3 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:9106]
pwm2 = AT90PWM2 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:8922]
t2313 = ATtiny2313 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:8735]
m328p = ATMEGA328P [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:8547]
t88 = attiny88 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:8361]
m168 = ATMEGA168 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:8173]
m88 = ATMEGA88 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:7987]
m48 = ATMEGA48 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:7800]
t861 = ATTINY861 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:7612]
t461 = ATTINY461 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:7423]
t261 = ATTINY261 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:7234]
t26 = ATTINY26 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:7077]
m8535 = ATMEGA8535 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:6919]
m8515 = ATMEGA8515 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:6761]
m8 = ATMEGA8 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:6600]
m161 = ATMEGA161 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:6460]
m32 = ATMEGA32 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:6285]
m6490 = ATMEGA6490 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:6092]
m649 = ATMEGA649 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:5907]
m3290p = ATMEGA3290P [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:5724]
m3290 = ATMEGA3290 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:5539]
m329p = ATMEGA329P [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:5354]
m329 = ATMEGA329 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:5170]
m169 = ATMEGA169 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:4990]
m163 = ATMEGA163 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:4832]
m162 = ATMEGA162 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:4636]
m1284p = ATMEGA1284P [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:4446]
m644p = ATMEGA644P [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:4254]
m644 = ATMEGA644 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:4064]
m324p = ATMEGA324P [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:3873]
m164p = ATMEGA164P [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:3682]
m16 = ATMEGA16 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:3504]
c32 = AT90CAN32 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:3313]
c64 = AT90CAN64 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:3123]
c128 = AT90CAN128 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:2933]
m128 = ATMEGA128 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:2755]
m64 = ATMEGA64 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:2574]
m103 = ATMEGA103 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:2434]
8535 = AT90S8535 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:2313]
8515 = AT90S8515 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:2199]
4434 = AT90S4434 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:2116]
4433 = AT90S4433 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:1992]
2343 = AT90S2343 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:1868]
2333 = AT90S2333 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:1740]
2313 = AT90S2313 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:1627]
4414 = AT90S4414 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:1514]
1200 = AT90S1200 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:1399]
t15 = ATtiny15 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:1266]
t13 = ATtiny13 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:1093]
t12 = ATtiny12 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:960]
t11 = ATtiny11 [C:\Program Files\WinAVR-20100110\bin\avrdude.conf:896]

>Exit code: 1
stevech
Posts: 715
Joined: 22 February 2006, 20:56 PM

Post by stevech »

agree. Here's what I put in the go command. Note the :i on the end was essential due to the drive letter in the path

command.project.avr.go=avrdude.exe -p m328p -c stk500v1 -P COM11 -b 57600 -F -U flash:w:$(project.base).hex:i

yielding...

>Exit code: 0
>avrdude.exe -p m328p -c stk500v1 -P COM11 -b 57600 -F -U flash:w:Y:\AMD4200\Desktop\_Projects\HopeRFM12ZBasic\JeeNode.hex:i

avrdude.exe: AVR device initialized and ready to accept instructions

EDIT:
meanwhile --- using hardware that worked OK with Arduino's C++ variant/libraries, I haven't yet gotten SPI to work. Get all ones, despite debugging DDR, PORTB, Slave select (B.2) (low = true), etc.
Post Reply