Memory initialization (not)

Eljay Love-Jensen eljay@adobe.com
Tue Sep 30 14:29:00 GMT 2008


Hi Jim,

How do you access the battery backed RAM?

Is the battery backed RAM part of the heap?  Special section?

On a system that I worked on, which had I/O memory at 0xC0000000, part of
which was battery backed memory, I used this:

char* RawC000Page = (char*)0xC0000000;

I also used this for the same memory:

struct C000Page_t* C000Page = (struct C000Page_t*)0xC0000000;

Note:  some of the C000Page_t was write-only (reading would be BAD), some of
C000Page_t was read-only (writing would be BAD), some was read/write (but
reading and writing semantically meant different things to the I/O
register), and some was battery backed RAM (reading/writing okay).

The memory was not part of the heap, nor was it part of the .data or .bss
sections.  I just wrangled a pointer to point to it.  There was no OS, it
was just the code in EEPROM, bootstrapped from an initialization ROM.  There
was a managed heap using malloc/free, but that heap was no where near the
0xC0000000 page.  The stack was carved out of the heap.

Would something like this work for you?

HTH,
--Eljay



More information about the Gcc-help mailing list