打印
[AVR单片机]

Gcc潜入汇编 约束性报错问题

[复制链接]
425|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
水水|  楼主 | 2017-8-8 15:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
菜鸟问个问题,望大侠给予指导,谢谢了


for( i = 0; i < 240 ; i++)
        {
                uint8_t m =  bitcode[i];
                //if ( bitcode[i] )
                asm volatile
                (
                        "mov eax, %[codevalue] \n\t"
                        "cpi eax, #0 \n\t"        //Compare with Immediate
                        "jmp label1 \n\t"
                        "cpi eax, #1 \n\t"
                        "jmp label2 \n\t"
                        ".label1:"
                        "sbi %[port], %[bit] \n\t"                                // Set the output bit 14nop   Set Bit in I/O Register
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "cbi %[port], %[bit] \n\t"                // Clear the output bit 3nop
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"

                        ".label2:"
                        "sbi %[port], %[bit] \n\t"                                // Set the output bit 6nop
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "cbi %[port], %[bit] \n\t"             // Clear the output bit 11nop
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        "nop \n\t"
                        ::
                        [codevalue] "I" (m),
                        [port]          "I" (_SFR_IO_ADDR(PIXEL_PORT)),
                        [bit]                "I" (PIXEL_BIT)
                );

相关帖子

沙发
john_lee| | 2017-8-8 18:33 | 只看该作者
你这是啥CPU,x86 还是 AVR?
报什么错?贴出来。

使用特权

评论回复
板凳
水水|  楼主 | 2017-8-8 20:28 | 只看该作者
AVR
报错  impossible constraint in 'asm'

谢谢指导

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

2

帖子

0

粉丝