完善资料让更多小伙伴认识你,还能领取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 |
|
|
|
只有小组成员才能发言,加入小组>>
340 浏览 1 评论
535 浏览 2 评论
NA555DR VCC最低电压需要在5V供电,为什么用3.3V供电搭了个单稳态触发器也使用正常?
781 浏览 3 评论
MSP430F249TPMR出现高温存储后失效了的情况,怎么解决?
655 浏览 1 评论
对于多级放大电路板,在PCB布局中,电源摆放的位置应该注意什么?
1138 浏览 1 评论
AT32F407在USART2 DMA发送数据时,接包接到了要发送的数据,程序还是处于等待传输完成的标识判断中,为什么?
65浏览 29评论
174浏览 23评论
请问下tpa3220实际测试引脚功能和官方资料不符,哪位大佬可以帮忙解答下
255浏览 20评论
请教下关于TAS5825PEVM评估模块原理图中不太明白的地方,寻求答疑
205浏览 14评论
两个TMP117传感器一个可以正常读取温度值,一个读取的值一直是0,为什么?
60浏览 13评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-24 08:59 , Processed in 0.872468 second(s), Total 77, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号