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.

TMS320F28069: Linker crash with message, register allocation failed, when certain code structure is used

Part Number: TMS320F28069

Im getting a register allocation failed error pointing to this type of code:

/***************************************************
 * checks if two angles(sectors) are adjacent
 **************************************************/
    inline bool_t isSectorAdjacent(uint16_t new_angle)
    {
        int16_t angle_diff = abs(new_angle - rotpos.angle);

        return angle_diff <= 60 or (new_angle == 330 and rotpos.angle == 30);
    }

/*****************************************
 * get current sector with offset
 ****************************************/
    int16_t getSector(void)
    {
        int16_t sector;

        if(config.adv_sector_fetching)
        {
            uint16_t GetCurrentHallAngle(void);
            float fastNormDeg(float);

            uint16_t current_sector = GetCurrentHallAngle();
            bool_t is_sector_adj = isSectorAdjacent(current_sector);

            if(is_sector_adj) sector = (int16_t)current_sector;
            else sector = (int16_t)rotpos.angle;        // if adjacency check fails just return normal version
        }
        else sector = (int16_t)rotpos.angle;

        sector += (rotpos.dir == REVERSE ? config.bwdsectoroffset : config.fwdsectoroffset);

        return fastNormDeg(sector);
    }

Disclaimer: this snipped is by no means efficient it was just part of a little trial and error phase where i tried to fix an issue.

Kind Regard Tobias F.