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

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

Re: [avr-gcc-list] string decleration


From: Rawji, Marc
Subject: Re: [avr-gcc-list] string decleration
Date: Wed, 16 Feb 2005 10:31:02 -0400
User-agent: Mozilla Thunderbird 0.7.3 (X11/20040803)

Daniel O'Connor wrote:

On Wed, 16 Feb 2005 23:20, Rawji, Marc wrote:
In short, I am trying to generate a string and then output it to the uart.
(code snippet)
char str[] = "test";
PORTA = 't';  //properly displays the ascii code for 't'
PORTB = str[0];
(end code snippet)

from what I understand, 'str' should be allocated into SRAM, which is
fine and it should be an array where str[0] = 't', str[1] = 'e', etc...

(snip)
Well, PORT A and PORTB are different. 'str[0]' always returns 0xFF on
the LEDS.

0xff almost certainly means it isn't in SRAM..

I think the problem is because it's static the compiler puts it in PGM space.

Does..
char str[10];
strcpy(str, "test");

work?


Hi Daniel,

Joerg Wunsch pointed the correct problem. I had setup my makefile as per one of the 
examples "getting started with the toolchain" and they had use
avr-objcopy -j .text -O ihex infile outfile. What i needed was
avr-objcopy -O ihex infile outfile to copy the .data section also.

Thanks for your help,
Thanks Joerg!

Marc








reply via email to

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