Messages Og005 and Og006 when using inline assembler

Technical Note 31237

Architectures:

ARM, AVR, AVR32

Component:

compiler

Updated:

2015/11/6 13:04

Introduction

When compiling a project the following messages might appear:

Error[Og005]: Unknown symbol in inline assembly:
Error[Og006]: Syntax error in inline assembly: "Error[54]: Expression can not be forward"

Solution

Labels must be referred in the same assembler statement as they are declared. Use multiline inline assembler (with row breaks \n) to solve this.

Example:

asm("st      -Y,  R20\n  \n"
"spmloop: \n"
"lN R20, 0x37 \n"
"SBRC R20, 0 \n"
"RJMP spmloop \n"
"OUT 0x37,R25 \n"
"SPM \n"
"LD R20,Y+ \n");

The behavior was not correct in earlier versions of the compiler platform. The new release uses a new internal compiler platform which is a bit more strict.


All product names are trademarks or registered trademarks of their respective owners.

很抱歉,该页面尚未翻译成中文。

如果您有任何问题,请联系我们的中国团队

We do no longer support Internet Explorer. To get the best experience of iar.com, we recommend upgrading to a modern browser such as Chrome or Edge.