[AVR单片机] Gcc潜入汇编 约束性报错问题

[复制链接]
689|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

粉丝
快速回复 在线客服 返回列表 返回顶部