This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Strange jmp in program

Hello,
In my program, I call C function form assembly main code. But sometimes while excuting the C functions, the program jumps back to the Assembly code!!!!
Have this happened to anyone?
I'm using Level 9 optimize (because my code is very big).
Thanks.

Parents
  • the program jumps back to the Assembly code!!!!

    Are you sure that's the Assembly code, as opposed to, say, just some code that the debugger couldn't find C source for?

    I'm using Level 9 optimize (because my code is very big).

    Try to understand what the optimizations done at that level actually mean, and this should clear itself up. Here's a hint: what might "common tail merging" be?

Reply
  • the program jumps back to the Assembly code!!!!

    Are you sure that's the Assembly code, as opposed to, say, just some code that the debugger couldn't find C source for?

    I'm using Level 9 optimize (because my code is very big).

    Try to understand what the optimizations done at that level actually mean, and this should clear itself up. Here's a hint: what might "common tail merging" be?

Children
  • Oh, thanks for quick answer. But I've figured out the reason. That's all about my Stack size. In the assembly program, I initilized the stack size is 32 bytes and that is not enough for the whole new program, with C functions.
    Thanks again.
    P/s: about the optimize level, because when I compile my program with Level 8, it made the code size was over 100 KiloBytes, over my flash memory which is only 64KB. So I use the Level 9, and the code size reduced to 63KB, and that is all I need.

  • "not enough for the whole new program, with C functions."

    The "with 'C' functions" bit is irrelevant: C51 functions use no more stack than assembler functions, as they do not use the stack for parameters, locals, etc.