# Proplem with Code Composer Studio v6 with GCC

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.

• BTW (in addition to my answer), which build of GCC are you using? When I was setting up my environment for the very same chip, I've found that not every build claiming to support Cortex-M4 would support Cortex-M4F. – Eugene Sh. Dec 15 '14 at 17:18

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.

• I added your flags to the compiler but still the error persists. – 3bdalla Dec 15 '14 at 17:38
• Look at the update – Eugene Sh. Dec 15 '14 at 17:42
• But for my opinion the best thing you can do is to recompile the driverlib with the needed settings. – Eugene Sh. Dec 15 '14 at 17:43
• The problem still exists after all your steps. Here is the flags the gcc is using: -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -mfpu=fpv4-sp-d16 -DPART_TM4C123GH6PM -I"c:/ti/ccsv6/tools/compiler/gcc-arm-none-eabi-4_7-2013q3/arm-none-eabi/include" -I"C:/ti/TivaWare_C_Series-2.1.0.12573/" -ffunction-sections -fdata-sections -g -gstrict-dwarf -Wall I tried all your suggested flags and still gives an error – 3bdalla Dec 15 '14 at 20:11
• Now that's weird. It is clearly the error with fpu instructions calling convention, so either of these flags should help. Have you cleaned the project between the recompilations? Make sure that object files are deleted. – Eugene Sh. Dec 15 '14 at 20:20

The driverlib folder contains the pre built driverlib library for both the CCS compiler and the GCC, the problem I was importing the CCS version of the library.

In the directory C:\ti\TivaWare_C_Series-2.1.0.12573 [Assuming you installed it to the C] go to driverlib/gcc, you will find the library for the gcc compiler.