From: karthik b. g. <sdc...@ya...> - 2003-07-22 18:05:03
|
ya i'm basically an Electronics Engg . Thanx for your tips . Xpecting the same from you. regards, karthik bala guru --- Shehryar Shaheen <she...@ul...> wrote: > Dear Friend > I think you never paid attention > during your > computer architecture course. > > It's just the way a stack works in every processor. > > Every call you make to a function the processor > pushes the current program counter location on to > the > stack if the stack is say 2 locations deep then > greater than > 1 nested function call from within a function will > cause > a stack over flow and the processor will never be > able to > return to the point from where it made the call. > > Function calls from within functions are dependant > on > stack depth. Depending on processor architecture if > the > nested call exceeds the stack depth the last > location on the > stack is either over written or the last pushed > address will > be lost. > > In any case stack over flow as well as under flows ( > under flow is when you > 'pop' more than what has been 'pushed') to be > avoided and such information > is > always given in microcontroller data sheets. > > Same is with nested interrupts, nested interrupts > are also dependant on > stack depth. > > These are considerations that you need to take in > account when writing code > specially > for smaller microcontrollers. > > Best Regards > > Shehryar > > > ----- Original Message ----- > From: "karthik bala guru" <sdc...@ya...> > To: <sdc...@li...> > Sent: Sunday, July 20, 2003 3:40 PM > Subject: RE: [Sdcc-user] crashing a microcontroller > - killing 8051 - hanging > a controller !! > > > > Dear friends, > > I made an interesting observation. The stack > > pointer moves on each function call and the > controller > > restarts/hangs when the stack limit is reached. > > This occurs especially when a function calls > > a function and that function inturn calls another > > function and the flows goes on. > > So, I think it is better to avoid calling > > a function from within a function . Even if we > > do that, we have restrict it to a limit. > > > > MONITOR THE STACK ..... > > > > karthik bala guru > > li...@ya... > > > > > > > > --- Simon Hosie <Sim...@co...> > wrote: > > > karthik bala: > > > > fine guess. I am into some of the undocumented > > > methods tooo. I am > > > > waiting for such postings from this group . At > > > present i am mainly > > > > concentrating on the s/w segment. I would get > deep > > > into the h/w > > > > concepts dealing with this too. > > > > > > Andy Green: > > > > It will be a bit of a short experiment -- > there is > > > only one undefined > > > > opcode in 8051, 0xa5. > > > > > > There are some other undefined instructions, > too. > > > For example, I recall an Atmel datasheet saying > > > something like 'mov A, ACC' was undefined. > > > > > > Remember, though, that hacks like this are more > > > often about finding things that the designers > didn't > > > think of, not about the things the designers > > > wouldn't specify. __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com |