完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
大神们,帮忙啊,菜鸟一只,刚接触汇编。我这边想在C语言中添加汇编模块,汇编模块的作用是对GPIO口进行拉高拉低,即输出一个方波。但在编译的时候汇编部分出现如下错误:
ERRORS: [E0001] Illegal symbol [E0003] Unexpected trailing operand(s) [E0200] Bad term in expression 经过检查发现,出问题是下面两条汇编语句 LDR r0,=0x01E2606c STR r1,[r0] 我就是想对控制GPIO的相应寄存器进行赋值。请问一下 1 上述汇编有没有问题,因为我发现像mov等关键字都会变颜色,但LDR和STR没有变。感觉好像不支持一样(我用的是CCS v4,芯片是AM1808) 2 ccsv4支持的汇编语句及其相应的例子可以在哪里看 3 C语言和汇编混合编程有什么资料推荐吗 |
|
相关推荐
1个回答
|
|
写法不对,参考文档spru187t的7.5.4节:
7.5.4 Using Inline Assembly Language Within a C/C++ program, you can use the asm statement to insert a single line of assembly language into the assembly language file created by the compiler. A series of asm statements places sequential lines of assembly language into the compiler output with no intervening code. For more information, see Section 6.8. The asm statement is useful for inserting comments in the compiler output. Simply start the assembly code string with a semicolon (;) as shown below: asm(";*** this is an assembly language comment"); NOTE: Using the asm Statement Keep the following in mind when using the asm statement: • Be extremely careful not to disrupt the C/C++ environment. The compiler does not check or analyze the inserted instructions. • Avoid inserting jumps or labels into C/C++ code because they can produce unpredictable results by confusing the register-tracking algorithms that the code generator uses. • Do not change the value of a C/C++ variable when using an asm statement. This is because the compiler does not verify such statements. They are inserted as is into the assembly code, and potentially can cause problems if you are not sure of their effect. • Do not use the asm statement to insert assembler directives that change the assembly environment. • Avoid creating assembly macros in C code and compiling with the --symdebug:dwarf (or -g) option. The C environment’s debug information and the assembly macro expansion are not compatible. http://processors.wiki.ti.com/index.php/Main_Page Think Over Before Asking. http://www.catb.org/~esr/faqs/smart-questions.html#goal |
|
|
|
只有小组成员才能发言,加入小组>>
NA555DR VCC最低电压需要在5V供电,为什么用3.3V供电搭了个单稳态触发器也使用正常?
669 浏览 3 评论
MSP430F249TPMR出现高温存储后失效了的情况,怎么解决?
597 浏览 1 评论
对于多级放大电路板,在PCB布局中,电源摆放的位置应该注意什么?
1048 浏览 1 评论
731 浏览 0 评论
普中科技F28335开发板每次上电复位后数码管都会显示,如何熄灭它?
520 浏览 1 评论
请问下tpa3220实际测试引脚功能和官方资料不符,哪位大佬可以帮忙解答下
158浏览 20评论
请教下关于TAS5825PEVM评估模块原理图中不太明白的地方,寻求答疑
120浏览 14评论
在使用3254进行录音的时候出现一个奇怪的现象,右声道有吱吱声,请教一下,是否是什么寄存器设置存在问题?
123浏览 13评论
TLV320芯片内部自带数字滤波功能,请问linein进来的模拟信号是否是先经过ADC的超采样?
122浏览 12评论
TPA6304-Q1: TPA6304 两片公用一组I2C的话,其中一片配置不成功怎么办
163浏览 10评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-22 16:45 , Processed in 0.827902 second(s), Total 80, Slave 63 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号