Pages: [1]   Go Down
Author Topic: assembly program + avrdude gui + duemilanove  (Read 2055 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 doens`t work!
I tried every programmer (including the skt500v1, v2) and I`m 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"
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1057
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 63
Posts: 2649
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

--- bill
Logged

DELHI
Offline Offline
God Member
*****
Karma: 7
Posts: 741
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

* XLoader.zip (678.31 KB - downloaded 19 times.)
Logged

AMPS

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6653
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

DELHI
Offline Offline
God Member
*****
Karma: 7
Posts: 741
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

AMPS

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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


Thank you very much!

Problem solved.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: November 21, 2012, 10:48:38 am by retrolefty » Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 63
Posts: 2649
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.  smiley-wink

Lefty  
« Last Edit: November 21, 2012, 01:27:40 pm by retrolefty » Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 63
Posts: 2649
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.  smiley-wink

Just write a wrapper script around avrdude  smiley-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
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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
« Last Edit: November 21, 2012, 02:02:46 pm by retrolefty » Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6653
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Quote
The beauty of using the commandline is that there is nothing hidden.
That's a better way of putting it!
Logged

Pages: [1]   Go Up
Jump to: