[dorkbotpdx-blabber] assembler on the arduino?
Donald Delmar Davis
ddelmardavis at gmail.com
Mon Jan 28 17:04:47 EST 2008
Greg,
I am sorry I didnt get this to you last night.
But as thomas pointed out you are going to get most of what you need
in the class so I feel like this may be time wasted.
If you are running the Arduino then you have everything you need.
Whatever platform you are using you need to find out where the
arduino folk put the toolchain.
on my system it is in /Applications/arduino-0010/hardware/tools/avr/
bin. The assembler is avr-as
the c compiler is avr-gcc, and the programmer is uisp.
(As all of the sample code from atmel is in its native assembler I
have been maintaining a compatible assembler called avra.
The syntax used by avr-as uses a different example so I am scrambling
to come up with a simple example.
... I will create one by having avr-gcc skip the assembler
$avr-gcc -c -mmcu=atmega168 -I. -gstabs -DF_CPU=16000000UL -Os -
funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall
-Wstrict-prototypes -Wa,-adhlns=hdsp-230x.lst -std=gnu99 -MD -MP -
MF .dep/hdsp-230x.o.d hdsp-230x.c -S)
)
------------------------ snippet.
$ avr-as --mmcu=atmega168 hdsp-230x.s -o hdsp-230x.o
# (the above could also have been done as a call to avr-gcc)
$ avr-gcc hdsp-230x.o -v -g -Wall -O2 -mmcu=atmega168 -Wl,-
Map,hdsp230x.map -o hdsp230x.elf
#( ^ this will show you the
underlying avr-ld command)
$ avr-objcopy -O ihex -R .eeprom hdsp-230x.elf hdsp-230x.hex
$ uisp -v -dpart=atmega168 -dprog=avrisp -dserial=/dev/tty.usbserial-
A1000gje --upload if=hdsp-230x.hex
------------------------ end
On the mac the arduino serial device shows up as tty.usbserial-XXXXXX
where XXXXXX is specific to the device.
(look at the selected device using your arduino settings for what
should go after -dserial=/dev/...)
Its not really trivial however most people just get a working
makefile set up (google mfile)
I have attached the one that is included in the osx-avr xcode templates.

You will want to adjust the paths the sources and the programmer
portions. Paul will probably have a makefile that is more specific.
I am sure that you will get all of this in class and taylored to the
environment you have.
Don.
On Jan 28, 2008, at 11:47 AM, Thomas Lockney wrote:
> Ben Bleything wrote:
>> On Mon, Jan 28, 2008, Greg Borenstein wrote:
>>
>>> Is there something I'm missing here? Is there any danger of
>>> nuking my Arduino's chip in the process here or does the
>>> bootloader offer some protection/restrictions in this regard?
>>>
>>
>> I think there's some danger of overwriting your bootloader if you
>> muck
>> up the flags, but you can always reflash it. I've got an STK-500
>> (as do
>> a number of other folks) and would be happy to reflash it
>> if it
>> comes to that.
>>
> If you have access to a system with a parallel port, you can always
> build the very simple programmer from the arduino site, too. I
> believe Paul linked to it in an earlier email in this thread. I
> haven't tried building it yet, but I think I actually have all the
> parts lying around here somewhere. If I ever seem to have free time
> again, I'll have to give it a try.
>
> ~thomas
> _______________________________________________
> dorkbotpdx-blabber mailing list
> dorkbotpdx-blabber at dorkbot.org
> http://music.columbia.edu/mailman/listinfo/dorkbotpdx-blabber
-------------- next part --------------
Skipped content of type multipart/mixed
More information about the dorkbotpdx-blabber
mailing list