How to use ESP32 specific assembler

Hello! I'm trying to use assembler insertion with ESP32 specific instruction - "wait". But when I compile it, Arduino IDE cannot recognize this instruction, it writes:

"Error: unknown opcode or format name 'wait'"

The same happens with instruction "wake".
But when I try to compile assembler insertion with standard GNU instruction "mov", it is compiled without errors.

But I need instruction "wait". How to force Arduino IDE to recognize and compile this instruction and at whole all ESP32 specific instructions?

Welcome to the forum

You started a topic in the Uncategorised category of the forum

Your topic has been moved to a relevant category. Please be careful in future when deciding where to start new topics

Which ESP32 CPU are you using, and what are you looking at as a reference for the assembly language?

AFAICT, neither the Tensilica nor RISC-V cpu cores have a "WAIT" instruction. (Tensilica has WAITI, RISC-V has WFI)
And I've never heard of a WAKE instruction on any CPU (waking up is usually caused by some hardware event.) (Hmm. I guess some dual-core systems might have the ability for one core to wake the other.)

1 Like

I'm using ESP-WROOM-32. As I've discovered in Technical Reference Manual, it is based on Xtensa LX6 cores.

These two instructions are described in ESP32 Technical Reference Manual in Instruction Set chapter

Ah. Those are instructions for the ULP co-processor.

29.4 Instruction Set
The ULP co-processor provides the following instructions:
• Perform arithmetic and logic operations - ALU
• Load and store data - LD, ST, REG_RD and REG_WR • Jump to a certain address - JUMP
• Manage program execution - WAIT/HALT
• Control sleep period of ULP co-processor - SLEEP

There's some info on programming the co-processor here: Programming ULP FSM Coprocessor Using C Macros (Legacy) - ESP32 - — ESP-IDF Programming Guide v5.2.1 documentation
But it's not as "simple" as normal inline ASM...

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.