Stack Size?
Joerg
Posts: 91
I am dealing with a stepper motor module and have noticed, that the module did not run when the stack was to tight.
How can i calculate the stack size needed?
Saluti Joerg
How can i calculate the stack size needed?
Saluti Joerg
Comments
Then in your program's main loop do:
...assuming you have a debug LED on pin 0.
So if ever the stack reaches the last location of RAM and overwrites it, the debug LED comes on, and you know you need a bigger stack.
If you want a margin for error, you could test a location slightly further down in memory. If you use block of memory at the top of RAM for a frame buffer or smething, test the location just below the frame buffer.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Help to build the Propeller wiki - propeller.wikispaces.com
Play Defender - Propeller version of the classic game
Prop Room Robotics - my web store for Roomba spare parts in the UK
Untested, but something along the lines of ...
I am felling like in the early 80's, when i had to do debuting with LED's and other
genius stuff (Z80 and CP/M80!!). Is there really no simple debugging tool.
I think a simple debugger and a simulator would help a lot. I am using CodeWarrier
for Freescale MCU's (for other projects) an i appreciate much the simulator to check if
my code is (more or less) doing what i need, and the debugger helps a lot to reach the
"target" of the project in a reasonable time!
Who has experience in this field? Teaching for a long time microcontroller stuff has shown
to me that it is extremely important to offer simple but powerful tools to beginners, so they
are motivated and not frustrated. Even if i can live with the actual situation (used to poor environments!).
Saluti e grazie mille per l'aiuto
Joerg
At present Spin is probably best debugged by adding some form of debugging object which allows progress and variable values to be displayed; the TV objects are brilliant for this and serial is easy to add and use as well.
For determining stack size used, one could create a stack size monitoring object and I believe something like that is available in the Object Exchange already. In most cases it's usually enough to create a large enough stack to get the code running then reduce it until it fails then add a bit extra on for safety. Trying to find the exact, absolute minimum stack size is probably unnecessary in most cases.
I was only thinking a little loud, but since i have seen many MCUs on my way and also many tools i think it is
necessary that PARALLAX is including an interface for easy debugging. The communication channel is already present
and for downloading code only its a waste!
So i kindly ask the PARALLAX guys to improve the environment and i am pretty sure they will have more success with the
Propeller story.
Saluti Joerg