We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I'm devlopping a application based on a 8-bit microcontroller and i'm looking for a code example in assembly in order to save/restore CPU stack (return address on 16 bits) in external RAM (xdata) in order to avoid stack overflow... I would appreciate if someone could help me or give a code example. Bye
Are you trying to write some sort of multitasking kernel?
a 8-bit microcontroller since no toolset is indicated which "8-bit microcontroller" also, your question is typical for people that have a PC hat glued to their ears. Erik
The microcontoller used is Philips SmartMX (microcontroller compatible with 8051 instruction set). Sorry for my question.
Sorry for my question Do not feel "sorry for your question", instead get familiar with '51 coding practices. Do not believe the urban legend that C is processor independent. Erik
if you have no answer, do no systematically reply to my messages. I repeat my question for the real '51 developpers: i'm looking some code example to save call stack (from C0h address to FFh) to xdata RAM (B20h to B60h). Thanks for your answers.
memcpy ((U8 xdata*)0xB20, (U8 idata*)0xc0, 64);
Step into the assembly and see what it does. If you really want to code your own, you'll be using DPTR to point into xdata and a register to point into idata space, probably DJNZ to count. It's just a loop.
I repeat my question for the real '51 developpers: i'm looking some code example to save call stack (from C0h address to FFh) to xdata RAM (B20h to B60h). no real '51 developer would attempt this so you can stop insulting me by excluding me from that group. Erik
"save/restore CPU stack ... in order to avoid stack overflow" If you have a stack-overflow problem, you need to fix it. Your suggestion will not fix it - it will just mask the consequences!
ok! thanks for your answers!