This is a group for folks designing and programming embedded systems using the Rabbit Semiconductor C-programmable microcontroller. Rabbit Semi is a spin-off from Z-World who makes a variety of embedded modules and tools. This group is not affiliated with either Rabbit or Z-World, but is a user forum for sharing ideas, asking questions,
flaunting knowledge, and other typical user group stuff. The Rabbit is a powerful uC, supported by a full-featured C-compiler.
Reserving specific addresses in battery backed RAM (RCM3365) - pdaderko - May 24 14:44:24 2008
Hey,
I've got an RCM3365 module that I'm logging data to the flash. I'm
keeping an index of the log in the battery backed RAM so after a reset
I still know where everything is in the flash, but since the index is
read/written to frequently, SRAM seems like a better place to store it.
Anyway, my question is... currently I'm allocating the memory space
using _xalloc()... is there a way I can be sure that I'll always get
the same memory space reserved? Right now I have the allocated
address stored in the battery backed RAM, and only _xalloc's when it's
manually cleared (which can be after many restarts), but I believe
this means at boot up, something else could _xalloc the same RAM and
overwrite my index since it doesn't know what was allocated with
_xalloc() when the log was started. If I _xalloc() every time at
bootup, the system would know that memory is there, but I think it
could give me a different address, which would be even worse since it
may or may not give me any or all of my index.
I believe I could manually give it a hard coded address if I needed to
(like the upper 128KB of battery backed RAM), but is there a way to
tell the Rabbit that the memory space is reserved? Or is there an
_xalloc()-like function that lets me specify the address to allocate?
Thanks,
Pat
------------------------------------

(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )
Re: Reserving specific addresses in battery backed RAM (RCM3365) - Scott Henion - May 24 16:31:55 2008
pdaderko wrote:
> Hey,
>
> I've got an RCM3365 module that I'm logging data to the flash. I'm
> keeping an index of the log in the battery backed RAM so after a reset
> I still know where everything is in the flash, but since the index is
> read/written to frequently, SRAM seems like a better place to store it.
>
> Anyway, my question is... currently I'm allocating the memory space
> using _xalloc()... is there a way I can be sure that I'll always get
> the same memory space reserved? Right now I have the allocated
> address stored in the battery backed RAM, and only _xalloc's when it's
> manually cleared (which can be after many restarts), but I believe
> this means at boot up, something else could _xalloc the same RAM and
> overwrite my index since it doesn't know what was allocated with
> _xalloc() when the log was started. If I _xalloc() every time at
> bootup, the system would know that memory is there, but I think it
> could give me a different address, which would be even worse since it
> may or may not give me any or all of my index.
>
> I believe I could manually give it a hard coded address if I needed to
> (like the upper 128KB of battery backed RAM), but is there a way to
> tell the Rabbit that the memory space is reserved? Or is there an
> _xalloc()-like function that lets me specify the address to allocate?
>
If you allocate it every time at the start of main() you will always get
the same address.
--
------------------------------------------
| Scott G. Henion| s...@shdesigns.org |
| Consultant | Stone Mountain, GA |
| SHDesigns http://www.shdesigns.org |
------------------------------------------
Rabbit libs: http://www.shdesigns.org/rabbit/
today's fortune
avenj: pingelingeling
if you want to ping them, you need more class
avenj: money
------------------------------------

(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )Re: Reserving specific addresses in battery backed RAM (RCM3365) - mehiegl - May 24 19:14:28 2008
Similar to Scott's suggestion, you can declare the variables
as "bbram" either or "protected" variables, and always declare it
first among your global variables, assuming you have root space
available. This has the advantage of direct accessing the variables
rather than using the xmem functions.
Mark
--- In r...@yahoogroups.com, "pdaderko"
wrote:
>
> Hey,
>
> I've got an RCM3365 module that I'm logging data to the flash. I'm
> keeping an index of the log in the battery backed RAM so after a
reset
> I still know where everything is in the flash, but since the index
is
> read/written to frequently, SRAM seems like a better place to store
it.
>
> Anyway, my question is... currently I'm allocating the memory space
> using _xalloc()... is there a way I can be sure that I'll always get
> the same memory space reserved? Right now I have the allocated
> address stored in the battery backed RAM, and only _xalloc's when
it's
> manually cleared (which can be after many restarts), but I believe
> this means at boot up, something else could _xalloc the same RAM and
> overwrite my index since it doesn't know what was allocated with
> _xalloc() when the log was started. If I _xalloc() every time at
> bootup, the system would know that memory is there, but I think it
> could give me a different address, which would be even worse since
it
> may or may not give me any or all of my index.
>
> I believe I could manually give it a hard coded address if I needed
to
> (like the upper 128KB of battery backed RAM), but is there a way to
> tell the Rabbit that the memory space is reserved? Or is there an
> _xalloc()-like function that lets me specify the address to
allocate?
>
> Thanks,
> Pat
>
------------------------------------

(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )Re: Reserving specific addresses in battery backed RAM (RCM3365) - pdaderko - May 25 0:57:20 2008
--- In r...@yahoogroups.com, Scott Henion
wrote:
>
> pdaderko wrote:
> > Hey,
> >
> > I've got an RCM3365 module that I'm logging data to the flash. I'm
> > keeping an index of the log in the battery backed RAM so after a reset
> > I still know where everything is in the flash, but since the index is
> > read/written to frequently, SRAM seems like a better place to
store it.
> >
> > Anyway, my question is... currently I'm allocating the memory space
> > using _xalloc()... is there a way I can be sure that I'll always get
> > the same memory space reserved? Right now I have the allocated
> > address stored in the battery backed RAM, and only _xalloc's when it's
> > manually cleared (which can be after many restarts), but I believe
> > this means at boot up, something else could _xalloc the same RAM and
> > overwrite my index since it doesn't know what was allocated with
> > _xalloc() when the log was started. If I _xalloc() every time at
> > bootup, the system would know that memory is there, but I think it
> > could give me a different address, which would be even worse since it
> > may or may not give me any or all of my index.
> >
> > I believe I could manually give it a hard coded address if I needed to
> > (like the upper 128KB of battery backed RAM), but is there a way to
> > tell the Rabbit that the memory space is reserved? Or is there an
> > _xalloc()-like function that lets me specify the address to allocate?
> >
>
> If you allocate it every time at the start of main() you will always get
> the same address.
>
> --
> ------------------------------------------
> | Scott G. Henion| shenion@... |
> | Consultant | Stone Mountain, GA |
> | SHDesigns http://www.shdesigns.org |
> ------------------------------------------
> Rabbit libs: http://www.shdesigns.org/rabbit/
> today's fortune
> avenj: pingelingeling
> if you want to ping them, you need more class
> avenj: money
>
Thanks, I was hoping that'd be the case. BTW, I have to use _xalloc()
because I'm using a couple hundred KB, which I found out I can't use
bbram/protected arrays since it'd put that in root mem. Luckily I
came across your website showing how to handle this using the xset()
and xget() functions... so thanks for having that resource available
as well.
Pat
------------------------------------

(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )