IDF veteran need some help with custom mp firmware under WSL Ubuntu

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
User avatar
liudr
Posts: 211
Joined: Tue Oct 17, 2017 5:18 am

IDF veteran need some help with custom mp firmware under WSL Ubuntu

Post by liudr » Wed May 04, 2022 3:09 am

I've been thinking about compiling my mp firmware for a while but only got started yesterday. I've just installed WSL Ubuntu and the toolchains for building the micropython firmware for ESP32. Compiling generic and generic_spiram both completed but I have a few issues:

1) I see no /dev/ttyUSB0 under WSL Ubuntu prompt. I have confirmed that the dev board is working. I flashed it with mp 1.18 using thonny and closed thonny before listing /dev/tty* and there are some ttyS0 ttyS1 etc but I tried opening them with screen command and couldn't open them.

2) I don't know how to locate the compiled firmware from windows and copy it to my windows folders. I think it is here:
C:\Users\user\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState but it is named ext4.vhdx. I don't want to mess with this virtual volume in case I corrupt it. So how do I get the compiled firmware out of WSL Ubuntu?

3) I wanted to add wiznet W5100 support. I saw some lengthy discussions of a pull request but I don't know how to include it in the build. I read through the configs of GENERIC and GENERIC_SPIRAM. There are a few large chunks of features in the .cmake file in the boards folder:

Code: Select all

set(SDKCONFIG_DEFAULTS
    boards/sdkconfig.base
    boards/sdkconfig.ble
    boards/sdkconfig.spiram
    boards/GENERIC_SPIRAM/sdkconfig.board
)
This is IDF stuff. I bet micropython has some specific IDF switches in the .ble and .spiram files. I was looking for wiznet support and how to add it to the firmware.

4) Last one. I want to have a larger file system since I'm using either 8MB or 16MB FLASH modules on my board. I see in sdkconfig.base that these options are defined:

Code: Select all

CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
I used to use IDF 3 and then 4 a lot so I know where these are coming from. I see there's a partitions-8MiB.csv that has a 6MB file system. I know that I can just change the CONFIG_PARTITION_TABLE_CUSTOM_FILENAME line of the .base but is there a micropythonic way to use this 8MB partition file? Also if I do use it, what about the initial content of this partition? Is it empty or does it have an empty boot.py in it?

User avatar
liudr
Posts: 211
Joined: Tue Oct 17, 2017 5:18 am

Re: IDF veteran need some help with custom mp firmware under WSL Ubuntu

Post by liudr » Wed May 04, 2022 4:55 am

OK 2) how to locate compiled firmware. I found this reference so I can access my windows drives and folders from within WSL and copy the firmware to windows folders:

https://solidstudio.io/blog/windows-sub ... -explained

Under "How to access Windows files from WSL?".

To access wsl folder from windows, use this: \\wsl$\Ubuntu\home\[user]
It's also in the same reference. Apparently things change so frequently the reference is no longer accurate. It's Ubuntu and not Ubuntu-[version] anymore.

stijn
Posts: 735
Joined: Thu Apr 24, 2014 9:13 am

Re: IDF veteran need some help with custom mp firmware under WSL Ubuntu

Post by stijn » Wed May 04, 2022 6:01 am

3) To get code from a pull request you can add a git alias to your ~/.gitconfig like

Code: Select all

[alias]
  fetchpr = !sh -c 'git fetch upstream pull/'$1'/head:pr/'$1''
then use 'git fetchpr 8000` to create a new branch pr/8000 with the code from PR #8000 of upstream, assuming 'upstream' points to the main micropython repository. Then usually rebase that on top of master (PR might be old). More here: https://stackoverflow.com/questions/275 ... t-with-git

Post Reply