Re: Floating point calculations on 16 uC



On 28 Aug, in article
<1125239554.268511.307260@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
dbahlmann@xxxxxxxxx "db" wrote:

>It's not 1 or 3. Number 2 could be possible but the float routines is
>not very big and I have about 6KB stack allocated. I have decreased
>stack size to 4KB to see if the problem gets worse but it stays the
>same. Any other possibilities? Thanks

First as other have said quote the article you are answering.

Second HOW do you know that reducing the stack size means the
problem "stays the same"?

If memory map is as a guide

Address Stack top
6KB
Space 0 to n bytes
Last variable

When reducing the stack size may just make this

Address Stack top (address same as when stack was 6KB)
4KB
Space 2K to 2k+n bytes
Last variable

If when running with 6KB stack (for whatever processor/compiler compilation
you are using), the stack actually used is 6K + m bytes, if m is larger than
the space between your stack ALLOCATION and the last variable byte, then it
WILL overwrite the variable. This will happen NO matter what allocation size
you reduce it to.

If you have space between bottom of stack allocation and the last variable
fill it with KNOWN values like hex 01,02,03..... Check this has loaded
correctly before starting. When the process gives a garbage value check
these locations again, if different your stack actually has grown larger
than predicted.

There may be other problems but without details from a MAP file showing
what there is in address ranges from the last variable to where the stack
is and proof that you have performed some test of your own, (not some
stack routine that may be flawed).

What happens if you remove some variables or a module, to leave a larger
space below the stack?

What compiler, processor and other details would be helpful. It may be other
issues to do with the interupt routine itself, but more likely stack usage
is larger than you think it is.

--
Paul Carpenter | paul@xxxxxxxxxxxxxxxxxxxxxxxxxxx
<http://www.pcserviceselectronics.co.uk/> PC Services
<http://www.gnuh8.org.uk/> GNU H8 & mailing list info
<http://www.badweb.org.uk/> For those web sites you hate

.



Relevant Pages

  • Re: Exception in CreateDialogIndirect when call DoModal in debug
    ... The stack allocation (reserve) is the amount of space that will be reserved for the stack. ... leaving the other parameters intact. ...
    (microsoft.public.vc.mfc)
  • Re: PRB dllhost stack overflow
    ... I wouldn't recommend changing the stack size unless you are going to be ... If it is your .exe, you can set the size to be whatever ... > DLLs, script, etc that in turn be built using stack allocation. ... I'm going to try setting a variable for my AfxBeginThread to ...
    (microsoft.public.inetserver.iis)
  • Re: Sprocs stack allocation problem
    ... >I'm trying to create a process with a custom stack allocation using ... >This code compiles and runs, however the code inside callBackFcn never ... >computing the stack addr. ... the argument sp is set to NULL then the system will create a stack region ...
    (comp.sys.sgi.misc)
  • Re: Recursion Depth in Java
    ... Expand the size of the stack with a run time ... In a single thread language you can allocate all of the remainder of ... it own fixed size stack allocation. ... http://mindprod.com Java custom programming, consulting and coaching. ...
    (comp.lang.java.programmer)