public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Constant at a defined address
@ 2006-06-08 15:07 Phildale
  2006-06-08 17:54 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Phildale @ 2006-06-08 15:07 UTC (permalink / raw)
  To: gcc-help


In other compilers this works

#define Address

const u8 Var[] @ Address = {
    1,2,3
}

so Var is alway at address, how can i do this with teh GCC compiler?

thanks
--
View this message in context: http://www.nabble.com/Constant-at-a-defined-address-t1755638.html#a4774141
Sent from the gcc - Help forum at Nabble.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Constant at a defined address
  2006-06-08 15:07 Constant at a defined address Phildale
@ 2006-06-08 17:54 ` Ian Lance Taylor
  2006-06-09  9:15   ` Phildale
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2006-06-08 17:54 UTC (permalink / raw)
  To: Phildale; +Cc: gcc-help

Phildale <Pdale@activer.com> writes:

> In other compilers this works
> 
> #define Address
> 
> const u8 Var[] @ Address = {
>     1,2,3
> }
> 
> so Var is alway at address, how can i do this with teh GCC compiler?

You can't.

You can do something along these lines using the linker.  Read about
linker scripts in the linker manual.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Constant at a defined address
  2006-06-08 17:54 ` Ian Lance Taylor
@ 2006-06-09  9:15   ` Phildale
  0 siblings, 0 replies; 3+ messages in thread
From: Phildale @ 2006-06-09  9:15 UTC (permalink / raw)
  To: gcc-help


thanks i did it like this

const u8 ConfigArray[] __attribute__ ((section ("ConfigArea"))) = {

}

then used the linker to place the section ConfigArea.
--
View this message in context: http://www.nabble.com/Constant-at-a-defined-address-t1755638.html#a4789866
Sent from the gcc - Help forum at Nabble.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-06-09  9:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-08 15:07 Constant at a defined address Phildale
2006-06-08 17:54 ` Ian Lance Taylor
2006-06-09  9:15   ` Phildale

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).