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

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

[avr-gcc-list] Re: ROM data and far and huge ptrs


From: Niklas Brogden
Subject: [avr-gcc-list] Re: ROM data and far and huge ptrs
Date: Mon, 12 Apr 2004 12:30:39 +0200

Ted Roth wrote....(clipped)
>
>
> The fix is to change the for loop to something like this:
>
>     //but strcpy_P copy char from wrong address if use variable indexing
>     for (i=0; i<2; i++)
>     {
>         PGM_P ptr = (PGM_P) pgm_read_word (Langs[i]);
>         strcpy_P(buf[i], ptr);
>     }
>
I still had problems with this solution, but I now see the cause of the
problem.

Changing a line above to reference the flash string pointer array directly:

PGM_P ptr = (PGM_P) pgm_read_word (Langs+i);

has fixed the problem once and for all. (Big sigh of relief...)


>
> This time Z is used by the LPM insn to get the pointer for foo from
> flash.
>
> Hope that helps clear things up. I also hope I didn't get this wrong, if
> I did, hopefully someone will catch my mistake. ;-)
>
> ---
> Ted Roth


Big Thankyou from NIK...



_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list


reply via email to

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