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

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

Re: [avr-gcc-list] Stuckness with ATTiny15 program and avr-gcc


From: Ned Konz
Subject: Re: [avr-gcc-list] Stuckness with ATTiny15 program and avr-gcc
Date: Sat, 8 Jan 2005 11:08:42 -0800
User-agent: KMail/1.7.1

On Friday 07 January 2005 9:19 pm, Andy Warner wrote:
> Bruce D. Lightner wrote:
> > [...]
> > One problem that I see after looking at your mixed listing (i.e.,
> > "regulator.lss") is that you have linked with the standard avr-gcc
> > "startup code", which assumes that you have RAM memory with .data and
> > .bss sections.  This is likely causing problems.
>
> Copying zero length data and zeroing zero length bss shouldn't cause
> a problem, I've (wastefully and sloppily) used similar crt0.s code
> in Tiny15 without a problem. I do see two differences with your
> listing:
[snip]
> You're probably well advised to get rid of true/false from the
> header file and update to use Bruce's linker goo and I'll bet
> you will be back in business.

I appreciate your help, Bruce and Andy!

So I changed the init routine and the vectors, removed the true and false, and 
used Bruce's custom linker script. It still doesn't work. I also programmed a 
bare DIP on a breadboard and it behaves the same way.

Note that an updated version of Bruce's init routine for the 3.4 GCC shouldn't 
init the stack, as GCC does this at the top of main() now. Because of this, 
you have to define __stack. I used a modified version of Bruce's init.S that 
looks like this:


; init.s
        .weak   __stack
        .set    __stack, 0xFF
        .section reset
        .global my_reset
my_reset:
        clr r1  ; r1=0 for avr-gcc
        ; NOTE that gcc now initializes the stack in main().
        rjmp main       ; call C routine


Oddly, in turning the circuit off and on it did start emitting serial that 
looked sorta right -- once. (repeated "73 00\r\n", which indicates that the 
correction loop wasn't running, since the 00 is the OCR1A number and should 
have been increased because the ADC wasn't reading anything). At least this 
tells me that the timing and logic of the serial output routine is probably 
correct.

Thinking that maybe my Timer0 overflow interrupt routine was taking too much 
time (it's doing the serial transmission, so at 9600 bps it's being called 
every 104usec), I lowered the data rate to 1200 bps. However, it didn't 
change anything. I still don't even see the initialization completing (the 
PB5/RESET line is not being pulled down, and the AREF isn't being connected 
to the internal reference).

I've posted an updated version to 
http://bike-nomad.com/misc/tiny15Regulator.zip, if anyone is interested.

Thanks,
-- 
Ned Konz
http://bike-nomad.com



reply via email to

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