2 Replies Latest reply on Oct 16, 2017 10:40 PM by ntan

    variables don't exist while debugging with PSoC creator 4.1

    sh3vr4r_2776331

      The debug mode does not show the variables.  I don't know if I did something wrong or there is like a bug that was present in Psoc 4.0.

      The variables are not present in the debug mode.

        • 1. Re: variables don't exist while debugging with PSoC creator 4.1
          anks

          Please download the PSoC Creator4.1 Update1 from this link-

          PSoC® Creator™ Integrated Design Environment (IDE)

          I am able to debug and see the "status" variable's value  in Creator 4.1 Update1

          • 2. Re: variables don't exist while debugging with PSoC creator 4.1
            ntan

            This is my assumption from your description without any complete error messages.  Please let me know if this is not different from your expectation.

             

            When I compiled the project, I found some error messages as follows.

            GS003311.png

            These warning messages said there are some variables which are set some value but never used in other program parts.  These NEVER USED variables are pruned from the program.  You can find in the LST files that the function accel_ReadReg() is called but its return value is not used as follows.

             

              30:main.c        ****        
              31:main.c        ****        XOUT_H = accel_ReadReg(MPU6050_ACCEL_XOUT_H);
              55              .loc 1 31 0 discriminator 1
              56 0014 3B20      movs r0, #59
              57 0016 FFF7FEFF bl accel_ReadReg
              58              .LVL3:
              32:main.c        ****        XOUT_L = accel_ReadReg(MPU6050_ACCEL_XOUT_L);
              59              .loc 1 32 0 discriminator 1
              60 001a 3C20      movs r0, #60
              61 001c FFF7FEFF bl accel_ReadReg
              62              .LVL4:
              33:main.c        ****        YOUT_H = accel_ReadReg(MPU6050_ACCEL_YOUT_H);
            

             

            You cannot see the variables because these variables are not assigned to a memory.  Yo can use a "Volatile" like

            volatile uint8 XOUT_H, XOUT_L, YOUT_H, YOUT_L, ZOUT_H, ZOUT_L; //variables to store the data
            

            to make these variable share a memory area as follows.

             

              30:main.c        ****        
              31:main.c        ****        XOUT_H = accel_ReadReg(MPU6050_ACCEL_XOUT_H);
              56              .loc 1 31 0 discriminator 1
              57 0016 3B20      movs r0, #59
              58 0018 FFF7FEFF bl accel_ReadReg
              59              .LVL3:
              60 001c 8DF80700 strb r0, [sp, #7]
              32:main.c        ****        XOUT_L = accel_ReadReg(MPU6050_ACCEL_XOUT_L);
              61              .loc 1 32 0 discriminator 1
              62 0020 3C20      movs r0, #60
              63 0022 FFF7FEFF bl accel_ReadReg
              64              .LVL4:
              65 0026 8DF80600 strb r0, [sp, #6]
            

             

            The instruction "strb" is used to store the return value into the local variable on the stack area.

             

            Regards,

            Noriaki