YuanLinTech
YuanLinTech

Reputation: 83

Error L6218E undefined symbol _asm (referred from main.o)

I'm facing a linker error. I wrote the following inline Assembly code in Keil µVision5,

_asm("NOP");
_asm("NOP");

and I got the following error: .\RAM\STM32F439_Template.axf: Error: L6218E: Undefined symbol _asm (referred from main.o).

I included the header file "stm325439xx.h" in the program.

Could anyone help me fix this error? Thank you.

Upvotes: 0

Views: 2294

Answers (2)

Tars
Tars

Reputation: 1

yeah,it's __(two consecutive underscores instead of one)

Upvotes: 0

Tom V
Tom V

Reputation: 5470

To make this code work, you either need to include the header where a macro _asm is defined, or else if it is built in to some compiler then select the correct compiler in the project settings (Keil tools support multiple different compilers).

However, the portable solution is to not use this code but rather to include "stm32f4xx.h" and then use __NOP(), which is correct for many compilers.

Upvotes: 1

Related Questions