ya i'm basically an Electronics Engg . Thanx for
your tips . Xpecting the same from you.
karthik bala guru
--- Shehryar Shaheen <shehryar.shaheen@...> 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
> stack if the stack is say 2 locations deep then
> greater than
> 1 nested function call from within a function will
> 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
> stack depth. Depending on processor architecture if
> 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
> 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
> for smaller microcontrollers.
> Best Regards
> ----- Original Message -----
> From: "karthik bala guru" <sdcckarthik@...>
> To: <sdcc-user@...>
> 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
> > 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
> > linladn@...
> > --- Simon Hosie <Simon.Hosie@...>
> > > 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
> > > 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,
> > > 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
> > > think of, not about the things the designers
> > > wouldn't specify.
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software