找回密码
 注册
关于网站域名变更的通知

LPC2132学习中遇到的常见问题

2024-4-1 14:51| 查看: 69| 评论: 0

摘要: 自己写了一个头文件LCD.H,在其中定义了如下的全局变量:const int8 NoCheckBusy = 0; const int8 CheckBusy = 1; const int32 LCD_RS = 14; const int32 LCD_RW = 15; const int32 LCD_EN = 16; const int32 ...
自己写了一个头文件LCD.H,在其中定义了如下的全局变量:const int8 NoCheckBusy = 0;
const int8 CheckBusy = 1;

const int32 LCD_RS = 1<<4;
const int32 LCD_RW = 1<<5;
const int32 LCD_EN = 1<<6;
const int32 LCD_DATA = 0xff<<7;

在c文件lcd.c和main.c中都要用到,但是在编译的时候出现如下的问题:
Error: L6200E: Symbol NoCheckBusy multiply defined (by main.o and lcd.o).
Error: L6200E: Symbol LCD_RS multiply defined (by main.o and lcd.o).

上网站ARM.com/help/index.jsp?topic=/com.arm.doc.dui0435a/index.html" target="_blank">/zixunimg/eepwimg/infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0435a/index.html上去查找,有如下结果:

L6200E:Symbol multiply defined (by and ).
There are two common examples where this occurs:
1)Symbol __semihosting_swi_guard multiply defined (by use_semi.o and use_no_semi.o).
This error is reported when functions that use semihosting SWIs are linked in from the C library, in the presence of the__use_no_semihosting_swiguard. See the ADS 1.2 Compilers and Libraries Guide, section 4.2.2, "Building an application for a nonsemihosted environment" and ADS 1.2 Developer Guide, Section 6.10.1, "Linker error __semihosting_swi_guard".
To resolve this, you must provide your own implementations of these C library functions.
The ADS 1.2 Examplesembedded directory contains examples of how to re-implement some of the more common SWI-using functions - see the fileretarget.c.
To identify which SWI-using functions are being linked-in from the C libraries:
1. Link with armlink -verbose -errors err.txt
2. Search err.txt for occurrences of __I_use_semihosting_swi
For example:
:
Loading member sys_exit.o from c_a__un.l.
reference : __I_use_semihosting_swi
definition: _sys_exit
:
This shows that the SWI-using function _sys_exit is being linked-in from the C library. To prevent this, you will need to provide your own implementation of this function.
2)Symbol __stdout multiply defined (by retarget.o and stdio.o).
This means that there are two conflicting definitions of__stdoutpresent – one inretarget.o, the other instdio.o. The one inretarget.ois your own definition. The one instdio.ois the default implementation, which was probably linked-in inadvertently.
stdio.ocontains a number symbol definitions and implementations of file functions likefopen,fclose,fflush, etc.stdio.ois being linked-in because it satisfies some unresolved references.
To identify why stdio.o is being linked-in, you must link with the linkers "verbose" switch, e.g.:
armlink [... your normal options...] -verbose -errors err.txt
Then studyerr.txt, so see exactly what the linker is linking-in, from where, and why.
To move forward, the user may have to either:
- Eliminate the calls likefopen,fclose,fflush, etc, or
- Re-implement the_sys_xxxxfamily of functions.
See the ADS 1.2 Compilers and Libraries Guide, section 4.10, "Tailoring the input/output functions".
具体是什么意思看的也不是很懂,后来看了别人的解决方法是:在头文件中仅声明变量,而把变量的定义都放到c文件中去,问题就解决了。
即把

const int8 NoCheckBusy = 0;
const int8 CheckBusy = 1;

const int32 LCD_RS = 1<<4;
const int32 LCD_RW = 1<<5;
const int32 LCD_EN = 1<<6;
const int32 LCD_DATA = 0xff<<7;

都放到lcd.c中就可避免该问题,时间不多,具体原因还有待研究。


在使用ADS1.2编译程序的过程中,我们有函数如下定义:void PutStr(uint8 x, uint8 y, uint8* str);
我们在主函数中有这样的用法:
PutStr(0, 0, "Hello world!");
经编译后,有如下错误:
Error: C3028E implicit cast of pointer to non-equal pointer

解决方法如下:
PutStr(0, 0, (uint8*)"Hello world!");
即将我们的字符串强制转换为我们在函数中所定义的形式。

PS:
C3028E: implicit cast of pointer to non-equal pointer
C3029E: implicit cast of non-0 int to pointer
C3030E: implicit cast of pointer to int
C3031E: implicit cast of to int
Try re-writing the code to avoid the implicit cast, e.g. add an explicit cast.
These errors can be suppressed with "-Ec".







本站资讯文章系编辑转载,转载目的在于传递更多信息,并不代表本站赞同其观点和对其真实性负责。如涉及作品内容、版权和其它问题,请在30日内与本站联系,我们将在第一时间删除内容!
[声明]本站文章版权归原作者所有 内容为作者个人观点 本站只提供参考并不构成任何投资及应用建议。
本站拥有对此声明的最终解释权。
收藏 邀请
关闭

推荐内容上一条 /1 下一条

关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

GMT+8, 2025-9-23 08:11 , Processed in 0.140625 second(s), 27 queries , Gzip On.

深圳市墨知创新科技有限公司

地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

返回顶部