I'm having trouble getting a simple blinky project working using the on-board LED's on the TIVA TM4C123G evaluation board. I am using the header files from the driver libraries so I don't have to write directly to the registers as much anymore. However my problem is that I am getting a compilation error saying (cannot open source input file "header file names here": No such file or directory). I am unsure what I am doing wrong. Is how I have saved the header files and included them correct? What is causing this error message?
By the way if I comment out the first include directive, I get the same error messages for the header files hw_memmap and gpio. I have copy and pasted the header files from the driver library folder into the folder for this project called Code1.
Below is my C file containing the main program:
#include "inc/tm4c123gh6pm.h"
#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_memmap.h"
#include "inc/gpio.h"
#define RED_LED GPIO_PIN_1
#define BLUE_LED GPIO_PIN_2
#define GREEN_LED GPIO_PIN_3
// The error routine that is called if the driver library encounters an error.
#ifdef DEBUG
void
__error__(char *pcFilename, uint32_t ui32Line)
{
}
#endif
int main(void)
{
// Setup the system clock to run at 50 Mhz from PLL with crystal reference
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
// Unlock the Port F register.
GPIO_PORTF_LOCK_R = 0x4C4F434B;
// Enable the Port F commit register.
GPIO_PORTF_CR_R = 0xFF;
// Enable and configure the GPIO port for the LED operation.
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED);
// Loop Forever
while(1)
{
// Turn on the LED
GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED, RED_LED);
// Delay for a bit
SysCtlDelay(2000000);
// Turn on the LED
GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED, BLUE_LED);
// Delay for a bit
SysCtlDelay(2000000);
}
}
Below is a screenshot of my Keil project showing the error message for the header file and all my include files inside my C source file that contains the program:
Also here is a screenshot of the header files being saved in the same location as the C source file that includes them:
EDIT
Peter Smith's comment solved my issue. I had the file name typed in wrong in the program so it was searching in the wrong directory for the header files.
However that issue is fixed, but when I tried compiling once again I got these 5 error messages as seen in the screenshot below. I am confused as all these functions are defined in their header files. Also this time I created a new project to see if it made a difference, hence the project name changed from Code1 to Testing. But they are virtually identical.
inc
below your working directory (which does not exist); remove theinc/
and retry it. \$\endgroup\$