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

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

Re: [avr-gcc-list] very simple program


From: Timothy Smith
Subject: Re: [avr-gcc-list] very simple program
Date: Mon, 03 Oct 2005 08:22:28 +1000
User-agent: Mozilla Thunderbird 1.0.7 (X11/20051002)

David Kelly wrote:


On Oct 2, 2005, at 7:21 AM, Timothy Smith wrote:

i'm learning the in's and out's of microcontroller programming, but i've run into a really fundamental problem. i get the following error when i attempt to use _BV to shift a shit and set port b pin 0 to output

4: undefined reference to `__stack'

and here is my code

#include <avr/io.h>

int
main(void){
     while (1) {
       DDRB = _BV(PB0);
   };
}


Yeah, well what else are you doing? What CPU? How are you specifying the CPU to the compiler? Who is complaining about __stack? My guess is that its the linker not the compiler and it has something to do with your CPU selection or failure to specify to both compiler and linker.

Also use of _BV(PB0) is discouraged as its nothing more than (1<<PB0) and for most the shift is actually easier to read and understand.

--

my apologes for not giving this to start with

%avr-gcc -g -mmcu=atmega32 -Os -c BarGimp.c
%avr-gcc -g   -o BarGimp.out BarGimp.o
BarGimp.o: In function `main':
Projects/BarGimp/BarGimp.c:4: undefined reference to `__stack'
Projects/BarGimp/BarGimp.c:4: undefined reference to `__stack'

and i was not aware use of  _BV() is discouraged. it seems actually be
encouraged in the avr-libc docs?

and now that i have looked at it in this email i see the problem.
-mmcuatmega32. works now

also i might like to add that i want to set port b to output and set it
high so that it lights up and led (later it will open a solenoid value)






reply via email to

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