7 Replies Latest reply on Aug 15, 2013 10:51 PM by ki.leung

    Disassembly View Shows incorrect source

    abhijit.kshirsagar

      Hi

         

      I created a small function, defined in main.c as shown below:

         
      int somefunc(int par1, int par2, int par3, int par4, int par5, int par6) { par1 = par1+par2; par1++; par3 = par1+par3; par3--; par5 = par5+par6+par3; par3 = par5; return (par3+par4); }
         

      In main, I call this function with parameters shown below:

         
      x = somefunc(16, 32, 64, 128, 256, 512);
         

       

         

      However, in the disassembly view i see,

         
      63:     x = somefunc(16, 32, 64, 128, 256, 512); 0x00000208 mov.w    r3, #100    ; 0x100  171: } 172: else 173: { 174: /* IMO doubler disabled */ 175: cyPmBackup.imo2x = CY_PM_DISABLED; 0x0000020C str    r3, [sp, #0] 0x0000020E mov.w    r3, #200    ; 0x200 0x00000212 str    r3, [sp, #4]  435: { 436: /* The IMO is ready to be source for Master clock */ 437: if(CY_PM_CLKDIST_MSTR0_REG != cyPmBackup.clkSyncDiv) 0x00000214 mov.w    r0, #10 0x00000218 mov.w    r1, #20 0x0000021C mov.w    r2, #40    ; 0x40 0x00000220 mov.w    r3, #80    ; 0x80 0x00000224 bl    14c <somefunc> 0x00000228 mov    r3, r0 0x0000022A str    r3, [r7, #c] ...   Clearly there is something wrong here - why are the lines 171 - 175 and lines 435 - 437 showing up? They have something to do with the internal oscillator (IMO) iirc. The assembly code, btw, is doing the correct things... The device is a PSoC 5, software is PSoC Creator V1 (Production). This is just one example - there may be others that I have not seen.
         

      Any ideas anyone?

         

      ~Abhijit

        • 1. Re: Disassembly View Shows incorrect source
          abhijit.kshirsagar

          Re - posting for better readability...

             

                        

             

          Hi

             

          I created a small function, defined in main.c as shown below:

             
          int somefunc(int par1, int par2, int par3, int par4, int par5, int par6) 
             
          { 
             
          par1 = par1+par2; 
             
          par1++; par3 = par1+par3; 
             
          par3--; par5 = par5+par6+par3; 
             
          par3 = par5; 
             
          return (par3+par4); 
             
          }
             

          In main, I call this function with parameters shown below:

             
          x = somefunc(16, 32, 64, 128, 256, 512);
             

           

             

          However, in the disassembly view i see,

             
          63:     x = somefunc(16, 32, 64, 128, 256, 512); 
             
          0x00000208 mov.w    r3, #100    ; 0x100  
             
          171:     }  
             
          172:     else  
             
          173:     {  
             
          174:         /* IMO doubler disabled */  
             
          175:         cyPmBackup.imo2x = CY_PM_DISABLED; 
             
          0x0000020C str    r3, [sp, #0] 
             
          0x0000020E mov.w    r3, #200    ; 
             
          0x200 0x00000212 str    r3, [sp, #4]  
             
          435:     {  
             
          436:         /* The IMO is ready to be source for Master clock */  
             
          437:         if(CY_PM_CLKDIST_MSTR0_REG != cyPmBackup.clkSyncDiv) 0x00000214 mov.w    r0, #10 
             
          0x00000218 mov.w    r1, #20 
             
          0x0000021C mov.w    r2, #40    ; 0x40 
             
          0x00000220 mov.w    r3, #80    ; 0x80 
             
          0x00000224 bl    14c <somefunc> 
             
          0x00000228 mov    r3, r0 0x0000022A 
             
          str    r3, [r7, #c] ...   
             
           
             
               Clearly there is something wrong here - why are the lines 171 - 175 and lines 435 - 437 showing up?
          They have something to do with the internal oscillator (IMO) iirc.
          The assembly code, btw, is doing the correct things...
          The device is a PSoC 5, software is PSoC Creator V1 (Production).
          This is just one example - there may be others that I have not seen.   
             
              Any ideas anyone?   
             

           

             

          Also, I have verified this by starting up the debugger and single stepping through the assembly - the screenshot is attached. The instructions at 0x218 to 0x220 save the parameters to be passed to the function and the line at 0x224 is the actual branch...

             

          Hope that clarifies the problem...

             

          Thanks,

             

          ~Abhijit

          • 2. Re: Disassembly View Shows incorrect source
            abhijit.kshirsagar

            *bump*

               

            Anyone?

               

            ~Abhijit

            • 3. Re: Disassembly View Shows incorrect source
              user_1377889

              Do not be hasty....

                 

               

                 

              Bob

              • 4. Re: Disassembly View Shows incorrect source
                user_1377889

                I just copied your pgm and had a look at main.lst. Here everything looks quite O.K.

                   

                Did you already try (sorry to ask) a re-boot and a re-build?

                   

                Bob

                • 5. Re: Disassembly View Shows incorrect source
                  anguel.stankov

                  I confirm that the disassembly window shows the incorrect source.

                  • 6. Re: Disassembly View Shows incorrect source
                    norman.chahuares.collantes

                     I've seen that before while debugging seems like the wrong code is displayed

                    • 7. Re: Disassembly View Shows incorrect source
                      ki.leung
                              yew, the creator debugger has some issues. Already raise a case and they are working on that. But the code itself seems to work correctly. just the debugger has issues.