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

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

[avr-gcc-list] Re: Tiny88 __data_load_end stuck at 256?


From: Bob Paddock
Subject: [avr-gcc-list] Re: Tiny88 __data_load_end stuck at 256?
Date: Thu, 5 Feb 2009 15:04:55 -0500

On Thu, Feb 5, 2009 at 2:30 PM, Bob Paddock <address@hidden> wrote:
> I have code that calculates the CRC of Flash at power up, that works
> fine on the AT90CAN64 part.
> When I move the CRC function to the Tiny88 it does not work.
....
> What is going on here?
>
> This is with avr-gcc (WinAVR 20081205) 4.3.2.

/* Here is a test case: */
#include <stdint.h>
#include <avr/io.h>

uint16_t __data_load_end[1]; /* Defined by the linker script.  Set to
address of last byte of .text+.data section */
int main( void )
{
  uint16_t flash_end_u16 = (uint16_t) &(__data_load_end[0]);

  /* Pointless code to get something in flash: */
  DDRB = (uint8_t) -1;
  PORTB = (uint8_t) (flash_end_u16>>8);
  PORTB = (uint8_t) flash_end_u16;
}

00000076 <main>:
#include <avr/io.h>

uint16_t __data_load_end[1]; /* Defined by the linker script.  Set to
address of last byte of .text+.data section */
int main( void )
{
  uint16_t flash_end_u16 = (uint16_t) &(__data_load_end[0]);
  76:   20 e0           ldi     r18, 0x00       ; 0
  78:   31 e0           ldi     r19, 0x01       ; 1
[The above is wrong.]

  /* Pointless code to get something in flash: */
  DDRB = (uint8_t) -1;
  7a:   8f ef           ldi     r24, 0xFF       ; 255
  7c:   84 b9           out     0x04, r24       ; 4

  PORTB = (uint8_t) (flash_end_u16>>8);
  7e:   35 b9           out     0x05, r19       ; 5

  PORTB = (uint8_t) flash_end_u16;
  80:   25 b9           out     0x05, r18       ; 5
}
  82:   80 e0           ldi     r24, 0x00       ; 0
  84:   90 e0           ldi     r25, 0x00       ; 0
  86:   08 95           ret

00000088 <_exit>:
  88:   f8 94           cli

0000008a <__stop_program>:
  8a:   ff cf           rjmp    .-2             ; 0x8a <__stop_program>

map:
 *(COMMON)
                0x00800102                PROVIDE (__bss_end, .)
                0x0000008c                __data_load_start = LOADADDR (.data)
                0x0000008c                __data_load_end =
(__data_load_start + SIZEOF (.data))

sym:
00000088 W exit
0000008a t __stop_program
0000008c A __data_load_end
0000008c A __data_load_start
0000008c T _etext
000001ff W __stack




reply via email to

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