我从qs-rgb复制了
void
ConfigureUART(void)
{
//
// Enable the GPIO Peripheral used by the UART.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
//
// Enable UART0
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
//
// Configure GPIO Pins for UART mode.
//
ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
//
// Use the internal 16MHz oscillator as the UART clock source.
//
UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);
//
// Initialize the UART for console I/O.
//
UARTStdioConfig(0, 115200, 16000000);
}
build 后出现这样的错误,
"../test1.c", line 40: warning #225-D: function "ROM_SysCtlPeripheralEnable" declared implicitly "../test1.c", line 50: warning #225-D: function "ROM_GPIOPinConfigure" declared implicitly "../test1.c", line 50: error #20: identifier "GPIO_PA0_U0RX" is undefined "../test1.c", line 51: error #20: identifier "GPIO_PA1_U0TX" is undefined "../test1.c", line 52: warning #225-D: function "ROM_GPIOPinTypeUART" declared implicitly
我把上面的代码改成了下面的,上面的错误没了
void
ConfigureUART(void)
{
//
// Enable the GPIO Peripheral used by the UART.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
//
// Enable UART0
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
//
// Configure GPIO Pins for UART mode.
//
GPIOPinConfigure(0x00000001);
GPIOPinConfigure(0x00000401);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
//
// Use the internal 16MHz oscillator as the UART clock source.
//
UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);
//
// Initialize the UART for console I/O.
//
UARTStdioConfig(0, 115200, 16000000);
}
不过出现了这样的问题:
warning #10210-D: creating ".stack" section with default size of 0x800; use the -stack option to change the default size
>> Compilation failure
undefined first referenced
symbol in file
--------- ----------------
UARTStdioConfig ./test1.obj
UARTprintf ./test1.obj
error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "test1.out" not built
gmake: *** [test1.out] Error 1
gmake: Target `all' not remade because of errors.
这是include部分
#include <stdint.h>
#include <stdbool.h>
#include "inc/tm4c123gh6pm.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/debug.h"
#include "driverlib/fpu.h"
#include "driverlib/gpio.h"
#include "driverlib/timer.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "utils/uartstdio.h"
请问怎么解决,然后rom.h这个头文件用来干嘛的?