TI中文支持网
TI专业的中文技术问题搜集分享网站

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

 

Changed settings forces a full rebuild…Building configuration: 1 – DebugUpdating 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 51Warning[Pe223]: function "ROM_GPIOPinTypeGPIOOutput" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 55Warning[Pe223]: function "ROM_FPULazyStackingEnable" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 71Warning[Pe223]: function "ROM_SysCtlClockSet" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 73Warning[Pe223]: function "ROM_SysTickPeriodSet" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 75Warning[Pe223]: function "ROM_SysCtlClockGet" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 75Warning[Pe223]: function "ROM_SysTickIntEnable" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 76Warning[Pe223]: function "ROM_SysTickEnable" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 77Warning[Pe223]: function "ROM_IntMasterEnable" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 81Warning[Pe223]: function "ROM_GPIOPinWrite" declared implicitly D:\Documents\arm\test_project\proj_4\IAR source\main.c 96startup_ewarm.c LinkingError[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: 10Total 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);//同时熄灭
              */           }
}

 

 

Hancheng Zhao:

已自行解决,方法Options   /  C/C++Compiler preprocessor   /   Defined symbols  中输入

ewarm

PART_TM4C123GH6PM

TARGET_IS_TM4C123_RB1

UART_BUFFERED

确认即可

xyz549040622:

回复 Hancheng Zhao:

这个宏定义没有的话,好多外设是找不到的。换个芯片的话,定义也要改变的。

Hancheng Zhao:

回复 xyz549040622:

如果换芯片我要改哪些宏定义呢,能否用tiva系列的其他芯片帮我举个例子谢谢

xyz549040622:

回复 Hancheng Zhao:

TM4C123GH6PM ,根据你对应的芯片,修改这个就可以

Hancheng Zhao:

回复 xyz549040622:

TARGET_IS_TM4C123_RB1

里面的RB1又表示什么呢,因为看到头文件里面有if define *_RA1什么的。。。谢谢

xyz549040622:

回复 Hancheng Zhao:

这个应该是主管ROM之类的函数的吧,我具体看看再给你回复。

Hancheng Zhao:

回复 xyz549040622:

哦哦,原来是版本差异啊

赞(0)
未经允许不得转载:TI中文支持网 » 编译的时候报没有定义ROM_*这些函数,怎么解决??软件使用IAR
分享到: 更多 (0)