ESP32 ROM Basic image/source?

User avatar
mvzxa5ltmvzdc
Posts: 5
Joined: Wed Feb 12, 2025 9:35 pm

ESP32 ROM Basic image/source?

Postby mvzxa5ltmvzdc » Sat Feb 22, 2025 4:21 pm

It is somewhat well known that the ESP32 ROM comes with a version of the language Basic that could be activated by inhibiting reads from the SPI flash. However, as this post on this forum states, the eFuse required for the interpreter has been permanently disabled on all ESPs produced after a certain date, and for people who don't have one of the chips produced before that, the Basic interpreter included in ROM cannot be used in any way, even by executing the code itself, since it actively checks whether the CONSOLE_DEBUG_DISABLE eFuse is burned.

Is there any image (for flashing onto ESP32 chips) available that emulates the Basic interpreter included in ROM?
If that isn't the case, is the source code for the ROM Basic available to the public, or, since the ROM Basic is based on TinyBasic Plus, which is open source, are the modifications made to that version available?
I'd be grateful for any response!

Sprite
Espressif staff
Espressif staff
Posts: 10650
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 ROM Basic image/source?

Postby Sprite » Sun Feb 23, 2025 5:39 am

I could probably dig that up, but honestly, it was mostly just TinyBasic with some added commands for input/output and iirc hex support. Any specific reason you want to play with it?

MicroController
Posts: 2705
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: ESP32 ROM Basic image/source?

Postby MicroController » Sun Feb 23, 2025 7:41 am

At some point in the early 21st century, BASIC was renamed and is now called "Python". You may want to give it a try.

boarchuz
Posts: 657
Joined: Tue Aug 21, 2018 5:28 am

Re: ESP32 ROM Basic image/source?

Postby boarchuz » Sun Feb 23, 2025 12:36 pm

This piqued my interest so I made a patched BASIC initialiser: https://github.com/boarchuz/esp32_rom_tinybasic_patch

There is also a little (208 bytes!) prebuilt binary included that you can write to 0x1000 to boot straight into the BASIC interpreter.

Sprite
Espressif staff
Espressif staff
Posts: 10650
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 ROM Basic image/source?

Postby Sprite » Mon Feb 24, 2025 2:08 am

Oh no, you broke my super-secret encryption key! In case you were wondering why the BASIC interpreter only lives in ROM in an obfuscated form, it was because I was worried about bootrom-exploits that used the BASIC interpreter as a springboard. Given the fact that after so many years I've never seen one, I guess the obfuscation worked.

boarchuz
Posts: 657
Joined: Tue Aug 21, 2018 5:28 am

Re: ESP32 ROM Basic image/source?

Postby boarchuz » Mon Feb 24, 2025 3:09 am

Oh I didn't know that was your handiwork, Sprite!

For my future reference, is there any issue with publicly sharing code like this based on decompiled ROM? (assuming no obvious security implications)

User avatar
mvzxa5ltmvzdc
Posts: 5
Joined: Wed Feb 12, 2025 9:35 pm

Re: ESP32 ROM Basic image/source?

Postby mvzxa5ltmvzdc » Mon Feb 24, 2025 3:43 pm

This piqued my interest so I made a patched BASIC initialiser: https://github.com/boarchuz/esp32_rom_tinybasic_patch

There is also a little (208 bytes!) prebuilt binary included that you can write to 0x1000 to boot straight into the BASIC interpreter.
It works on my chip, thank you for this!

User avatar
rudi ;-)
Posts: 1759
Joined: Fri Nov 13, 2015 3:25 pm

Re: ESP32 ROM Basic image/source?

Postby rudi ;-) » Mon Feb 24, 2025 3:46 pm

..I guess the obfuscation worked.
:mrgreen:

" this patch will modify the efuse check in memory to re-enable access "

There is always something to do and discover. Good work @boarchuz , good work! :D
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Sprite
Espressif staff
Espressif staff
Posts: 10650
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 ROM Basic image/source?

Postby Sprite » Tue Feb 25, 2025 2:37 am

Oh I didn't know that was your handiwork, Sprite!

For my future reference, is there any issue with publicly sharing code like this based on decompiled ROM? (assuming no obvious security implications)
I can't vouch for the legal implications (I'm not a, your, or Espressifs lawyer) but I doubt anyone cares about an easter egg that's about a decade old, especially since we also freely distribute the ROM images as an elf file in ESP-IDF.

Who is online

Users browsing this forum: Semrush [Bot] and 0 guests