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.

Compiler/PRU-CGT: variable length array feature of compiler not working right

Part Number: PRU-CGT

Tool/software: TI C/C++ Compiler

Hello,

I wanted to use the variable length array feature that is supported by PRU compiler(as stated in section 5.14 of SPRUHV7C). However, when I try using it, the execution hangs.

For example, I am calling the below function from main. On debugging, the execution hangs infinitely. Any clarification is appreciated.

uint32_t compute_factorial(uint8_t number)
{
    volatile uint8_t num[number];
    uint8_t i;
    uint32_t factorial = 1;

    for (i = 0; i < number; i++)
    {
        num[i] = i + 1;
    }

    for (i = 0; i < number; i++)
    {
        factorial *= num[i];
    }

    return factorial;
}

regards

Brayan