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

More Pointer Problems

Here's another good one. Again, works fine on simulator/debugger, but not on the target hardware.

If I do this:

BYTE process_Help(char *cmdBuffer) reentrant
{
cmdBuffer[0] = '\0';
printf( "Help Message");
return TRUE;
}

everything works fine. But if I do this:

BYTE process_Help(char *cmdBuffer) reentrant
{
char *strHelp = "Help Message";
cmdBuffer[0] = '\0';
printf(strHelp);
return TRUE;
}

it works fine on the simulator/debugger, but nothing is displayed when executed on the target hardware.

Any/All help welcome and appreciated.

Thanks,
Chris Beattie

Parents
  • Since you are using small reentrant model, the reentrant stack shares its space with the call stack.

    Unfortunatly the compiler does not show stack space required for each invocation of a reentrant funtion.

    Looking at the disassembly, this particular function requires 3 bytes. Since the function is reentrant I am assuming you are calling it concurrently at least twice. So minimally you need 6 extra bytes in your stack, more if your concurrency count is higher. So one question is did you leave enough stack space so that the call stack and reeentrant stack do not overlap?

    Of course this example does not need to be reentrant. I am assuming your real function somehow calls itself.

    By the way, which micro are you using?

Reply
  • Since you are using small reentrant model, the reentrant stack shares its space with the call stack.

    Unfortunatly the compiler does not show stack space required for each invocation of a reentrant funtion.

    Looking at the disassembly, this particular function requires 3 bytes. Since the function is reentrant I am assuming you are calling it concurrently at least twice. So minimally you need 6 extra bytes in your stack, more if your concurrency count is higher. So one question is did you leave enough stack space so that the call stack and reeentrant stack do not overlap?

    Of course this example does not need to be reentrant. I am assuming your real function somehow calls itself.

    By the way, which micro are you using?

Children