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
  • 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.

    Also, I have tried:
    BYTE process_Help(char *cmdBuffer) reentrant
    {
        char xdata strHelp[20] = "Help Message";
        cmdBuffer[0] = '\0';
        printf(strHelp);
        return TRUE;
    }
    

    Again this works fine on the debugger/simulator and at least I get something to print on the target hardware, but it is just garbage text (looks like uninitialized memory) instead of the message.

    Any/All help welcome and appreciated.

    Thanks,
    Chris Beattie

Reply
  • 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.

    Also, I have tried:
    BYTE process_Help(char *cmdBuffer) reentrant
    {
        char xdata strHelp[20] = "Help Message";
        cmdBuffer[0] = '\0';
        printf(strHelp);
        return TRUE;
    }
    

    Again this works fine on the debugger/simulator and at least I get something to print on the target hardware, but it is just garbage text (looks like uninitialized memory) instead of the message.

    Any/All help welcome and appreciated.

    Thanks,
    Chris Beattie

Children
More questions in this forum