Re: [avr-gcc-list] Memory problem

2009-06-23 Thread Parthasaradhi Nayani
--- On Mon, 6/22/09, David Kelly dke...@hiwaay.net wrote:

Study the include files for register definitions for a means of
controlling the absolute address of allocation.


Thank you David Kelly for your response. I will sieve through the header files 
to know how to allocate a variable to a memory location.

Regards,
Parthasaradhi
Hyderabad






  ___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list


Re: [avr-gcc-list] Memory problem

2009-06-23 Thread Parthasaradhi Nayani
--- On Tue, 6/23/09, Joerg Wunsch j...@uriah.heep.sax.de wrote:

The only method to not have the linker reorder your variables is to
just use a single variable (per memory section).  So, put some kind of
an embracing struct around all your variables you'd like to have in
a particular order, and you'll be done.

Thank you very much for your suggestion. In case I declare all the variables in 
a structure then accessing each variable will require using the structure 
name.variable name! However I would like to assign a memory to a variable also 
therefore can you suggest how I can do this? Thanks once again for your support.

Regards,
Nayani P





  ___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list


Re: [avr-gcc-list] Memory problem

2009-06-23 Thread David Kelly
On Tue, Jun 23, 2009 at 02:02:37AM -0700, Parthasaradhi Nayani wrote:
 --- On Tue, 6/23/09, Joerg Wunsch j...@uriah.heep.sax.de wrote:
 
 The only method to not have the linker reorder your variables is to
 just use a single variable (per memory section).? So, put some kind of
 an embracing struct around all your variables you'd like to have in
 a particular order, and you'll be done.
 
 Thank you very much for your suggestion. In case I declare all the
 variables in a structure then accessing each variable will require
 using the structure name.variable name! However I would like to assign
 a memory to a variable also therefore can you suggest how I can do
 this? Thanks once again for your support.

Joerg listed two methods. One is that you declare one section per
variable and set the address in each section declaration. The second is
the observation that a struct counts as one variable and that the
contents of a struct are not reordered.

It wouldn't be a bad idea at all to put all your external flash
variables in a struct named flash if for no other reason than to remind
you they are in flash and require special treatment to write. No matter
you code flash.variable to access, the generated code is just the same
as had variable not been in a struct. OTOH if you use a pointer to the
flash struct, flash-variable, then the code will grow unless the
compiler knows for certain that flash is constant.

Something like this might work for you:

typedef struct {
uint8_t variable;
uint16_t a, b, c, d;
uint32_t e;
} FLASH_STRUCT;

#define flash_p ((FLASH_STRUCT *)(0x8000))


Then use flash_p-variable to access.

The con of this method is that that all accounting of flash use has to
be done manually by the code author.

-- 
David Kelly N4HHE, dke...@hiwaay.net

Whom computers would destroy, they must first drive mad.


___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list


Re: [avr-gcc-list] Memory problem

2009-06-23 Thread Parthasaradhi Nayani

--- On Tue, 6/23/09, David Kelly dke...@hiwaay.net wrote:

Something like this might work for you:

typedef struct {
    uint8_t variable;
    uint16_t a, b, c, d;
    uint32_t e;
} FLASH_STRUCT;

#define flash_p ((FLASH_STRUCT *)(0x8000))


Hello David Kelly,

Thanks a lot for taking time to enlighten me on these issues. As you
had suggested to one of my earlier posts,  I created a section and named it 
EXFLASH and put my
variables there, many of them strings. I had a horrid time trying to
find out why a structure defined thus



struct EXFLASH mystruct tempstruct;



had some weird values.  When I checked the map file the named structure
was allotted space in RAM!! Finally I changed the above to



struct mystruct EXFLASH tempstruct;



and the structure was allotted space in EXFLASH. Phew!!! I finally got the 
struct into FLASH (this will help others in future I guess)

I created one more in RAM and copied the FLASH content to this stuct and able 
to access members witout difficulty. Any pointers on fixed memory allocation 
will really help. Thanks once again to you and Joerg.



Regards,
Nayani P







  ___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list


[avr-gcc-list] Took half of my system

2009-06-23 Thread grant donald
Hello,

I was having compatability problems and wanted to take out the AVR GCC, I
took it out alright and half my system with it. None of my exe's worked,
like ie, firefox, my drivers were missing from my jvc program. I had to do a
system restore which fixed most things but the drivers had to be replaced
from the disk. So now i'm afraid to try to take it out again and i still got
compatability problems. What's up with that? Never happened before with
anything being uninstalled.

Grant
___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list