Intro
ESP32 processors first became available in September 2016 and I first used them in 2019. The last ones I purchased in 2023 for my LilyGo T-Display buttons which have been well used since then.
ESP-C3-01M-Kit
My interest was re-kindled when I noticed that the ESP32-C3 range runs on Risc-V. I purchased a couple of NodeMCU-Series ESP-C3-01m-Kit but they didn't appear to be totally compatible with the Arduino environment and I didn't progress far with them. I did subsequently try configuring with ESP-IDF which worked better.
I saw a Hackaday article talking about shell/terminal programs which can be quickly implemented.
After a quick Google I decided to try Shellminator on my ESP32-C3. Breezybox looks even better but requires a more powerful ESP32-S3 system.
I installed the Shellminator library in Arduino IDE and copied the first example program.
The program works fine and gives me a simple shell. You can then code applications which make use of the shell. This is a brilliant start for me and encouraged me to purchase an ESP32-S3 for Breezybox.
Assembly Language
It is good to see that a ESP32 Risc-V processor can be used just like an ARM processor. At present they are somewhat less powerful, but I am pleased and applaud their progress. Of course I really ought to try out the assembly language. It is possible to use inline assembly in the Arduino IDE and it appears possible to include separate assembly modules. However it looks to be rather unreliable/undocumented/error-prone.
The correct answer is to use the official ESP IDE. ESP-IDF (Espressif IoT Development Framework) is easy to install. I use it with Windows. An icon is provided to invoke the command line environment in a Windows shell. You use python "idf.py" commands to build, flash and monitor programs on an ESP32. I will talk about ESP-IDF more in another post.
Luckily for me I found an excellent simple tutorial by Prof Smith at York (US) University.
ESP-IDF uses a package called CMake to create a set of build files for you program, taking into account ESP32 variant, compiler, platform you are using. To use it you set up a structure of files. You describe what you are building in the two CMakeLists.txt files.
In this simple example we have a C program defines some variables and prints a result.
Variables are passed in RISC-V registers a0 and a1 into the assembler routine, sub3.s. The code stores the subtraction result in a0 and returns to C. In C, a0 is the result "r" which can then be printed out.
Although this is a trivial example it gives us the mechanism to write assembler. Of course, any usage of the processors GPIO pins or other capabilities requires an understanding of hardware, libraries, structures etc.
It is usual to only write the parts that you want/need to in assembler so the tricky parts can be done in C at first.
Outro
It is good to have an easy entry to RISC-V assembler programming using ESP-IDF.