0

我正在使用 Cortex M3、Stellaris® LM3S6965 评估板。如果我按下一个按钮,我正在尝试打开一个 LED。但是在构建时它总是给我一个错误。

在程序中,我基本上检查按钮的状态,然后启用 LED。我是新手,我尝试搜索,但我真的找不到有用的东西。

非常感谢

我现在的程序

#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"

char rawInputActive(void);

int main(void)
{
    volatile unsigned long ulLoop;

    /* Enable all the GPIO ports that I use*/
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);

    /* Config the pins (input, output,..)*/
    GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_1);  // select
    GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, GPIO_PIN_0);  // up
    GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, GPIO_PIN_1);  // down
    GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, GPIO_PIN_2);  // left
    GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, GPIO_PIN_3);  // right

    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_0); // led
    GPIOPadConfigSet(GPIO_PORTF_BASE,GPIO_PIN_1,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPU);

    /* Enable the clock for the GPIO ports.*/
    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                       SYSCTL_XTAL_8MHZ);


    while(1)
    {
        volatile int iDelay;
        volatile int read;

        if(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_1) == 0){
            GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_PIN_0); // Led select
            //ret |= 1;
            for(iDelay = 0; iDelay < 3000; iDelay++);
            GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, ~GPIO_PIN_0);
            while(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_1) == 0){}
            for(iDelay = 0; iDelay < 3000; iDelay++);
        }

    }
}

我在构建时遇到的错误。

GCC HOME: C:\Program Files (x86)\GNU Tools ARM Embedded\4.6 2012q2\bin
    compile:
        [mkdir] Skipping C:\projects\new\PushButton\Debug\bin because it already exists.
        [mkdir] Skipping C:\projects\new\PushButton\Debug\obj because it already exists.
           [cc] Starting dependency analysis for 2 files.
           [cc] Parsing ..\..\cmsis\core_cm3.c
           [cc] Parsing ..\..\startup\startup_lm3s.c
           [cc] 2 files are up to date.
           [cc] 0 files to be recompiled from dependency analysis.
           [cc] 5 total files to be compiled.
           [cc] arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Wall -ffunction-sections -O0 -g -c -DLM3S6965 -IC:\projects\new\PushButton C:\projects\new\PushButton\main.c C:\projects\new\PushButton\lm3slib\driverlib\sysctl.c C:\projects\new\PushButton\lm3slib\driverlib\gpio.c C:\projects\new\PushButton\lm3slib\driverlib\interrupt.c C:\projects\new\PushButton\lm3slib\driverlib\cpu.c
           [cc] C:\projects\new\PushButton\main.c:21:26: fatal error: inc/hw_types.h: No such file or directory
           [cc] compilation terminated.
           [cc] C:\projects\new\PushButton\lm3slib\driverlib\sysctl.c:32:25: fatal error: inc/hw_ints.h: No such file or directory
           [cc] compilation terminated.
           [cc] C:\projects\new\PushButton\lm3slib\driverlib\gpio.c:32:25: fatal error: inc/hw_gpio.h: No such file or directory
           [cc] compilation terminated.
           [cc] C:\projects\new\PushButton\lm3slib\driverlib\interrupt.c:32:25: fatal error: inc/hw_ints.h: No such file or directory
           [cc] compilation terminated.
           [cc] C:\projects\new\PushButton\lm3slib\driverlib\cpu.c:26:27: fatal error: driverlib/cpu.h: No such file or directory
           [cc] compilation terminated.

    BUILD FAILED
    Total time: 0 seconds
4

1 回答 1

1

您需要添加-I lm3slib到您的编译器标志。这告诉编译器查看该目录,该目录似乎是文件所在的位置。

于 2012-12-29T12:28:27.797 回答