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.

CC1310: CC1310 Driverlib problem (CPUDelay) GCC

Part Number: CC1310

Hi,

I have a project I'm working on using the GCC compiler.

And noticed the code was blocking on CPUDelay, a close inspection revealed that the inline assembly for GCC is wrong

void __attribute__((naked))
CPUdelay(uint32_t ui32Count)
{
    // Loop the specified number of times
    __asm volatile ("    subs    %0, #1\n"
                    "    bne     NOROM_CPUdelay\n"
                    "    bx      lr\n"
                    : /* No output */
                    : "r" (ui32Count)
                   );
}

I've fixed it by adding a label to the subs instruction and jumping to that, the rest of the implementations seem to have the label and jump to label.

void __attribute__((naked))
CPUdelay(uint32_t ui32Count)
{
    // Loop the specified number of times
    __asm volatile ("%=: subs    %0, #1\n"
                    "    bne     %=b\n"
                    "    bx      lr\n"
                    : /* No output */
                    : "r" (ui32Count)
                   );
}

I think the driverlib for CC1310 should be fixed in the next SDK