[Top][All Lists]

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

Re: [avr-gcc-list] Re: "progmem_far" attribute

From: Andy H
Subject: Re: [avr-gcc-list] Re: "progmem_far" attribute
Date: Sun, 20 Jul 2008 12:51:55 -0400
User-agent: Thunderbird (Windows/20080421)

To use that amount, would suggest we need additional abilities to access progmem without going thru RAM.

But if this is considered a limitation then your method seems ok.

A better name would be  progmem_high. FAR is entirely different.

FAR is normally used to indicate large pointers - not a separate space.
The idea is that default can be set to NEAR or FAR. (Normally NEAR). Overrides would permit certain functions and pointer to be declared FAR These 'function' pointers would then be 32 bits instead of 16. (The same for data if applicable)

Unlike some cpu AVR does not need different direct JMP/CALL/RET for NEAR or FAR functions. This simplifies problem. So for 256K linker/assembler should handle all fixed calls and jumps. No changes are required to gcc - as the destinations are purely symbolic.

trampolines used now are only needed for indirect call - where gcc has 16 bit pointer. FAR would allow trampolines to be removed. If we can create "FAR" as unsigned long and eventually use these in RTL Call (x), the problem is largely solved. We just have to convince gcc to allow it.

special unsigned long x = &foo;



Anatoly Sokolov wrote:

The patch add "progmem_far" attribute in GCC.


----- Original Message ----- From: "Anatoly Sokolov" <address@hidden>
To: "avr-GCC" <address@hidden>
Cc: "Anatoliy Sokolov" <address@hidden>
Sent: Friday, May 02, 2008 8:36 PM
Subject: "progmem_far" attribute


 Now GCC have "progmem" attribute to place data in the '.progmem' section.
The 'avr-libc' have set of '*_P' string functions for access to "progmem"
data. But pointer operand in  '*_P' functions is 16-bit size and hence size
of data in  '.progmem' section it is limited by about 64KB.

 This restriction was rare a source of problem for 128K devices but is very
hard for 256K and up devices.

 I suggest to add "progmem_far" attribute, and place data defined with it
attribute in the new '.progmem_far' section place it in end of '.text'
section after ".fini0" (It is some section which should be located in low
128K ".trampolines*" and ".lowtext*"). For access to data in this section
to use set of  '*_PF' string functions (patch #6352: Far pointer library).

 Now the programmer can define often used data with "progmem" attribute and
define seldom used data with  "progmem_far" attribute.

 Yes I understand what to have two similar sets of attributes and functions
is error prone, but it is necessary to allow to the programmer to store more
them 64KB data in program memory, not forcing it to write the linker script.

For 'xmega' devices it is necessary to add  '.apptable' section which is
located in the top 8(4)KB of FLASH.

What your opinion on this offer?


AVR-GCC-list mailing list

reply via email to

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