Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run ESP32S3 on Windows #1181

Closed
NW-Lab opened this issue Jul 25, 2023 · 12 comments
Closed

Run ESP32S3 on Windows #1181

NW-Lab opened this issue Jul 25, 2023 · 12 comments

Comments

@NW-Lab
Copy link
Contributor

NW-Lab commented Jul 25, 2023

Now that ESP32S3 and ESP32C3 are popular, I would like to use it on Windows as well.
I believe debugging is currently only available via USB-UART.
It would be nice to be able to debug using a USB-CDC such as M5ATOM_S3 or XIAO ESP32S3.

Currently, the response disappears on the following screen.

C:\pjt\moddable\examples\helloworld>mcconfig -d -m -p esp32/m5atom_s3
情報: 与えられたパターンのファイルが見つかりませんでした。
Setting PYTHONNOUSERSITE, was not set
Using Python in C:\Espressif\python_env\idf4.4_py3.8_env\Scripts\
Python 3.8.7
Using Git in C:\Espressif\tools\idf-git\2.34.2\cmd\
git version 2.34.1.windows.1
Setting IDF_PATH: C:\Espressif\frameworks\esp-idf-v4.4.4

Adding ESP-IDF tools to PATH...
Not using an unsupported version of tool cmake found in PATH: 3.26.0.
Not using an unsupported version of tool ninja found in PATH: 1.11.0.
    C:\Espressif\tools\xtensa-esp-elf-gdb\11.2_20220823\xtensa-esp-elf-gdb\bin
    C:\Espressif\tools\riscv32-esp-elf-gdb\11.2_20220823\riscv32-esp-elf-gdb\bin
    C:\Espressif\tools\xtensa-esp32-elf\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\bin
    C:\Espressif\tools\xtensa-esp32s2-elf\esp-2021r2-patch5-8.4.0\xtensa-esp32s2-elf\bin
    C:\Espressif\tools\xtensa-esp32s3-elf\esp-2021r2-patch5-8.4.0\xtensa-esp32s3-elf\bin
    C:\Espressif\tools\riscv32-esp-elf\esp-2021r2-patch5-8.4.0\riscv32-esp-elf\bin
    C:\Espressif\tools\esp32ulp-elf\2.35_20220830\esp32ulp-elf\bin
    C:\Espressif\tools\cmake\3.23.1\bin
    C:\Espressif\tools\openocd-esp32\v0.11.0-esp32-20221026\openocd-esp32\bin
    C:\Espressif\tools\ninja\1.10.2\
    C:\Espressif\tools\idf-exe\1.0.3\
    C:\Espressif\tools\ccache\4.3\ccache-4.3-windows-64
    C:\Espressif\tools\dfu-util\0.9\dfu-util-0.9-win64
    C:\Espressif\frameworks\esp-idf-v4.4.4\tools

Checking if Python packages are up to date...
Python requirements from C:\Espressif\frameworks\esp-idf-v4.4.4\requirements.txt are satisfied.

Done! You can now compile ESP-IDF projects.
Go to the project directory and run:

  idf.py build

Recommend using ESP-IDF v4.4.3 (found v4.4.4)
  See update instructions at: https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/devices/esp32.md        1 個のファイルをコピーしました。
        1 個のファイルをコピーしました。
        1 個のファイルをコピーしました。
Reconfiguring ESP-IDF...
Executing action: reconfigure
Running cmake in directory c:\pjt\moddable\build\tmp\esp32\m5atom_s3\debug\helloworld\xsproj-esp32s3\build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DSDKCONFIG_DEFAULTS=c:/pjt/moddable/build/tmp/esp32/m5atom_s3/debug/helloworld/xsProj-esp32s3/sdkconfig.mc -DSDKCONFIG_HEADER=c:\pjt\moddable\build\tmp\esp32\m5atom_s3\debug\helloworld\xsProj-esp32s3\build\config\sdkconfig.h -DCMAKE_MESSAGE_LOG_LEVEL=ERROR -DDEBUGGER_SPEED=115200 -DIDF_TARGET=esp32s3 -DESP32_SUBCLASS=esp32s3 -DSDKCONFIG_DEFAULTS=c:\pjt\moddable\build\tmp\esp32\m5atom_s3\debug\helloworld\xsProj-esp32s3\sdkconfig.mc -DCCACHE_ENABLE=1 c:\pjt\moddable\build\tmp\esp32\m5atom_s3\debug\helloworld\xsproj-esp32s3"...
Processing 1 dependencies:
[1/1] idf (4.4.4)
-- DEBUG: Use esp-modbus component folder: C:/Espressif/frameworks/esp-idf-v4.4.4/components/freemodbus.
Loading defaults file C:/pjt/moddable/build/tmp/esp32/m5atom_s3/debug/helloworld/xsProj-esp32s3/sdkconfig.mc...
C:/pjt/moddable/build/tmp/esp32/m5atom_s3/debug/helloworld/xsProj-esp32s3/sdkconfig.mc:1433 CONFIG_CONSOLE_UART_DEFAULT was replaced with CONFIG_ESP_CONSOLE_UART_DEFAULT
C:/pjt/moddable/build/tmp/esp32/m5atom_s3/debug/helloworld/xsProj-esp32s3/sdkconfig.mc:1434 CONFIG_CONSOLE_UART was replaced with CONFIG_ESP_CONSOLE_UART
C:/pjt/moddable/build/tmp/esp32/m5atom_s3/debug/helloworld/xsProj-esp32s3/sdkconfig.mc:1435 CONFIG_CONSOLE_UART_BAUDRATE was replaced with CONFIG_ESP_CONSOLE_UART_BAUDRATE
C:/pjt/moddable/build/tmp/esp32/m5atom_s3/debug/helloworld/xsProj-esp32s3/sdkconfig.mc:1438 CONFIG_FLASHMODE_DIO was replaced with CONFIG_ESPTOOLPY_FLASHMODE_DIO
C:\Users\tauchi\AppData\Local\Temp\confgen_tmp1zm582pw:504 line was updated to CONFIG_ESP_SYSTEM_PANIC_GDBSTUB=n
C:\Users\tauchi\AppData\Local\Temp\confgen_tmp1zm582pw:585 line was updated to CONFIG_ESP_COREDUMP_ENABLE_TO_UART=n
C:\Users\tauchi\AppData\Local\Temp\confgen_tmp1zm582pw:590 line was updated to CONFIG_ESP_COREDUMP_ENABLE=n
-- Configuring done
-- Generating done
-- Build files have been written to: C:/pjt/moddable/build/tmp/esp32/m5atom_s3/debug/helloworld/xsProj-esp32s3/build
        1 個のファイルをコピーしました。
# ld xs_esp32.bin
        1 個のファイルをコピーしました。
        1 個のファイルをコピーしました。
Executing action: all (aliases: build)
Running ninja in directory c:\pjt\moddable\build\tmp\esp32\m5atom_s3\debug\helloworld\xsproj-esp32s3\build
Executing "ninja all"...
[3/7] Generating binary image from built executable
esptool.py v3.3.2
Creating esp32s3 image...
Merged 2 ELF sections
Successfully created esp32s3 image.
Generated C:/pjt/moddable/build/tmp/esp32/m5atom_s3/debug/helloworld/xsProj-esp32s3/build/xs_esp32.bin
[4/7] cmd.exe /C "cd /D C:\pjt\moddable\build\tmp\esp32\m5...tom_s3/debug/helloworld/xsProj-esp32s3/build/xs_esp32.bin"
xs_esp32.bin binary size 0x70210 bytes. Smallest app partition is 0x3f0000 bytes. 0x37fdf0 bytes (89%) free.
[5/7] Performing build step for 'bootloader'
[0/1] Re-running CMake...
-- Building ESP-IDF components for target esp32s3
-- DEBUG: Use esp-modbus component folder: C:/Espressif/frameworks/esp-idf-v4.4.4/components/freemodbus.
-- Project sdkconfig file C:/pjt/moddable/build/tmp/esp32/m5atom_s3/debug/helloworld/xsProj-esp32s3/sdkconfig
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.4/components/soc/esp32s3/ld/esp32s3.peripherals.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_rom/esp32s3/ld/esp32s3.rom.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_rom/esp32s3/ld/esp32s3.rom.api.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_rom/esp32s3/ld/esp32s3.rom.libgcc.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_rom/esp32s3/ld/esp32s3.rom.newlib.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.4/components/bootloader/subproject/main/ld/esp32s3/bootloader.ld
-- Adding linker script C:/Espressif/frameworks/esp-idf-v4.4.4/components/bootloader/subproject/main/ld/esp32s3/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp32s3 esp_common esp_hw_support esp_rom esp_system esptool_py freertos hal log main micro-ecc newlib partition_table soc spi_flash xtensa
-- Component paths: C:/Espressif/frameworks/esp-idf-v4.4.4/components/bootloader C:/Espressif/frameworks/esp-idf-v4.4.4/components/bootloader_support C:/Espressif/frameworks/esp-idf-v4.4.4/components/efuse C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp32s3 C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_common C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_hw_support C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_rom C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_system C:/Espressif/frameworks/esp-idf-v4.4.4/components/esptool_py C:/Espressif/frameworks/esp-idf-v4.4.4/components/freertos C:/Espressif/frameworks/esp-idf-v4.4.4/components/hal C:/Espressif/frameworks/esp-idf-v4.4.4/components/log C:/Espressif/frameworks/esp-idf-v4.4.4/components/bootloader/subproject/main C:/Espressif/frameworks/esp-idf-v4.4.4/components/bootloader/subproject/components/micro-ecc C:/Espressif/frameworks/esp-idf-v4.4.4/components/newlib C:/Espressif/frameworks/esp-idf-v4.4.4/components/partition_table C:/Espressif/frameworks/esp-idf-v4.4.4/components/soc C:/Espressif/frameworks/esp-idf-v4.4.4/components/spi_flash C:/Espressif/frameworks/esp-idf-v4.4.4/components/xtensa-- Configuring done
-- Generating done
-- Build files have been written to: C:/pjt/moddable/build/tmp/esp32/m5atom_s3/debug/helloworld/xsProj-esp32s3/build/bootloader
[1/1] cmd.exe /C "cd /D C:\pjt\moddable\build\tmp\esp32\m5atom_s3\debug\helloworld\xsProj-esp32s3\build\bootloader\esp-idf\esptool_py && C:\Espressif\python_env\idf4.4_py3.8_env\Scripts\python.exe C:/Espressif/frameworks/esp-idf-v4.4.4/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x0 C:/pjt/moddable/build/tmp/esp32/m5atom_s3/debug/helloworld/xsProj-esp32s3/build/bootloader/bootloader.bin"
Bootloader binary size 0x3170 bytes. 0x4e90 bytes (61%) free.
Executing action: flash
Serial port COM8
Connecting...
Detecting chip type... ESP32-S3
Running ninja in directory c:\pjt\moddable\build\tmp\esp32\m5atom_s3\debug\helloworld\xsproj-esp32s3\build
Executing "ninja flash"...
[1/5] cmd.exe /C "cd /D C:\pjt\moddable\build\tmp\esp32\m5...tom_s3/debug/helloworld/xsProj-esp32s3/build/xs_esp32.bin"
xs_esp32.bin binary size 0x70210 bytes. Smallest app partition is 0x3f0000 bytes. 0x37fdf0 bytes (89%) free.
[2/5] Performing build step for 'bootloader'
[1/1] cmd.exe /C "cd /D C:\pjt\moddable\build\tmp\esp32\m5atom_s3\debug\helloworld\xsProj-esp32s3\build\bootloader\esp-idf\esptool_py && C:\Espressif\python_env\idf4.4_py3.8_env\Scripts\python.exe C:/Espressif/frameworks/esp-idf-v4.4.4/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x0 C:/pjt/moddable/build/tmp/esp32/m5atom_s3/debug/helloworld/xsProj-esp32s3/build/bootloader/bootloader.bin"
Bootloader binary size 0x3170 bytes. 0x4e90 bytes (61%) free.
[2/3] cmd.exe /C "cd /D C:\Espressif\frameworks\esp-idf-v4...sp-idf-v4.4.4/components/esptool_py/run_serial_tool.cmake"
esptool.py esp32s3 -p COM8 -b 921600 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 8MB 0x0 bootloader/bootloader.bin 0x10000 xs_esp32.bin 0x8000 partition_table/partition-table.bin
esptool.py v3.3.2
Serial port COM8
Connecting...
Chip is ESP32-S3
Features: WiFi, BLE
Crystal is 40MHz
MAC: dc:54:75:c8:95:0c
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00003fff...
Flash will be erased from 0x00010000 to 0x00080fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Compressed 12656 bytes to 8886...
Writing at 0x00000000... (100 %)
Wrote 12656 bytes (8886 compressed) at 0x00000000 in 0.3 seconds (effective 330.9 kbit/s)...
Hash of data verified.
Compressed 459280 bytes to 272177...
Writing at 0x00010000... (5 %)
Writing at 0x0001a623... (11 %)
Writing at 0x0002384b... (17 %)
Writing at 0x0002d3b0... (23 %)
Writing at 0x00032b40... (29 %)
Writing at 0x00037de8... (35 %)
Writing at 0x0003d596... (41 %)
Writing at 0x0004306b... (47 %)
Writing at 0x000491f4... (52 %)
Writing at 0x000500c0... (58 %)
Writing at 0x0005550e... (64 %)
Writing at 0x0005b16c... (70 %)
Writing at 0x0006048f... (76 %)
Writing at 0x0006683e... (82 %)
Writing at 0x0006f0aa... (88 %)
Writing at 0x00076bf0... (94 %)
Writing at 0x0007c5d7... (100 %)
Wrote 459280 bytes (272177 compressed) at 0x00010000 in 3.8 seconds (effective 979.1 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 83...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (83 compressed) at 0x00008000 in 0.1 seconds (effective 224.5 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
Done
Launching app...
Type Ctrl-C twice after debugging app.
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x20 (DOWNLOAD(USB/UART0))
Saved PC:0x40041a79
waiting for download

xsbug started but not working

Thank you.,

@mkellner
Copy link
Collaborator

mkellner commented Jul 25, 2023

Press reset on the device after the software downloads.

(similar to Espressif issue #6762 - espressif/arduino-esp32#6762 )

@NW-Lab
Copy link
Contributor Author

NW-Lab commented Jul 26, 2023

thank you for your reply.
Debug instrument does not start even after writing and resetting.

The last part of the message is
The last 9 lines are the message after reset.

Writing at 0x00076bf0... (94 %)
Writing at 0x0007c5d7... (100 %)
Wrote 459280 bytes (272177 compressed) at 0x00010000 in 3.7 seconds (effective 981.4 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 83...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (83 compressed) at 0x00008000 in 0.1 seconds (effective 223.4 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
Done
Launching app...
Type Ctrl-C twice after debugging app.
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x20 (DOWNLOAD(USB/UART0))
Saved PC:0x40041a76
waiting for download
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40375418
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x88
load:0x403c9700,len:0x990
load:0x403cc700,len:0x2700
entry 0x403c98ac

the environment is
・Windows 11
・Platform esp32/m5atom_s3, esp32/xiao_esp32s3

I thought I still couldn't debug because the Windows Makefile didn't recognize the USB mode.
tools/mcconfig/nmake.esp32.mk
Mac and Linux Makefiles use the VID, PID, and USE_USB flags to control flow.
tools/mcconfig/make.esp32.mk

thank you.

@NW-Lab
Copy link
Contributor Author

NW-Lab commented Aug 16, 2023

There are two issues in my opinion.

I am using Windows10, M5Atom_S3.

  1. After flashing the device and resetting it, the VID/PID is 303a/1001 and it won't go into CDC mode.
  2. I can't connect to xsbug even if I connect the device burned with mac. (Used Komando mcconfig -d -m -p esp32/m5atom_s3 -t xsbug)

@mkellner
Copy link
Collaborator

Hello @NextWorldLab, I have checked in some support to nmake.esp32.mk
Please try it.

@NW-Lab
Copy link
Contributor Author

NW-Lab commented Aug 20, 2023

@mkellner san

I confirmed the operation with the device (M5atom_s3).
Now I can use the ESP32S3 device.

Thank you,

@phoddie
Copy link
Collaborator

phoddie commented Aug 20, 2023

That's great news. Thank you for verifying the fix. Should we close this issue now?

@NW-Lab
Copy link
Contributor Author

NW-Lab commented Aug 21, 2023

NodeRED Editor and xsbug cannot be connected with Node-RED MCU Plugin.
I could be wrong, but I have a feeling that mcconfig's x option is not working.
It works fine for m5atom_matrix(esp32) but not for m5atom_s3(esp32s3).

NodeRed MCU Plugin is generating the command "mcconfig -d -x localhost:5004 -m -p esp32/m5atom_s3"
but there seems to be no connection to localhost:5004.

@phoddie
Copy link
Collaborator

phoddie commented Aug 21, 2023

Thanks for the report.

I think you are correct: it looks like the USB cases in nmake.esp32.mk do not set XSBUG_HOST and XSBUG_PORT. That should be straightforward to fix. I'll check with @mkellner about that.

@mkellner
Copy link
Collaborator

Hello @NextWorldLab, please try again.

@phoddie
Copy link
Collaborator

phoddie commented Aug 21, 2023

Just FYI – here's the relevant commit.

@NW-Lab
Copy link
Contributor Author

NW-Lab commented Aug 22, 2023

thank you.
Debugging is now available in the NodeRED MCU Plugin.
I will close.

In addition, although it is almost okay, it may not be possible to connect to xsbug in the first Build. Still, the second time (-t xsbug) is fine.
Even with the same code, the reproducibility is poor, so I will write it again in ISSUE when I understand the reproduction procedure.
I have experienced
example/helloworld is fine.
example/piu/balls I had a bad time and it doesn't reproduce.
example/piu/text is fine.

@NW-Lab NW-Lab closed this as completed Aug 22, 2023
@phoddie
Copy link
Collaborator

phoddie commented Aug 22, 2023

Debugging is now available in the NodeRED MCU Plugin.

Good news.

it may not be possible to connect to xsbug in the first Build. Still, the second time (-t xsbug) is fine.
so I will write it again in ISSUE when I understand the reproduction procedure.

That's strange. Please do report the details when you know more. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants