SparkFun Forums 

Where electronics enthusiasts find answers.

Everything ARM and LPC
By Reiik
#147602
I just upgraded to the latest version of IAR Kickstart (code-limited). When I tried recompiling my code (which includes a lot of inline assembly), I got a large number of errors where there were none before. I found the issue, and reproduced it in the simple program below:

int main()
{
asm("test_label:\n");
asm("jmp test_label\n");

return 0;
}

This generates two errors on the second asm line, saying: "Unknown symbol in inline assembly: 'test_label'", and "Syntax error in inline assembly: 'Error[54]: Expression can not be forward.'" I'm really surprised, as this code follows all the conventions as far as I know. Any thoughts on what could be going on? (Apologies if this topic isn't quite appropriate for this board.)
By UhClem
#147625
The example in the manual is:
Code: Select all
asm ("Label:  nop\n"
     "        b Label");
Have you tried putting your code in that form?

The manual also warns about using inline assembly because of its fragility. One example of this is that compiler upgrades can break your code. Perhaps you should reexamine your code to see if you really require inline assembly or if you can move it to a separate assembler source file.
By stevech
#147669
This
int main()
{
asm("test_label:\n");
asm("jmp test_label\n");

return 0;
}
seems needless.

In C one can code

while (1)
{};

so long as you don't let the compiler's optimizer eliminate this loop
By UhClem
#147680
stevech wrote: In C one can code

while (1)
{};
You seemed to have missed the point that the example is a simple code fragment that reproduces the error.
By stevech
#147694
UhClem wrote:
stevech wrote: In C one can code

while (1)
{};
You seemed to have missed the point that the example is a simple code fragment that reproduces the error.
as is said now... my bad!