2020-11-22

M5Stack Core2 build from PlatformIO with VScode (tried official default code)

hmm ... first , you may need install USB driver (CP210x) from official site (test at macOS)
https://docs.m5stack.com/#/en/arduino/arduino_core2_development

create {new PlatformIO project} , choice board "M5Stack-Core"(no Core2) , then fix the [[ platformio.ini ]] like this
[env:m5stack-core-esp32]
platform = espressif32
board = m5stack-core-esp32
framework = arduino
; [[[for macos]]]
;upload_port = /dev/cu.SLAB_USBtoUART
; [[[fix PSRAM size and you won't need have this file]]]
board_build.partitions = default_16MB.csv
build_flags =
    -DBOARD_HAS_PSRAM
    -mfix-esp32-psram-cache-issue

{M5Stack Arduino libs}
https://github.com/m5stack/M5Core2

{M5Stack Core2 default factory code}
https://github.com/m5stack/M5-ProductExampleCodes/blob/master/Core/M5Core2/Arduino/Core2_Factory_test/Core2_Factory_test.ino

to build this , you need clone it and put [[ Core2_Factory_test/* ]] to [[{new PlatformIO project}/src/ ]] , rename(replace) [[ Core2_Factory_test.ino ]] to [[ main.cpp ]] and add
#include <Arduino.h>
at first line , then copy [[ {M5Stack Arduino libs}/src/* ]] to same folder (or some way to include it)

and some ref here :

{some examples}
https://github.com/m5stack/M5-ProductExampleCodes

{PlatformIO custom settings doc for ESP32 , include custom partition way}
https://docs.platformio.org/en/latest/platforms/espressif32.html

{ESP32 for Arduino partitions settings}
https://github.com/espressif/arduino-esp32/blob/master/tools/partitions/default_16MB.csv

have fun :)

沒有留言:

張貼留言