I am currently using DC 9.25 on a Rabbit LP3500 board. I need to get a long value from a device connected to the the board and store it in persistant memory. I have seen the documentation on the xmem functions, but my problem is how do I know what the address of the stored data is in the event of a board reset?
Any help with this would be greatly appreciated.
Thanks
John
So, no one has any idea on how to access the same memory block in the event of a board reset? Any moderator care to offer some assistance, please?
Thanks
John.
If all you are concerned about is a long value, then just make a static or global long variable and put it there. Unless you download new code, a static or global variable will be in the same place every time.
Bill,
So if I out the value in a static long, the variable will retain it’s value even on a board reset?
Thanks
John
John,
Yes, it will. By default C variables are not initialized. Therefore, as long as you don’t do anything to it, the value it had at reset will still be there. In fact, the SRAM on the 3500 is battery backed so you could even lose power completely and it would still be there. The reset only restarts the processor, it does not do anything to the SRAM.
What happens if new code is downloaded (or if the same code is re-loaded at next execution)?
Is there a way to achieve static storage that doesn’t move with code size?
In my case, it’s an RCM3700, with an external battery, if that matters.
i’m using a BL2600 and I’ve a little problem.
I’ve wrote my data whith root2xmem function after I can have access to this part of the memory to get back my data ,everything is ok but when shut down the power and i can’t get back my data , it returned other value.
I used the previous tip with static but it’s the same things.
thanks
The problem is that not all Xmem is battery backed. The comment I made earlier was for a small value (4 byte long) defined as static in root memory. Root memory is battery backed. In your case you are looking for the same from Xmem. Depending on your memory usage, you may have Xmem that is battery backed, however, when allocating the Xmem, you must specify that you would like it to be ‘Battery Backed’. Also, the pointer returned by this call must be kept in battery backed RAM as well. To specify battery backed Xmem, give ‘XALLOC_BB’ as the last parameter (type) in the _xalloc call. If it returns a valid pointer rather than an error code, you should have your block of battery backed RAM. As mentioned, keep the returned pointer in a static long variable in root memory and you should not have a problem.
ok I’ll try this and tell you if it’s work