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

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

Re: [avr-gcc-list] AVR gcc port


From: Richard Urwin
Subject: Re: [avr-gcc-list] AVR gcc port
Date: Sun, 18 Jan 2004 13:52:27 +0000
User-agent: KMail/1.5.3

On Sunday 18 Jan 2004 1:14 pm, Leonid wrote:
> Problem #1.
> In the main.c I define array in program memory as follows(see main.c).
>
> In the map file (see map file ) it's used to be in the text section.
> But AVR studio shows this array at the address 0x008c SRAM(?) and value of
> all members 0;

AVR Studio appears to be wrong.

> After reading from program memory sbyte[] array contains the right value of
> stam_msg.
>
> I found out that actually stam_msg is in program memory but at the address
> 0x46.

0x8c is a byte address. 0x46 is a word address. Program memory is addressed as 
words. So gcc and the linker both use 0x8c, as they see the whole world as 
bytes. But when the program runs it uses 0x46, as it can only address the 
program memory that way. (0x46 times 2 = 0x8c)

>
> Problem #2.
> We use the AVR Extended COFF format for AVR Studio 4.x.
> But debugger doesn't show structures and can't find enter point (main()).
> Any other file it can't find too.

I don't know AVR Studio.

>
> ================================================
>
> Main.c
> ================================================
> unsigned char PROGMEM stam_msg[] = "TEST";
>
> void main( void )
> {
>
> unsigned char sbyte[4];

There's a bug here. You either want [5] in the above line, to include the NUL 
terminator, or you want 4 in the "for" line below to exclude it.

>
> int i;
> for (i=0;i<5 ;i++ )
> {
> sbyte[i] = PRG_RDB(stam_msg+i);
> }
>
> }

-- 
Richard Urwin


reply via email to

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