This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430 Code Composer Essentials Pro v3 SP2 single stepping and large-data pointer problems

Other Parts Discussed in Thread: MSP430F5438

Software:

Windows Vista 32-bit
Code Composer Essentials Professional v3 with SP2 (slac135d.zip, 69095 KB)

Target:
Pre-production MSP430F5438

Problems:

1. Pointers in large-data model model.

Create a new managed make C/ASM project in Code Composer, selecting the XMS430F5438.  Silicon version set to mspx.  Use large-data memory model selected.  In TI build settings using rts430xl.lib.

The following code does not work:

unsigned char jbuf[20];
unsigned char *jptr = jbuf;

int main(void)
{
    *jptr = 0x55;
    jptr++;
    *jptr = 0x66;
}

If 'jptr' is added to the expression window it shows a value of 0, however the pointer value is actually correct in memory when viewed from the Memory window.  The code will write 0x55 to the correct location, but then fails to write 0x66 to the next memory address.

When the large-data memory option is disabled and rts430x.lib used, the code runs correctly and the expression window shows the correct pointer value.

2. Single stepping with interrupts enabled.

I have a project that mas interrupts enabled and when I attempt to single step I end up at the first instruction of an active interrupt vector (an interrupt on a GPIO).  The FET User's Guide said to try to use the Clock Control settings to delay interrupt requests, but it does not seem to work.  If I explicitly disable global interrupts from the Register window I can single step, but this is not a workable solution.

Jim

  • Here is the disassembly for the above program for a 4618 dev board in large data mode:

             main:
    0x03232:   002F       1114           MOVA    &jptr,R15
    0x03236:   40FF       0055 0000      MOV.B   #0x0055,0x0000(R15)
    0x0323c:   1800       53D2 1114      INCX.A  &jptr
    0x03242:   002F       1114           MOVA    &jptr,R15
    0x03246:   40FF       0066 0000      MOV.B   #0x0066,0x0000(R15)
    0x0324c:   430C                      CLR.W   R12
    0x0324e:   0110                      RETA

    This is the disassembly for the MSP 5438

             main:
    0x05d32:   002F       1C14           MOVA    &jptr,R15
    0x05d36:   40FF       0055 0000      MOV.B   #0x0055,0x0000(R15)
    0x05d3c:   1800       53D2 1C14      INCX.A  &jptr
    0x05d42:   002F       1C14           MOVA    &jptr,R15
    0x05d44:   1C14       40FF 0066 0000 MOVX.A  #0x80066,0x40000(R15)
    0x05d4c:   430C                      CLR.W   R12
    0x05d4e:   0110                      RETA

    Notice that the instruction for writing the 0x66 byte is different.  The MSP 4618 code works correctly and the MSP 5438 does not work.

    Jim

  • Thanks for the feedback. There does appear to be a bug in the display of pointers in large memory model. I will pass this on as a defect to the concerned CCE team.

    Regarding single stepping with interrupts enabled the behavior you are observing is the expected behavior and the workarounds are what you already mentioned, disabling global interrupts via register view or trying to delay interrupt requests using clock control. We are looking into potential options of adding a button or something similar to CCE to "disable interrupts while stepping" but currently no such option exists.

  • Thanks for the response.

    It is true that the display of pointers is broken.  However, more importantly, for the MSP5438 it seems that the compiler is not generating the correct assembly code!  Any ideas on this problem?

    It would be neat to have an option that would automatically save the state of the global interrupt flag, disable global interrupts, step, then restore the previous state when as part of stepping.

    Jim

  • Yes. we got lots of troubles when we try to manipulate the pointer in large data memory model for MSP430F5438 CPU.

    After we change to CCSv4, the same problem still there when large data memory model is selected.

    Following is the code we tested in CCSv4 (large data memory model enabled):

    #include <MSP430x54x.h>
    #include <in430.h>

    void main(void)
    {
        char *ptr;
       
        WDTCTL = WDTPW+WDTHOLD;            // Disable WDT
       
        /*
         * Following lines behave correctly.
         * The code won't jump into the if statement.
         */
        ptr = (char *)0x2E000;
        if(ptr >= ((char *)(0x2E600)))
        {
            ptr = (char *)0x22000;
        }
       
        /*
         * Following lines behave incorrectly.
         * The code will jump into the if statment, which shouldn't happen!
         */
        ptr = (char *)0x2E000;
        ptr++;
        if(ptr >= ((char *)(0x2E600)))
        {
            ptr = (char *)0x22000;
        }
       
        __no_operation();
    }

     

    It gave us some strange behaviors (the second if statement).

    I have no idea about how to fix this problem.

     

    Liu

     

**Attention** This is a public forum