- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following code works fine:
# define RAMSHADOWBASE 0x01010000# define TESTVARIABLE (*(unsigned int*)RAMSHADOWBASE) Now I want to add a struct on the same way. Thus I want to place a structure on a predefined adress in RAM memory. Struct looks like: struct Defs { unsigned int Nr; unsigned int Place; } lacingHole[40]; Somebody a solution for this?Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nobody a solution????
--- Quote Start --- originally posted by innotronics@Jan 9 2007, 10:40 AM the following code works fine:# define ramshadowbase 0x01010000# define testvariable (*(unsigned int*)ramshadowbase)
now i want to add a struct on the same way. thus i want to place a structure on a predefined adress in ram memory.
struct looks like:
struct defs
{
unsigned int nr;
unsigned int place;
} lacinghole[40];
somebody a solution for this?
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=20433)
--- quote end ---
--- Quote End ---
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi innotronics,
There are two common ways of accomplishing what (I believe) you want: 1, access the structure via a pointer:#define DEFSBASE 0x01010000
struct Defs *pDefs = (struct Defs *) DEFSBASE;
...
pDefs->Nr = <<whatever>>
or ... 2. put the structure in a named section ...
struct Defs myDefs __attribute__ ((section (",defs")));
myDefs.Nr = <<whatever>>
... then locate the section where you want in your linker command file.__defs_start = .;
.defs :
{
*(.defs)
}
Regards, --Scott
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page