Proplem with Code Composer Studio v6 with GCC

texas instrumentsti-ccstudio

I have the following

Tiva C Board (TM4C123GXL)
Code Composer Studio v6 using GCC

Compiling this sample code:

/*
 * main.c
 */
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"

int main(void)
{
    uint8_t ui8LED = 2;
    SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
    while(1)
    {
        // Turn on the LED
        GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, ui8LED);
        // Delay for a bit
        SysCtlDelay(2000000);
        // Cycle through Red, Green and Blue LEDs
        if (ui8LED == 8) {ui8LED = 2;} else {ui8LED = ui8LED*2;}
    }
}

This sample code is provided within the TivaWare works fine with the TI compiler (following all the steps in the workshop pdf). When I choose to compile with GCC using, If I do not include the driverlib.lib file it says undefined reference to the functions used above. If I include it it says two errors on the four functions

error: C:/ti/TivaWare_C_Series-2.1.0.12573/driverlib/ccs/Debug/driverlib.lib(cpu.obj) uses VFP register arguments, Test.out does not

failed to merge target specific data of file C:/ti/TivaWare_C_Series-2.1.0.12573/driverlib/ccs/Debug/driverlib.lib(cpu.obj)

I think everything should be fine when using TI compiler but I want to try GCC.

Best Answer

The driverlib in your case is compiled using the Floating Point Unit (FPU), while the target project does not. Try adding -mfloat-abi=hard -mfpu=fpv4-sp-d16 flags or recompiling driverlib without hardware FPU. In any case the FPU settings should be identical when compiling the library and the project.
UPD: If these flags do not work, the calling convention could be different. So you can try -mfloat-abi=soft -mfpu=fpv4-sp-d16 or -mfloat-abi=softfp -mfpu=fpv4-sp-d16
UPD2: And yes, you might need to clean the project before recompiling.