Skip to content

Instantly share code, notes, and snippets.

@extremecoders-re
Last active November 24, 2024 19:17
Show Gist options
  • Save extremecoders-re/42eb11556f024403875ae16e7ca155b9 to your computer and use it in GitHub Desktop.
Save extremecoders-re/42eb11556f024403875ae16e7ca155b9 to your computer and use it in GitHub Desktop.

Revisions

  1. extremecoders-re revised this gist Jul 26, 2023. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion esp32-emulate.md
    Original file line number Diff line number Diff line change
    @@ -12,4 +12,5 @@ ESP32 QEMU Emulation within a Docker Container: https://arxiv.org/pdf/2303.10204

    ## Simulate

    https://wokwi.com/
    - https://wokwi.com/
    - [PICsimLab](https://github.com/lcgamboa/picsimlab)
  2. extremecoders-re revised this gist Jul 26, 2023. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion esp32-emulate.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    ## Emulate

    Espressif comes with a QEMU for for emulating ESP32 and related SoCs.

    https://github.com/espressif/qemu
    @@ -6,4 +8,8 @@ Precompiled binary in releases.

    Tutorial: https://yewtu.be/watch?v=lZp9L7Ij4Yo

    ESP32 QEMU Emulation within a Docker Container: https://arxiv.org/pdf/2303.10204.pdf
    ESP32 QEMU Emulation within a Docker Container: https://arxiv.org/pdf/2303.10204.pdf

    ## Simulate

    https://wokwi.com/
  3. extremecoders-re revised this gist Jul 26, 2023. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions platformio-setup.md
    Original file line number Diff line number Diff line change
    @@ -15,9 +15,11 @@ pip install platformio
    Now open VSCode and Install the PlatformIO extension.
    Once installed open VSCode user settings, search for PlatformIO and use the following options:

    Use a built-in PlatformIO Core: Untick
    Use a portable Python3 interpreter if available: Untick
    Custom Path: (Edit in settings.json)
    > Use a built-in PlatformIO Core: Untick
    >
    > Use a portable Python3 interpreter if available: Untick
    >
    > Custom Path: (Edit in settings.json)
    The corresponding settings.json file looks like
    ```
  4. extremecoders-re revised this gist Jul 26, 2023. No changes.
  5. extremecoders-re renamed this gist Jul 26, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. extremecoders-re revised this gist Jul 26, 2023. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion esp32-emulate.md
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,6 @@ https://github.com/espressif/qemu

    Precompiled binary in releases.

    Tutorial: https://yewtu.be/watch?v=lZp9L7Ij4Yo
    Tutorial: https://yewtu.be/watch?v=lZp9L7Ij4Yo

    ESP32 QEMU Emulation within a Docker Container: https://arxiv.org/pdf/2303.10204.pdf
  7. extremecoders-re revised this gist Jul 26, 2023. 3 changed files with 19 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion platformio-setup.md
    Original file line number Diff line number Diff line change
    @@ -42,7 +42,8 @@ Example
    pio project init --board esp32doit-devkit-v1
    ```

    The list of available boards can be found by running `pio boards <boardname>` (`pio boards esp32`).
    The list of available boards can be found by running `pio boards <boardname>` (`pio boards esp32`) and at https://docs.platformio.org/en/latest/boards/index.html.

    More details: https://docs.platformio.org/en/stable/core/quickstart.html

    Then open the directory my-esp32-project in VSCode to continue development. PlatformIO will recognize the project as usual.
    6 changes: 6 additions & 0 deletions toit.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    Not directly related

    - https://toit.io/
    - https://toitlang.org/
    - https://github.com/toitlang/toit
    - https://github.com/toitlang/jaguar
    11 changes: 11 additions & 0 deletions web-flash.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    ## Flashing using a Web browser

    It is possible to flash a ESP32 using a web browser only. A recent Chromium based browser is needed which supports the Web Serial API.

    - https://github.com/espressif/esptool-js
    - https://github.com/adafruit/Adafruit_WebSerial_ESPTool
    - https://learn.adafruit.com/adafruit-magtag/web-serial-esptool
    - https://adafruit.github.io/Adafruit_WebSerial_ESPTool/
    - https://blog.toit.io/flash-your-esp32-from-the-browser-using-web-serial-5eccb1483b9c
    - https://github.com/toitware/esptool.js
    - https://yewtu.be/watch?v=ZsD59Tg2oCQ
  8. extremecoders-re revised this gist Jul 26, 2023. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions esp32-emulate.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    Espressif comes with a QEMU for for emulating ESP32 and related SoCs.

    https://github.com/espressif/qemu

    Precompiled binary in releases.

    Tutorial: https://yewtu.be/watch?v=lZp9L7Ij4Yo
  9. extremecoders-re revised this gist Jul 26, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion platformio-setup.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ PlatformIO **does not work** with a conda Python environment. The workaround is
    Using pip from portable Python, install the platformio package as

    ```
    pip install platform
    pip install platformio
    ```

    Now open VSCode and Install the PlatformIO extension.
  10. extremecoders-re created this gist Jul 26, 2023.
    10 changes: 10 additions & 0 deletions embedded-development-tools.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    ## IDEs/Tools for ESP32 development
    - PlatformIO CLI: https://docs.platformio.org/en/stable/core/index.html
    - PlatformIO IDE: A VSCode extension https://docs.platformio.org/en/stable/integration/ide/pioide.html
    - ESPTool: https://docs.espressif.com/projects/esptool/en/latest/esp32/
    - ESP-IDF: Eclipse Plugin + VSCode extension https://github.com/espressif/esp-idf
    - Arduino CLI: https://github.com/arduino/arduino-cli
    - VSCode-Arduino: https://github.com/microsoft/vscode-arduino
    - Legacy Arduino IDE: https://www.arduino.cc/en/software

    PlatformIO based tools can work both with Arduino as well as Espressif libraries.
    85 changes: 85 additions & 0 deletions platformio-setup.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,85 @@
    # PlatformIO Setup

    The PlatformIO extension can be installed in VSCode. The extension also needs an installation of Python 3.6 or above.
    The virtualenv module (venv pypi package) must be available as well.

    Forcing PlatformIO to use a different Python installation other than the system installed is tricky.
    PlatformIO **does not work** with a conda Python environment. The workaround is to use a portable Python build from [python-build-standalone](https://github.com/indygreg/python-build-standalone) project.

    Using pip from portable Python, install the platformio package as

    ```
    pip install platform
    ```

    Now open VSCode and Install the PlatformIO extension.
    Once installed open VSCode user settings, search for PlatformIO and use the following options:

    Use a built-in PlatformIO Core: Untick
    Use a portable Python3 interpreter if available: Untick
    Custom Path: (Edit in settings.json)

    The corresponding settings.json file looks like
    ```
    "platformio-ide.customPATH": "/home/ubuntu/python3.11-pio/python/bin/",
    "platformio-ide.useBuiltinPython": false,
    "platformio-ide.useBuiltinPIOCore": false,
    ```

    Restart VSCode after and PlatformIO should work.

    ## Other Issues

    PlatformIO Home does not open when using the PlatformIO extension from a remote VSCode setup (like `code tunnel` or VSCode server).
    This is because the extension tries to connect to the PlatformIO core web server started on localhost on opening the PIO home page. When VSCode is accessed remotely the localhost from the web browser's context is not the same as the localhost of the system where PlatformIO core is installed.

    In such cases use the PlatformIO Core CLI to create a new project from the command line and open the folder in VSCode instead.

    Example
    ```
    mkdir my-esp32-project
    cd my-esp32-project
    pio project init --board esp32doit-devkit-v1
    ```

    The list of available boards can be found by running `pio boards <boardname>` (`pio boards esp32`).
    More details: https://docs.platformio.org/en/stable/core/quickstart.html

    Then open the directory my-esp32-project in VSCode to continue development. PlatformIO will recognize the project as usual.

    ## Compiling from the CLI

    The CLI gude can be found at: https://docs.platformio.org/en/stable/core/userguide/index.html

    ```
    pio run
    ```

    Use the `-v` / `--verbose` argument for the detailed commands being run

    ## Cleaning build files

    ```
    pio run --target clean
    ```

    or `pio run -t clean -v`

    ## Uploading build files without compiling

    This is useful when we do not want to distribute the source code of the firmware.
    We can delete the source directories (include/, lib/, source/, test/) and keep the other directories including the .pio directory.
    Then in the project folder
    ```
    pio run -t nobuild -t upload
    ```

    which will upload the compiled firmware directly.

    - https://community.platformio.org/t/simple-utility-to-field-upload-firmware-bin-without-the-ide/22153
    - https://community.platformio.org/t/compile-and-save-file-for-future-upload/21266
    - https://community.platformio.org/t/upload-latest-build-without-a-compile-link/9520
    - https://community.platformio.org/t/compile-and-save-file-for-future-upload/21266