Page 1 of 1
Building micropython with 240mhz
Posted: Wed Jun 22, 2022 8:08 pm
by leosok
Hi,
I use a own build, to freeze my modules into the firmware. I copied GENERIC and changed appropriately, and my firmware builds and works. (Using the Boardname)
Code: Select all
---mpconfigboard.h---
#define MICROPY_HW_BOARD_NAME "ESP32 TTGO T-Display"
#define MICROPY_HW_MCU_NAME "ESP32"
Unfortunately this builds the standard 160mhz. I want to build with 240mhz.
So I added "boards/sdkconfig.240mhz" to "mpconfigboard.cmake". Unfortunatly the firmware is still 160mhz. How to fix this?
Code: Select all
set(SDKCONFIG_DEFAULTS
boards/sdkconfig.base
boards/sdkconfig.240mhz
boards/sdkconfig.ble
)
if(NOT MICROPY_FROZEN_MANIFEST)
set(MICROPY_FROZEN_MANIFEST ${MICROPY_PORT_DIR}/boards/manifest.py)
endif()
Re: Building micropython with 240mhz
Posted: Wed Jun 22, 2022 9:27 pm
by scruss
Is it a problem to put the following in boot.py?
Code: Select all
import machine
machine.freq(240000000)
Re: Building micropython with 240mhz
Posted: Wed Jun 22, 2022 10:28 pm
by leosok
Not really, and I did it. But compared to a "stock" build with 240mhz I still lose some time, because everything loaded before boot.py is worked on with 160mhz. I could even put it in _boot.py (which will be frozen).
Mostly I want to know how to do it "right". There must be a reason, why there is a "boards/sdkconfig.240mhz" file
.
Re: Building micropython with 240mhz
Posted: Thu Jun 23, 2022 3:56 am
by jimmo
leosok wrote: ↑Wed Jun 22, 2022 8:08 pm
So I added "boards/sdkconfig.240mhz" to "mpconfigboard.cmake". Unfortunatly the firmware is still 160mhz. How to fix this?
This works on the UM_TINYPICO - just checked here. Did you do a `make clean` after changing mpconfigboard.cmake?
leosok wrote: ↑Wed Jun 22, 2022 10:28 pm
everything loaded before boot.py is worked on with 160mhz.
There shouldn't be very much that happens before boot.py that this would make a significant difference. But yeah, what you're doing with sdkconfig.240mhz is the correct way to solve this.
After a build, can you do
Code: Select all
$ cat build-$YOUR_BOARD/sdkconfig.combined | grep CONFIG_ESP32_DEFAULT_CPU_FREQ
[code]
and see that it's getting included into sdkconfig.combined?
Re: Building micropython with 240mhz
Posted: Thu Jun 23, 2022 12:16 pm
by leosok
I think the problem is actually my build-directions. I'm doing it all with a bash-script running inside a docker, which has all the build-setup.
Code: Select all
# Build command is here:
cd /mpbuilder/micropython_src/ports/esp32
idf.py -D MICROPY_BOARD="$MICROPY_BOARD" -D USER_C_MODULES=/mpbuilder/st7789_mpy/st7789/micropython.cmake build
It seems the MICROPY_BOARD env is enough to produce the right "Tag" but not to actually use the files inside the "/build/boards/ESP32_TTGO_T_DISPLAY" directory.
Can you please tell me the build commands you used, to build UM_TINYPICO? Because there is no "build-$YOUR_BOARD/sdkconfig.combined" for me, I think it's just building the GENERIC board to "build" directory.
Re: Building micropython with 240mhz
Posted: Thu Jun 23, 2022 12:22 pm
by jimmo
leosok wrote: ↑Thu Jun 23, 2022 12:16 pm
Can you please tell me the build commands you used, to build UM_TINYPICO? Because there is no "build-$YOUR_BOARD/sdkconfig.combined" for me, I think it's just building the GENERIC board to "build" directory.
I use the Makefile, so
which is equivalent to
Code: Select all
idf.py -D MICROPY_BOARD=UM_TINYPICO -B build-UM_TINYPICO build
How are you building your final .bin file? Do you also pass the sdkconfig to makeimg.py (like the Makefile does).
Re: Building micropython with 240mhz
Posted: Thu Jun 23, 2022 12:31 pm
by leosok
I do. I seem to be using the "GENERIC" though. But makeimg.py is only combining the bin-files from what I understand?!
Code: Select all
BUILD_DIR="/mpbuilder/micropython_src/ports/esp32/build"
# build the firmware
python3 makeimg.py \
$BUILD_DIR/sdkconfig \
$BUILD_DIR/bootloader/bootloader.bin \
$BUILD_DIR/partition_table/partition-table.bin \
$BUILD_DIR/micropython.bin \
$BUILD_DIR/firmware.bin
I believe I did not use the makefile, because I need to add the USER_C_MODULES=/mpbuilder/st7789_mpy/st7789/micropython.cmake
Re: Building micropython with 240mhz
Posted: Thu Jun 23, 2022 1:51 pm
by jimmo
leosok wrote: ↑Thu Jun 23, 2022 12:31 pm
because I need to add the USER_C_MODULES=/mpbuilder/st7789_mpy/st7789/micropython.cmake
The Makefile also accepts the USER_C_MODULES argument.
Re: Building micropython with 240mhz
Posted: Thu Jun 23, 2022 2:50 pm
by leosok
Thanks! I will try this once I'm back home (in a week)
Re: Building micropython with 240mhz
Posted: Tue Jul 05, 2022 10:49 pm
by leosok
Hi jimmo,
happy to let you know that I built the firmware using
and it worked!