Searching \ for 'Antwort: Re: stack check in mplab simulator (5.62' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/languages.htm?key=mplab
Search entire site for: 'Antwort: Re: stack check in mplab simulator (5.62'.

Truncated match.
PICList Thread
'Antwort: Re: stack check in mplab simulator (5.62'
2002\09\11@022457 by Martin Buehler

flavicon
face
thanks, but i'm not shure if this will work for me, as i use a compiler to
generate the assembler code. so i think i have to patch the assembler
code, before the compiler forwards it to the assembler?!?
thanks tino





Scott Dattalo <spam_OUTscottTakeThisOuTspamDATTALO.COM>
Gesendet von: pic microcontroller discussion list <.....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU>
11.09.02 08:16
Bitte antworten an pic microcontroller discussion list


       An:     PICLISTspamKILLspamMITVMA.MIT.EDU
       Kopie:
       Thema:  Re: stack check in mplab simulator (5.62)


On Wed, 11 Sep 2002, Martin Buehler wrote:

> i simulate my code for a 16f876 using the mplab simulator.
> this chip has 8 hardware stack levels. so i think the simulator does
> automatically check, that i never use more than 8 levels.
> for system integration, i would like to work with the icd, which uses 1
> stack level itself.
> how can i reduce the stack size for the simulation to 7, so that i can
see
>
> in the simulation, if i will get problems, using the icd?
> i could not find a file, where i can define the number of stack levels.
> tino

   org  0

ifdef   SIMULATING_ONLY
   call  $+1             ; push a bogus value onto the stack.
endif
   bra   start


Is that what you're looking for?

Scott

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\09\11@023537 by Scott Dattalo

face
flavicon
face
On Wed, 11 Sep 2002, Martin Buehler wrote:

> thanks, but i'm not shure if this will work for me, as i use a compiler to
> generate the assembler code. so i think i have to patch the assembler
> code, before the compiler forwards it to the assembler?!?
> thanks tino

void  main(void)
{

#ifdef  SIMULATION_ONLY
  _asm
       call    $+1
  _endasm;

#endif

  while(1)
    my_code_that_crashes();

}


I of course used SDCC's inline assembly syntax. I doubt you're using SDCC
though. Hopefully your compiler is equipped with a preprocessor and inline
assembler. If not you're SOL.

Scott

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\09\11@025057 by Andrew Warren

flavicon
face
Martin Buehler <.....PICLISTKILLspamspam.....mitvma.mit.edu> wrote:

> >     org  0
> >
> > ifdef   SIMULATING_ONLY
> >     call  $+1             ; push a bogus value onto the stack.
> >  endif
> >     bra   start
>
> thanks, but i'm not shure if this will work for me, as i use a
> compiler to generate the assembler code. so i think i have to patch
> the assembler code, before the compiler forwards it to the
> assembler?!?

Tino:

I think you can do the same thing in C:

   main()
   {

   #ifdef (SIMULATING_ONLY)  // Insert these 6 lines
       main2();              //
   }                         //
   main2()                   //
   {                         //
   #endif                    //

       // ...your existing main() code goes here...
   }

If you're lucky, the compiler won't optimize the extra subroutine
call away.

-Andy

=== Andrew Warren -- EraseMEaiwspam_OUTspamTakeThisOuTcypress.com
=== Principal Design Engineer
=== Cypress Semiconductor Corporation
===
=== Opinions expressed above do not
=== necessarily represent those of
=== Cypress Semiconductor Corporation

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\09\11@025449 by Scott Dattalo

face
flavicon
face
On Tue, 10 Sep 2002, Scott Dattalo wrote:

{Quote hidden}

-- There's actually an easier way that doesn't involve inline assembly:


void main(void)
{

#ifdef SIMULATION_ONLY
   bogus_routine();
#endif


  while(1)
    my_code_that_crashes();

}


void
bogus_routine(void)
{

  while(1)
    my_code_that_crashes();

}

Basically, you force an extra call. Now this won't work on SDCC since
it'll inline a simple call like this.

Scott

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...