M5stack programming without Arduino IDE : how ?



  • @jrs Hi,

    Which programming environment you are wanting to use ?

    ESP-IDF , Micropython , Platformio , Eclipse

    If new to ESP32 is probably best to start with Arduino and move on to others from there.

    There are install notes at the link below, but I assume you've already viewed this:
    https://github.com/m5stack/M5Stack



  • @all, sorry for not mentioning my goal : to code in C/C++ with ESP-IDF framework

    @jimit
    Thank you for your message.
    Indeed, I have already written SW fo ESP32 (WRover kit) with ESP-IDF and I would like to do the same with M5stack.
    Yes, I have read the following help : https://github.com/m5stack/M5Stack/blob/master/docs/esp-idf_component.md
    but at compile time, some librairis are reported as missing.

    Did you succeed in this same endeavor ?

    Rgds



  • @jrs Hi,

    Using ESP-IDF a few weeks ago, I also got errors at compile time but I think they may have been to do with my setup, rather than a report of missing libraries. Haven't had time to revisit.

    You are probably also familiar with the help at this link: https://esp-idf.readthedocs.io/en/latest/

    I did a search and found at this link (https://github.com/espressif/esp-idf/releases/tag/v1.0) the following comment:

    "ESP-IDF can only be used when cloned as git repository. Downloaded .zip archive is not functional because it doesn't contain submodule dependencies."

    Did you install ESP-IDF via ZIP download via the link you mentioned ?

    If yes to that and if the statement above is accurate, then that could be explain it. But there could always be other reasons........



  • @jimit
    Yes, the install was done with git cloning
    I'll try again tomorrow to better trace the errors
    Thanks for your hints so far, I value your help



  • @jrs No problem.... Yes more details on the errors or maybe mention what you are trying to compile if it is a known program/sketch. Don't think I can be of any further help but with more details someone else may have some answers.



  • @jrs

    When building with esp-idf you can use M5Satck just like any other ESP32 development board.
    All esp-idf examples, for example, will run on M5Stack same as on any other board.

    You may have some issues when using C++. Please cunsult the documentation and ESP32 forum. There are many threads related to C++ issues/questions.



  • @jimit
    Hi,
    I have re-installed esp-idf and compiling a project for the WRover kit works nicely, as always.
    Next, I have cloned M5Stack-IDF but it is not clear in my minds where the directory should go. Should individual components be copied into esp-idf's own components directory ?

    As per the M5Stack documentation (https://github.com/m5stack/M5Stack-IDF), make menuconfig should have some Arduino option ... but I don't see any
    All other compilation issues could stem from this initial installation/configuration mistakes on my side.

    Any idea ?

    TIA for your help !



  • @jimit
    Hi,

    Now, make menuconfig has Arduino options.
    I had followed
    https://github.com/m5stack/M5Stack-IDF
    which lacks some parts of
    https://github.com/m5stack/M5Stack/blob/master/docs/esp-idf_component.md

    But now, when trying to use M5.xxx functions, the #include <M5Stack.h> yields in a missing M5Stack.h message.

    I keep searching to solve the issues



  • @jrs Hi,

    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:
    C:\Users\myusername\M5Stack-IDF\components\M5Stack\src\M5Stack.h

    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.



  • @jimit
    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):

    build/
    components/
    arduino/
    appveyor.yml
    boards.txt
    component.mk
    cores/
    docs/
    Kconfig
    libraries/
    Makefile.projbuild
    package/
    package.json
    platform.txt
    programmers.txt
    README.md
    tools/
    variants/
    main
    component.mk
    hello_world_main.c
    Makefile
    README.md
    sdkconfig
    sdkconfig.old

    I'll keep on tomorrow



  • @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....



  • The easyest way to start with ESP-IDF is by PlatformIO
    That IDE include ESP-IDF, Arduino, Mbed...



  • @calin Great tip re. PlatformIO - will take it for a spin...



  • Hello.
    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/utlitity to the end of these path variables in components/M5Stack/component.mk.

    COMPONENT_SRCDIRS := . src src/utility
    COMPONENT_ADD_INCLUDEDIRS := . src src/utility
    

    Without this modification, make cannot correctly find the source codes and headers under src/utility.

    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 components/M5Stack/component.mk?

    Thank you for attention.



  • 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



  • @wtakuo Thank you!



  • I fixed my patch in https://github.com/wtakuo/M5Stack-IDF.

    The path variables in component.mk should look like the following.

    COMPONENT_SRCDIRS := src src/utility src/Fonts
    COMPONENT_ADD_INCLUDEDIRS := src
    

    As shown in the above code, I added src/Fonts to 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 COMPONENT_ADD_INCLUDEDIRS.

    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 components_patch branch. So main branch 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.



  • @wtakuo

    Hi wtakuo,

    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.



  • For reference:

    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 :)