public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Robin Kirkham <Robin.Kirkham@cmst.csiro.au>
To: will <will_lentz@Trimble.COM>
Cc: ecos-discuss@sourceware.cygnus.com
Subject: Re: [ECOS] C variables in sections
Date: Wed, 19 Jan 2000 16:06:00 -0000	[thread overview]
Message-ID: <20000120000548.15664.qmail@ragnarok.preston.cmst.csiro.au> (raw)
In-Reply-To: <38864D7F.D4B91B62@trimble.com>

On Wednesday, 19 January 2000, will wrote:
> 
>    Is there any way to put a C variable in a specific section
> without having to initialize it?  I found the following example
> for initialed variables:
>   char stack[10000] __attribute__ ((section ("STACK"))) = { 0 };
> 
> When I leave off the initialization to 0, the variable no longer
> appears in the appropriate section.  I have some battery-backed
> RAM that should not be cleared on startup.

You need the initialisation because gcc/gld will only assign *initialised*
data to a specfic section.

However, this data will only be written when the program is *loaded* into
the computer, as opposed to when it is first *run*. This is same as with
the normal initialised data segement (usually called .data). So you can 
avoid overwriting data in your battery-backed RAM by instructing your
program loader *not* to load section STACK (or whatever you called it).

Hope this helps,

Robin Kirkham			CSIRO Manufacturing Science and Technology
Project Engineer		Locked Bag 9, Preston 3072, Australia
robin.kirkham@cmst.csiro.au	Phone: +61 3 9662-7756  Fax: +61 3 9662-7853

      reply	other threads:[~2000-01-19 16:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-19 15:49 will
2000-01-19 16:06 ` Robin Kirkham [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20000120000548.15664.qmail@ragnarok.preston.cmst.csiro.au \
    --to=robin.kirkham@cmst.csiro.au \
    --cc=ecos-discuss@sourceware.cygnus.com \
    --cc=will_lentz@Trimble.COM \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).