large temperary storage [SOLVED]
Bobb Fwed
Posts: 1,119
Is it OK to place large string (or array or stack) somewhere in the empty/stack space? I have the program reading a large (indeterminably large at compile time) amount of information from the EEPROM and want to put it somewhere so it can be accessed by address (in the near future -- not long term storage). I can't just make a massive variable stack because it can't be used later (or for other objects). Is there any way to know where there is inactive empty/stack space in RAM? How does the Prop know where to put stack information? Does it continually just use the lowest possible memory?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
Post Edited (Bobb Fwed) : 8/21/2009 5:37:29 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
Post Edited (Bobb Fwed) : 8/21/2009 5:37:29 PM GMT
Comments
The prop hardware architecture doesn't use stacks.
How big is this string?
- Howard
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Bobb, one thing you do is can use one of the memory managers from the OBEX. Look for Peter's HEAP.spin for example. You declare a an array big enough for your application and give it to HEAP.spin for management. If you are looking for a more generic top-down heap manager, this can be done, but unless you run a spin interpreter cog that emits the stack pointer, there is no way other than a crash with this method to tell when the stack and heap overlap. If you use spud, you can see the stack pointer or dump the stack at any time during debug. Spud is relatively new though.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
This returns roughly the amount of space between the top of the stack and the end of memory. Keep in mind that there'll still be more calls and some additional stack may be used. You usually want to allow a "fudge" factor of at least a couple of hundred bytes.
> If you use spud, you can see the stack pointer or dump the stack at any time during debug. Spud is relatively new though.
But it's really cool so far...
... And yes, Steve, I caught that SneakySpudPlug :-P
say, when the debugger (?) is done, can you please call it the Spud Gun ?! <G>
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Wasn't there a "malloc" implemented last year that used all left-over memory?
Just an FYI Howard [noparse]:)[/noparse] I need user feedback. Spud gun ... is that like a Pumpkin catapult ?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
Now what am I doing wrong with this code?
This works:
But this should be faster...but isn't working:
For both of these...block_size represents the block size of the EEPROM which is 64 (bytes).
And read() returns the RAM address of the read EEPROM information (used with basic i2c driver).
As usual....it's probably simple....but so far not obvious to me...more pairs of eyes will help.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
Post Edited (Bobb Fwed) : 8/21/2009 5:05:26 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔