7 Replies Latest reply on Apr 13, 2015 9:13 AM by user_1377889

    PSoCCreator 3.0 vs 3.1 uint64 issues

    victor.sverzuti

      Just installed PSoC Creator 3.1 and i found some issues when handling the unsigned long long (uint64) type.

         

       

         

      So i did a little function Test64() and compilled and download to the target board in both versions, then i got the results with the JTAG debugger (Miniprog 3).

         

       

         

      Can be seen that a simple assignment with unsigned is very different and i risk saying that the behavior of PSoC Creator 3.1 is erroneous.

         

       

         

      Anyone has a clue about that ?

         

       

         

      // ARM GCC 4.7.3 (PSoC Creator 3.0 SP2)
      void Test64() {
          unsigned long long w64;
          unsigned int w;
          unsigned a = sizeof(w64);    // 8 bytes
          unsigned b = sizeof(w);        // 4 bytes
          
          w64 = 5;                    // 0x0000000000000005
          w64 = 0x0FFFFFFF;                // 0x000000000FFFFFFF
          w64 = 0xEFFFFFFF;                // 0x00000000EFFFFFFF
          w64 = 0xFFFFFFFF;                // 0x00000000FFFFFFFF
          w64 = (uint64_t)0xFFFFFFFF;            // 0x00000000FFFFFFFF     
          w64 = (uint64_t)0xFFFFFFFFu;        // 0x00000000FFFFFFFF
          w64 = (uint64_t)0xFFFFFFFFull;            // 0x00000000FFFFFFFF
          w64 = (uint64_t)((unsigned int)0xFFFFFFFFu);    // 0x00000000FFFFFFFF
          w64 = (uint64_t)((unsigned long long)0xFFFFFFFFu);  // 0x00000000FFFFFFFF 
          w = 0xFFFFFFFFu;                    // 0xFFFFFFFF
          w64 = (unsigned long long)w;            // 0x00000000FFFFFFFF
               
          w = 10;             
          w64 = (1u << w);        // 0x0000000000000400
          w = 40;
          w64 = (unsigned long long)((unsigned long long)1ull << w);    // 0x0000010000000000
          
      }

       
      // ARM GCC 4.8.4 (PSoC Creator 3.1)
      void Test64() {
          unsigned long long w64;
          unsigned int w;
          unsigned a = sizeof(w64);    // 8 bytes
          unsigned b = sizeof(w);        // 4 bytes
          
          w64 = 5;                // 0x0000000000000005
          w64 = 0x0FFFFFFF;            // 0x000000000FFFFFFF
          w64 = 0xEFFFFFFF;            // 0xFFFFFFFFEFFFFFFF   What ??
          w64 = 0xFFFFFFFF;            // 0xFFFFFFFFFFFFFFFF
          w64 = (uint64_t)0xFFFFFFFF;        // 0xFFFFFFFFFFFFFFFF   didnt work
          w64 = (uint64_t)0xFFFFFFFFu;    // 0xFFFFFFFFFFFFFFFF    didnt work
          w64 = (uint64_t)0xFFFFFFFFull;        // 0xFFFFFFFFFFFFFFFF    didnt work
          w64 = (uint64_t)((unsigned int)0xFFFFFFFFu);    // 0xFFFFFFFFFFFFFFFF   damn, didint work
          w64 = (uint64_t)((unsigned long long)0xFFFFFFFFu);  // 0xFFFFFFFFFFFFFFFF    dont know what to try
          w = 0xFFFFFFFFu;            // 0xFFFFFFFF
          w64 = (unsigned long long)w;    // 0xFFFFFFFFFFFFFFFF
          
          w = 10;
          w64 = (1u << w);                        // 0x0000000000000400
          w = 40;
          w64 = (unsigned long long)((unsigned long long)1ull << w);    // 0x0000000000000000
          
      }