Forum: Mikrocontroller und Digitale Elektronik Fehler Konvertierung GCC nach IAR bzw Keil


von Dominic (Gast)


Angehängte Dateien:

Lesenswert?

Guten Tag,
ich habe einen C-Code, geschrieben für den GCC, den ich gerne für IAR 
bzw Keil konvertieren würde. Ich hatte es mir soweit angeschaut, aber 
ich verstehe nicht, was die angezeigten Fehler bedeuten bzw wie ich 
diese löse.

In IAR wird die Fehlermeldung "Error[Og006]: Syntax error in inline 
assembly: "Error[0]: Invalid syntax" ..\test IAR fc\serial.c 81" für 
dieses Statement gegeben:

#define disable_interrupts() asm(" cpsid i ")
disable_interrupts();

Keil scheint hierbei hingegen weniger ein Problem zu haben.

Kann jemand ggf helfen? Es kann ja wirklich nur eine Syntax-Sache sein. 
Der Code läuft ja unter GCC.

von (º°)·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.· (Gast)


Lesenswert?

IAR Technical Note 86655:

...

"Background:
Now and then there are users requesting that IAR makes a "GCC to EWARM 
Migration Guide". This might seem to be trivial task (as IAR have 
written other Migration Guides), but it is not trivial, as there is not 
"one GCC compiler" so we are not able to cover all GCC variants.

Suggestion:
The most different area between GCC and EWARM is Inline Assembler and 
such constructions (and some other issues) will be commented in this 
Tech Note (and in the attachment). The goal is that the 9 examples + 
comments should cover the issues that are most different between GCC and 
EWARM, and that other issues can be sorted out by the developer that 
performs the migration."

...

von Vincent H. (vinci)


Lesenswert?

1
#define disable_interrupts() asm(" cpsid i ")

Assembler Syntax ist nicht so ohne weiteres zwischen dem GCC und IAR 
kompatibel... Aus diesem Grund stehen in den CMSIS Headern im Normalfall 
eine Reihe #defines, die als Compiler Switches dienen.

Ich würde dazu raten, diese Header zu nutzen ;)

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.