Setting up Tivaware with GCC under CCS6
For a upcoming project I have designed in a TI TM4C123GH6PM, which is part of the Tiva lineup of ARM core processors.
Naturally i would prefer to develop with the GCC compiler toolchain rather than the TI compiler, so this is a rough guide with notes for how i converted the given USB Device example code to use the GCC compiler instead.
Compiler settings
- First, as normal, import the example project into CCS and build and test to ensure it works on the TI compiler first.
- Right click on the project and goto project settings
- Click on the General tab, and make sure that your chosen device is chosen.
- Change the Compiler version to the newest GNU compiler
- Click OK, and CCS will prompt you to create a new Debug__GNU configuration automatically, choose OK to continue.
- Now open the projects properties again and move to the (Build->GNU Compiler->Runtime)
- The defaults are all correct here except for the floating point version used, where the default libraries were compiled for soft floating point. Thus you need to change the floating point option (-mfloat-abi) to softfp
- Next move down to the settings, setting these as shown (All of these settings can also be copied from the TI compiler settings by changing the configuration option at the top and just going back and forth)
Moving the interrupt table over
Now, when we created the new configuration for the GNU compilers, CCS created a new file called tm4c123gh6pm_startup_ccs_gcc.c. This is the new startup .c file that is being used for the GNU configuration. We now need to move over our interrupt table and also add the extern definitions for the interrupt functions.
Adding the following extern lines to the begining
extern void SysTickIntHandler(void);
extern void USBUARTIntHandler(void);
extern void USB0DeviceIntHandler(void);
And updating the interrupt table by copy-pasting its contents from the old initalization c file.
Fixing the FaultISR
When you launch your debug session you will find that the device comes up stuck in the fault ISR and not halted at main. According to the TI wiki this is beacuase of intended changes in Linaro GCC 4.8.4.
You can rectify this by : Specify the entry point under -e option for the linker (under Project Properties->Build->GNU Linker->Basic). This can be set to _start or ResetISR