assembly program + avrdude gui + duemilanove

Hi Guys,

I have and Arduino Duemilanove Board (328P) and need to burn an assembly program in it.
It's an Led Blink program, and I already have the .hex file.
The problem is that everytime I try to burn it using the AVRdude it just doenst work! I tried every programmer (including the skt500v1, v2) and Im selecting the right COM port.

When I use the Arduino Software everything works just fine, but I have to program it in Assembly (it's a work for graduation).

Help, please!

Thanks


Assembly Code:

.include "m328Pdef.inc"

start:

SBI DDRB,5

blink: LDI r20,250
CALL delay_n_ms
SBI PORTB,5
LDI r20,250
CALL delay_n_ms
CBI PORTB,5
JMP blink

.include "delay_n_ms.h"

I don't have an Duemilanove, but on a Arduino Uno this uploads the blink328.hex file to the board. (the Uno connected via USB cabel)

avrdude -patmega328p -Pcom20 -carduino -D -U flash:w:blink328.hex:i

Run the IDE in verbose mode and you can see the
exact avrdude command that the IDE runs.

--- bill

just install this programmer in to system select proper hex file directory and upload it .

XLoader.zip (678 KB)

You're not using the same avrdude that Arduino uses. And I don't see you specifying a COM speed, which is probably a good idea, since the duemilanove bootloader does not run at the same speed as the "real" stk500. Add "-b57600" to the "command-line options window." If that doesn't work, add "-v -v -v -v" and post the output again.

I would avoid the GUI interface to avrdude and just run it from the command line. Just because I don't trust such things...

just load your hex file through x loader keeping same baudrate , and compare ur result

westfw:
Add "-b57600" to the "command-line options window."

Thank you very much!

Problem solved.

westfw:
You're not using the same avrdude that Arduino uses. And I don't see you specifying a COM speed, which is probably a good idea, since the duemilanove bootloader does not run at the same speed as the "real" stk500. Add "-b57600" to the "command-line options window." If that doesn't work, add "-v -v -v -v" and post the output again.

I would avoid the GUI interface to avrdude and just run it from the command line. Just because I don't trust such things...

I understand what you are saying, and there are some flaky 'free' GUIs out in the wild . However I have used that same GUI 'wrapper' to run avrdude for several years now and it's always performed whatever operation I have required to date without error. However I am using it with a USBtiny programmer so there is no baud rate or comm port parameter to get wrong or missing. I created a separate windows folder that includes a copy of AVRDUDE (version 5.11 presently I think) and it's avrdude config file and the gui. As I said it has worked very good for me, just select the desired chip type and then perform the task(s) desired.

Lefty

The beauty of using the commandline is that there is nothing hidden.
You get exactly what you type, which means that as long as the
underlying commandline tool works, you can always make it work.
This is not always the case when using a GUI wrapper.

Another benefit is that the commandline works across multiple
OS's whereas most GUIs are limited to running on Windows.

--- bill

bperrybap:
The beauty of using the commandline is that there is nothing hidden.
You get exactly what you type, which means that as long as the
underlying commandline tool works, you can always make it work.
This is not always the case when using a GUI wrapper.

Another benefit is that the commandline works across multiple
OS's whereas most GUIs are limited to running on Windows.

--- bill

Understood, but the command line options available for AVRDUDE can be very overwhelming for many typical arduino users (such as me anyway, typical or not) to understand what they do and why one might want or need to use them or not use them. Trust me a GUI 'wrapper' for running AVRDUDE does target some users perfectly.

Not all arduino users come to the table with the same skill and experience levels of other users and they may indeed never try to enter the world of AVRDUDE command line level statements if they can find a tool that works for them that would avoid that. I'm just saying that the specific GUI that the OP is using works very well, for me anyway. It even allows one to add command line arguments if one wants and knows how. I don't plan on ever learning to make my own make files to run the arduino gcc tool chain manually either.

Now only if the Arduino IDE would park a copy of a sketch's hex file into the user's sketch directory directly like it once did so many moons ago, I would be a happier camper. :wink:

Lefty

retrolefty:
Now only if the Arduino IDE would park a copy of a sketch's hex file into the user's sketch directory directly like it once did so many moons ago, I would be a happier camper. :wink:

Just write a wrapper script around avrdude :wink:

But seriously. This can easily be handled by using an avrdude wrapper.
Not the prettiest method but it is very simple.
If you simply rename avrdude than write a script that gets called instead
you can do whatever you want before you then run avrdude.
The only drawback is that it only runs when an upload is done.

Personally I would find a listing or nm output much more interesting than the .hex file
since the .hex file is already available in the build area.

With the 1.5 IDE it is really easy to get even more sophisticate since you now have
complete control over the commands used for everything from the compiler, linker, uploader,
etc.. in the platform.txt and boards.txt files.

That is the beauty of open source.
You can make do whatever you want.

--- bill

That is the beauty of open source.
You can make do whatever you want.

--- bill

Puts on best Robert DeNiro voice:
You talkin to me? you talkin to me? you must not be talkin to me! As I can only make the IDE not print out nasty red error messages in it's output window with only much effort and perseverance on a good day.

Lefty

Ok, "don't trust" may have been overly strong language. I don't like GUI's like this because you can't see what they're doing. When the OP said "it uploads fine from Arduino, but not with the avrdude GUI", my immediate reaction is compare the command used by arduino (as shown by setting the "verbose" option in preferences) with the command used the avrdude standalone. Which is DOEN'T SHOW YOU. grr.

The beauty of using the commandline is that there is nothing hidden.

That's a better way of putting it!