主题中讨论的其他器件:TM4C123GH6PM
工具/软件:Linux
你(们)好
我正在尝试使 Tiva Launchpad 上的 LED 闪烁。
这是我闪烁 LED 的源代码
1 #include
2 #include
3.
4 #include "inc/hw_types.h"
5 #include "inc/hw_gpio.h"
6 #include "inc/hw_memmap.h"
7 #include "inc/hw_sysctl.h"
8 #include "driverlib/gpio.h"
9 #include "driverlib/rom.h"
10 #include "driverlib/sysctl.h"
11 #include "driverlib/pin_map.h"
12 #include "driverlib/CAN.h"
13.
14 #define LED_RED GPIO_PIN_1
15 #define LED_BLUE GPIO_PIN_2
16 #define LED_GREEN GPIO_PIN_3
17 #define SW2 GPIO_PIN_0
18 #define SW1 GPIO_PIN_4
19.
20 int main()
21{
22 ROM_SysCtlClockSet (SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHz|SYSCTL_OSC_MAIN);
23 ROM_SysCtlPeripheralEnable (SYSCTL_Periph_GPIOF);
24 ROM_GPIOPinTypeGPIOOutput (GPIO_PORTF_BASE、LED_RELED_LED_BLE|LED_GREEN);
25 ROM_GPIOPinTypeGPIOInput (GPIO_PORTF_BASE、SW2);
26
27适用于(;;){
28.
29 IF (GPIOPinRead (GPIO_PORTF_BASE、SW2)){
30 GPIOPinWrite (GPIO_PORTF_BASE、LED_GREEN、LED_GREEN);
31}否则{
32 GPIOPinWrite (GPIO_PORTF_BASE、LED_GREEN、0);
33}
34}
35}
36.
当我使用 make 编译上述代码时、遇到以下错误
Sudha@VCHN172:~/tmc4123/Embedded/led-project$ make
arm-none-eabi-gcc -o build/main.o src/main.c -g -mthumb -mcpu=cortex-M4 -mfp=fpv4-sp-D16 -mfloat-abi=softfp -os -ffunion-sections -fdata-sections -md -std=c99 -Wall -sudpv4-spi_t/dptift/tintratic -dtranit_g3 -dtranit_t/tandtatic -dtranime4pet/tat_gtranit_gm/tdtranime4pet
arm-no-eabi-ld -o build/a.out build/main.o build/startup_gcc.o -T TM4C123GH6PM.ld --entry ResetISR --gc 段
build/main.o:在函数`main'中:
/home/sudha/tmc4123/Embedded/led-project/src/main.c:29:对`GPIOPinRead'的引用未定义
/home/sudha/tmc4123/Embedded/led-project/src/main.c:32:对`GPIOPinWrite'的引用未定义
Makefile:57:目标'build/a.out'的配方失败
制造:***[build/a.out]错误1.
但是、当我使用 ROM_GPIOPinWrite 或 ROM_GPIOPinRead 时、代码会成功编译。
请帮助我使用 GPIOPinWrite/GPIOPinRead 时出现了什么问题、以及如何解决该问题。