mongoose-os / mos

The Mongoose OS Command Line Tool - https://mongoose-os.com/docs/mongoose-os/quickstart/setup.md
Other
45 stars 31 forks source link

ESP32-S3 bootloader stub #72

Closed duncandrennan closed 2 years ago

duncandrennan commented 2 years ago
duncandrennan commented 2 years ago
rojer commented 2 years ago

i've made the C3 stub work and cleaned up some stuff in the process. please rebase over latest master.

duncandrennan commented 2 years ago

Working on this to align it with what you've done

duncandrennan commented 2 years ago

I don't quite follow your EFUSE system in esp32c3.go. You have

const (
    EFUSE_BASE = 0x60008800
)

func GetChipDescr(rr esp.RegReader) (string, error) {
    block1_word3, err := rr.ReadReg(EFUSE_BASE + 0x44 + (3 * 4))

but when I look at the technical manual it has EFUSE base as 0x6001_A000, and I don't really follow the 0x44 + (3 * 4). I see from the IDF that,

WAFER_VERSION,                        EFUSE_BLK1,  114,    3,     WAFER version 0:A
PKG_VERSION,                          EFUSE_BLK1,  117,    3,     Package version

With each efuse block being 256 bits (32 bytes, 8 32-bit words), I'm not making the connection to the 0x44 and (3 * 4)

The -S3 has the PGK_VERSION in the same location within the efuse as the -C3, but the base address is different. Could you please clarify as I'd like to get this correct for the -S3.

duncandrennan commented 2 years ago

Ok, I get it now. soc.h has the base address (which for the -C3 differs from the technical manual), and I understand the 0x44 + (3 * 4)

duncandrennan commented 2 years ago

I've rebased and tested that it works to read/write flash for both the -S3 and the -C3. I did have to rebuild the 4.4.1-r2 docker image to make it work (the one on docker hub doesn't have the -S3 files in it)

rojer commented 2 years ago

re: efuse address - tbh, i drew my inspiration from esptool.py directly, and masterfully borrowed the formula it is using :)

ok, this looks good. we should probably dedup uart.c as it's a copy-paste job across 3 platforms, but this can be done later. thanks for this!

rojer commented 2 years ago

I did have to rebuild the 4.4.1-r2 docker image to make it work (the one on docker hub doesn't have the -S3 files in it)

i built and pushed 4.4.1-r2. i'm not updating sdk.version yet, will do along with basic C3 support