[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Newbie Problems
From: |
Rune Christensen |
Subject: |
RE: [avr-gcc-list] Newbie Problems |
Date: |
Mon, 30 Dec 2002 12:24:23 +0100 |
Hello
If you want to read sensor_temp1 in SIGNAL(SIG_OVERFLOW0)
and use it in main loop then I will use this method
volatile unsigned char sensor_temp1;
SIGNAL{SIG_OVERFLOW0}
{
...
sensortemp1 = PIND & 0x7c // direct register access is possible in avr-gcc
from version 3.2
...
}
void main(void)
{
...
cli();
unsigned char temp = sensor_temp1;
sei();
...
}
or
void main(void)
{
...
unsigned char sreg = SREG;
cli();
unsigned char temp = sensor_temp1;
SREG = sreg;
...
}
Happy New Year
Rune
> -----Original Message-----
> From: address@hidden [mailto:address@hidden
> Behalf Of Panther Electronics
> Sent: Monday, December 30, 2002 10:46 AM
> To: address@hidden
> Subject: [avr-gcc-list] Newbie Problems
>
>
> Hi,
>
> Can i get some explanation of the warning while compiling.
>
> WARNING: 'sensor_temp1' has no address in mapfile.
> WARNING: 'sensor_temp2' has no address in mapfile.
> WARNING: 'sw_temp1' has no address in mapfile.
> WARNING: 'sw_temp2' has no address in mapfile.
>
> the above variables are local to tim0 overflow; the values of
> sensor_temp1 and sensor_temp2 is 0x00; that would mean that the
> variable value is lost on exit? what am i doing wrong?
>
> ---code--
>
> SIGNAL(SIG_OVERFLOW0) /* signal handler for tcnt0 overflow
> interrupt */
> {
> static unsigned char sensor_temp1, sensor_temp2;
> static unsigned char sw_temp1, sw_temp2;
> /*
> outp(~led, PORTB); /* invert the output since a zero
> means: LED on
> led <<= 1; /* move to next LED
> if (!led) /* overflow: start with Port B0 again
> led = 1;
> */
> outp(0x00, TCNT0); /* reset counter to get this
> interrupt again */
> if ( timers_1 )
> -- timers_1;
> if ( timers_2 )
> -- timers_2;
>
> if ( db_1 == db )
> {
> sensor_temp2 = inp(PIND) & 0x7c; /* 0x7c = &b0111_1100 */
> /* the balance code */
> }
> else
> {
> if ( bit_is_set( flag_1, in_flag_1 ) == 0 )
> {
> if ( bit_is_set( flag_1, sensor_in ) == 0 )
> {
> sensor_temp1 = ( inp(PIND) & 0x7c );
> sbi ( flag_1, in_flag_1 );
> db_1 = 0;
> }
> }
> else
> ++ db_1;
> }
>
> --- compiler snap shot ----
> avr-gcc --version
> avr-gcc (GCC) 3.3 20021209 (experimental)
> Copyright (C) 2002 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A
> PARTICULAR PURPOSE.
>
> "Size before:"
> text data bss dec
> hex filename
> 0 1760 0 1760 6e0
> First.hex
> avr-gcc -c -g -Os -funsigned-char -funsigned-bitfields
> -fpack-struct -fshort-enums -Wall -Wstrict-prototypes
> -Wa,-ahlms=First.lst -mmcu=at90s8515 -I. First.c -o First.o
> avr-gcc -Wl,-Map=First.map,--cref -mmcu=at90s8515 First.o -lm
> --output First.elf
> avr-objcopy -O ihex -R .eeprom First.elf First.hex
> avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load"
> --change-section-lma .eeprom=0 -O ihex First.elf First.eep
> objtool loadelf First.elf mapfile First.map writecof First.cof
> WARNING: 'sensor_temp1' has no address in mapfile.
> WARNING: 'sensor_temp2' has no address in mapfile.
> WARNING: 'sw_temp1' has no address in mapfile.
> WARNING: 'sw_temp2' has no address in mapfile.
> "Size after:"
> text data bss dec
> hex filename
> 0 1762 0 1762 6e2
> First.hex
> "-------- end --------"
> "Errors: none"
> >Exit code: 0
>
> thanks in advance
>
> Srikanth Kamath T
>
>
>
> avr-gcc-list at http://avr1.org
>
avr-gcc-list at http://avr1.org