avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] is tiny15 not c-programmable


From: Bruce D. Lightner
Subject: Re: [avr-gcc-list] is tiny15 not c-programmable
Date: Tue, 27 May 2003 22:12:03 -0700

Abhijeet,

> Hi Bruce
> Thanks a lot for your detailed explanation.
> That was really a mini HOW-TO.
> 
> Can you please send me your perl script chkinstr.pl

Find attached a ZIP file with my working directory for ATtiny15L
development.  The Perl script is there as well as a makefile and the
needed include files, etc. for the ATtiny15L.  There are lots of .c and .h
files with (hopefully) useful inline assembly macros and static inline
functions for things like "bit-banged" UARTs, timers, ADC routines, etc. 
In general, there is a macro/inline version of every subroutine.  The
inline/macro version is pre-pended with an "_".  You choose which to call
out.

You will have to edit the makefile to point at *your* copies of the
avr-gcc tools.  It is based on the PicoWeb development environment (which
uses avr-gcc version 2.95).  We give that away, but you are probably
better off moving to avr-gcc version 3.  There is a special linker script
(tinyker.lds) and a couple of assembler source files with the
reset/interrupt vectors and "startup" code (i.e., tinyker.s and init.s)
which complete the package.

I left you two test programs: "utest.c" and "wdtest.c".  The first is a
half-duplex UART test program; the other a watch-dog timer test.  My other
projects cannot be shared here.  The files "utest.h" and "wdtest.h" are
used to define the respective hardware configurations (i.e., clock rate,
baud rate, processor voltage, I/O port assignements, etc.)

Note that the AVR programmer scheme that I use reads out the oscillator
"calibration byte" and pokes that byte value into the last byte of the AVR
flash memory.  On startup, I use a special routine (i.e., osccal()) that
stuffs that byte into the calibration register.  That way, the internal
R/C oscillator is "right on"...typically within 1%.  You can will have to
do something if you need an accurate UART clock.

Your goal should be to make "make utest" work.  This will prepare a ROM
file (ugh!).  There is logic for "make load"...but you will probably have
to do something different to download the firmware into your setup.  You
should be able to find a ELF binary containing the linked program.

I have a 90% complete Circuit Cellar magazine article about a tiny RS232
serial port programmer based on the ATtiny15L.  That will no doubt result
in a Web page with a "real" HOWTO.  (Too much to do...so little time!) 

The next obvious step w.r.t. "avr-gcc" is probably to patch it to take
some of the "illegal" ATtiny15L instructions away from the code
generator.  That will obviate the need for my silly BYTE() macro that is
used to trick the compiler into *not* using instructions like "sbiw".  A
while ago Denis Chertykov lead me to believe that is relatively
straightforward...for him anyway! :-)

Enjoy...

Best regards,

Bruce

-- 
 Bruce D. Lightner
 Lightner Engineering
 La Jolla, California
 Voice: +1-858-551-4011
 FAX: +1-858-551-0777
 Email: address@hidden
 URL: http://www.lightner.net/lightner/bruce/

Attachment: attiny.zip
Description: Zip compressed data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]