🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5stack programming without Arduino IDE : how ?

    FAQS
    9
    23
    108.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JJJ
      JJ @jrs
      last edited by JJ

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

      J 1 Reply Last reply Reply Quote 0
      • J
        jrs @JJ
        last edited by jrs

        @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

        JJJ 1 Reply Last reply Reply Quote 1
        • JJJ
          JJ @jrs
          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....

          1 Reply Last reply Reply Quote 0
          • C
            Calin
            last edited by

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

            JJJ 1 Reply Last reply Reply Quote 2
            • JJJ
              JJ @Calin
              last edited by JJ

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

              1 Reply Last reply Reply Quote 0
              • wtakuoW
                wtakuo
                last edited by wtakuo

                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.

                1 Reply Last reply Reply Quote 1
                • wtakuoW
                  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

                  dasloloD wtakuoW 2 Replies Last reply Reply Quote 1
                  • dasloloD
                    daslolo @wtakuo
                    last edited by

                    @wtakuo Thank you!

                    1 Reply Last reply Reply Quote 0
                    • wtakuoW
                      wtakuo @wtakuo
                      last edited by wtakuo

                      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.

                      wtakuoW 1 Reply Last reply Reply Quote 0
                      • wtakuoW
                        wtakuo @wtakuo
                        last edited by wtakuo

                        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.

                        JJJ 1 Reply Last reply Reply Quote 0
                        • JJJ
                          JJ @wtakuo
                          last edited by

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

                          1 Reply Last reply Reply Quote 0
                          • H
                            hetlelid
                            last edited by hetlelid

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

                            1 Reply Last reply Reply Quote 0
                            • m5-docsM
                              m5-docs
                              last edited by

                              Here is the article about programming with Arduino IDE
                              For Windows:
                              https://m5stack.readthedocs.io/en/latest/get-started/m5stack_core_get_started_Arduino_Windows.html
                              For MacOS:
                              https://m5stack.readthedocs.io/en/latest/get-started/m5stack_core_get_started_Arduino_MacOS.html

                              M5Stack documentation URL

                              https://docs.m5stack.com

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post