M5stack programming without Arduino IDE : how ?
JJ last edited by JJ
I checked my ESP-IDF and i still have setup issues.
Under Windows, I have the ESP-IDF directory and the M5Stack-IDF directory both installed in their own separate directory located at: c:\Users\myusername
I set this up many weeks ago so I don't recall what led me to install the directories there or if that is correct.
RE - Your last error message: "when trying to use M5.xxx functions, the #include <M5Stack.h> yields in a missing M5Stack.h message."
This is where I have that file located:
I don't suppose it gave you any suggestion where it expected to find this file ?
Which OS are you running ?
Thanks for adding the links. They will be useful.
jrs last edited by jrs
I am running Mac OS
In my setup the M5Stack-IDF is in esp-idf.
I achieved to run esp-idf hello-world example on the M5Stack but I need to use M5 specific functions, hence the need for M5Stack.h I guess
The content of hello_world is (sorry indentation is not kept by this site FAQ engine):
I'll keep on tomorrow
JJ last edited by
@jrs Glad you seem to have it working.
Since yours is working, it should be safe to assume your setup is correct: with M5Stack-IDF installed in the ESP-IDF directory.
Thanks for the update....
Calin last edited by
The easyest way to start with ESP-IDF is by PlatformIO
That IDE include ESP-IDF, Arduino, Mbed...
JJ last edited by JJ
@calin Great tip re. PlatformIO - will take it for a spin...
I started to use M5Stack a month ago. I tried several simple projects using Arduino IDE. Before moving to ESP-IDF based development, I tried a trivial (hello world) project to test my settings.
Unfortunately, current https://github.com/m5stack/M5Stack-IDF looks outdated and incomplete. So I use https://github.com/m5stack/M5Stack as an IDF component as well as https://github.com/espressif/arduino-esp32 .
The project directory looks like the following.
Makefile sdkconfig components/ arduino/ (recursive clone of https://github.com/espressif/arduino-esp32, idf-update branch) M5Stack/ (clone of https://github.com/m5stack/M5Stack) component.mk (should be modified. See below) ... main/ component.mk main.cpp (copy of components/M5Stack/examples/Basics/Hello/Hello.ino)
The only tweak I did is the addition of
src/utlitityto the end of these path variables in
COMPONENT_SRCDIRS := . src src/utility COMPONENT_ADD_INCLUDEDIRS := . src src/utility
Without this modification, make cannot correctly find the source codes and headers under
The above setup looks OK and works for other projects.
My questions are:
* Is this a correct setup for ESP-IDF projects? (Is there any better one?)
* Is there any way to avoid the modification of
Thank you for attention.
wtakuo last edited by
My forked and updated version (implementing the setup in my previous post) of M5Stack-IDF template project is available: https://github.com/wtakuo/M5Stack-IDF
daslolo last edited by
@wtakuo Thank you!
I fixed my patch in https://github.com/wtakuo/M5Stack-IDF.
The path variables in
component.mkshould look like the following.
COMPONENT_SRCDIRS := src src/utility src/Fonts COMPONENT_ADD_INCLUDEDIRS := src
As shown in the above code, I added
src/Fontsto COMPONENT_SRCDIRS and removed unnecessary
"."(current directory) from both paths. Header files in the subdirectories are specified using relative paths from
src. So we don't need to add these subdirectories to
Anyway, I sent pull request regarding this fix. If my PR is accepted, the patch file in https://github.com/wtakuo/M5Stack-IDF will be unnecessary.
Now my PR has just been incorporated into the latest commit of M5Stack. So I removed patch.txt.
In addition, to tidy up the repository of my fixed M5Stack-IDF, I moved my modifications to
mainbranch no longer contains the fix now. If you'd like to try my fixed version of M5Stack-IDF, please do like the following commands.
git clone --recursive -b components_patch https://github.com/wtakuo/M5Stack-IDF.git
Sorry for inconvenience due to the changes.
JJ last edited by
thanks for your work on this…. Nice that M5Stack included your work.
Your efforts inspired me to give installation another crack – this time using Linux instead of Windows. MUCH better so far.
Just have to determine which serial port is in use… got a long list rather than a defined port when following the ESP-IDF setup guide that outlined how to distinguish the serial port in use. Will follow it up laterz.
hetlelid last edited by hetlelid
Arduino submodule failed. I downloaded the latest, like this (and working):
rm -r components/arduino/
git clone https://github.com/espressif/arduino-esp32.git components/arduino-esp32
cd components/arduino-esp32 && git submodule update --init --recursive && cd ../..
Nice if this could be fixed in the code, wtakuo :)
m5-docs last edited by
Here is the article about programming with Arduino IDE