[Top][All Lists]

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

Re: [avr-gcc-list] Placing variable at absolute memory locations

From: Henrik Maier
Subject: Re: [avr-gcc-list] Placing variable at absolute memory locations
Date: Sat, 10 Sep 2005 07:58:11 +1000
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)


This creates a pointer to a specific memory location but does *not* allocate the memory. The linker will still place other variables into this memory space.

What I actually want to achieve is reserving a memory space from 0x100 onwards by allocating an absolute variable or a memory block in a C source file. I like to explore if there is an option of doing this _without_ using any linker option by putting some kind of attribute into the C source file. I checked the gcc manuals but could not see anything alike, so I assume there is none.

The alternative solution is moving the .data/.bss section after my special memory space or creating a section and advising the linker of it's position.

But I just wanted it to be confirmed by somebody more familiar with avr-gcc that there is not option of doing this in C only.

Dave Hylands wrote:
Hi Henrik,

On 9/9/05, Henrik Maier <address@hidden> wrote:

Is there any way to place a variable [in my case an array of char] at an
absolute position using just C statements ?

You could just do:

char *buffer = (char *)0x1000;

This would work for any pointer to a structure.

I don't recommend this because you need to ensure that the C compiler
didn't put something else there.

reply via email to

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