This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

编译的时候报没有定义ROM_*这些函数,怎么解决??软件使用IAR

Other Parts Discussed in Thread: TM4C123GH6PM

 

Changed settings forces a full rebuild...
Building configuration: 1 - Debug
Updating build tree...
 
5  file(s) deleted.
Updating build tree...
main.c 
Warning[Pe223]: function "ROM_SysCtlPeripheralEnable" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 51
Warning[Pe223]: function "ROM_GPIOPinTypeGPIOOutput" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 55
Warning[Pe223]: function "ROM_FPULazyStackingEnable" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 71
Warning[Pe223]: function "ROM_SysCtlClockSet" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 73
Warning[Pe223]: function "ROM_SysTickPeriodSet" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 75
Warning[Pe223]: function "ROM_SysCtlClockGet" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 75
Warning[Pe223]: function "ROM_SysTickIntEnable" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 76
Warning[Pe223]: function "ROM_SysTickEnable" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 77
Warning[Pe223]: function "ROM_IntMasterEnable" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 81
Warning[Pe223]: function "ROM_GPIOPinWrite" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 96
startup_ewarm.c 
Linking
Error[Li005]: no definition for "ROM_FPULazyStackingEnable" [referenced from D:\Documents\arm\test_project\proj_4\IAR source\Debug\Obj\main.o]
Error[Li005]: no definition for "ROM_SysCtlClockSet" [referenced from D:\Documents\arm\test_project\proj_4\IAR source\Debug\Obj\main.o]
Error[Li005]: no definition for "ROM_SysCtlClockGet" [referenced from D:\Documents\arm\test_project\proj_4\IAR source\Debug\Obj\main.o]
Error[Li005]: no definition for "ROM_SysTickPeriodSet" [referenced from D:\Documents\arm\test_project\proj_4\IAR source\Debug\Obj\main.o]
Error[Li005]: no definition for "ROM_SysTickIntEnable" [referenced from D:\Documents\arm\test_project\proj_4\IAR source\Debug\Obj\main.o]
Error[Li005]: no definition for "ROM_SysTickEnable" [referenced from D:\Documents\arm\test_project\proj_4\IAR source\Debug\Obj\main.o]
Error[Li005]: no definition for "ROM_IntMasterEnable" [referenced from D:\Documents\arm\test_project\proj_4\IAR source\Debug\Obj\main.o]
Error[Li005]: no definition for "ROM_GPIOPinWrite" [referenced from D:\Documents\arm\test_project\proj_4\IAR source\Debug\Obj\main.o]
Error[Li005]: no definition for "ROM_SysCtlPeripheralEnable" [referenced from D:\Documents\arm\test_project\proj_4\IAR source\Debug\Obj\main.o]
Error[Li005]: no definition for "ROM_GPIOPinTypeGPIOOutput" [referenced from D:\Documents\arm\test_project\proj_4\IAR source\Debug\Obj\main.o]
Error while running Linker
 
Total number of errors: 10
Total number of warnings: 10


#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_gpio.h"
#include "inc/hw_sysctl.h"
#include "driverlib/debug.h"
#include "driverlib/fpu.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/interrupt.h"
#include "driverlib/sysctl.h"
#include "driverlib/systick.h"
#include "driverlib/timer.h"
#include "driverlib/rom.h"      //各类头文件,复制粘贴即可


#define SYSTICK_PERIOD_MS    1000               //宏定义了一个用来初始化systick计时为1ms的常量


volatile uint32_t g_ui32SysTickCount = 0;       //systick产生中断次数
volatile uint32_t delaycount_ms = 0;            //延迟毫秒数目


/*延迟函数*/
void delay_ms(unsigned int ms)
{
       delaycount_ms = ms;
      
       while(delaycount_ms>0);  //不够所需毫秒数就一直等待
}


/*systick中断服务程序,配合延迟*/
void SysTickIntHandler(void)    //由systick初始化,每1ms进入一次
{
         g_ui32SysTickCount++;  //这条语句并无实际意义可删除
        
         if(delaycount_ms)      //够不够时间?不够继续时间,够了等待下一次delaycout_ms赋值
           delaycount_ms--;
}


/*led初始化函数,使能了GPIO,确定了输出口*/
void ledInit(void)
{
       ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);         //允许系统控制对应GPIO没有该语句会导致ARM“死机“
       ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
       ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
      
       ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2|GPIO_PIN_4);       //输出位设定
       ROM_GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_7);
       ROM_GPIOPinTypeGPIOOutput(GPIO_PORTC_BASE, GPIO_PIN_7);
      
       /*
       ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);
       ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_PIN_4);
       ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_7, GPIO_PIN_7);
       ROM_GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_7, GPIO_PIN_7);
       */
}


/*实验led顺序点亮,顺序熄灭的主函数*/
int main(void)
{
       ROM_FPULazyStackingEnable();             //打开浮点运算减少CPU开销,程序简单的时候不打开也无影响,但FPU是Tiva一个强大的内部资源,最好打开
      
       ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);              //时钟设置,该程序不设置时钟也无影响
      
       ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICK_PERIOD_MS);          //系统滴答时钟,设定位每1ms一次中断
       ROM_SysTickIntEnable();  //定时计数器减至零产生中断
       ROM_SysTickEnable();     //滴答定时器使能
      
       ledInit();    //初始化LED
      
       ROM_IntMasterEnable();   //开全局中断
           
       while(1)
       {
              /*
              ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_4, 0);
              delay_ms(500);
              ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0);
              delay_ms(500);
              ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_7, 0);
              delay_ms(500);
              ROM_GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_7, 0);
              delay_ms(500); //分别点亮4个LED灯//
              */
           
              ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_4, 0);
              delay_ms(500);
              ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0);
              delay_ms(500);
              ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_7, 0);
              delay_ms(500);
              ROM_GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_7, 0);
              delay_ms(500); //依次点亮4个LED灯
              ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_4, 1<<4);
              delay_ms(500);
              ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 1<<2);
              delay_ms(500);
              ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_7, 0xff);
              delay_ms(500);
              ROM_GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_7, 1<<7);
              delay_ms(500); //依次熄灭4个LED灯
             
              /*
              ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);
              ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_PIN_4);
              ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_7, GPIO_PIN_7);
              ROM_GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_7, GPIO_PIN_7);
              delay_ms(500);//熄灭
              ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0);
              ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_4, 0);
              ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_7, 0);
              ROM_GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_7, 0);
              delay_ms(500);//同时点亮
              ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);
              ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_PIN_4);
              ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_7, GPIO_PIN_7);
              ROM_GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_7, GPIO_PIN_7);
              delay_ms(1000);//同时熄灭
              */    
       }
}