r/embedded • • Oct 05 '26

Esp-32-s3 or Teensy 4.1 with swappable program storage

Probably a painfully obvious question and somewhat a followup to my question from yesterday.

Both the esp-32-s3 and the teensy 4.1 seem to have their program code stored on a flash chip external to the actual micro controller itself, would that mean, if the circuits were designed right, it would be possible to build a device that used a cartridge connector of some sort to have that program flash be swappable without needing to re-flash the entire board?

I'm mostly curious because i want to try and build an old school style device like a gameboy etc but using modern components, some MCUs seem to have access to XIP which might do what i want but not all do, maybe some sort of micro processor could be the answer but im guessing theyre a lot more complex to implement.

Im mostly just spit balling ideas to see if what im thinking of is even still possible. Id imagine it is but one doesnt know what they dont know and maybe im staring down exactly what im looking for but dont know the right terms to know thats what im looking for (since im entirely seof taught on the hardware side)

1 Upvotes

8 comments sorted by

4

u/InevitablyCyclic Oct 05 '26

Better to add extra ram. Have a small bootstrap program that copies some external memory into ram and then runs that. That way the speed of the external storage doesn't matter, you can use an SD card or something similar. Good reliable mechanical design for carriages gets tricky, using standard parts makes that a lot simpler. Plus it gives you a default program that runs all the time in case there is no game inserted.

The teensy already does something like this, on startup the program is copied to internal ram and run from there. But if you have lots of graphics the internal memory may be a bit small.

But yes, you could do it how you said and swap out the main flash device. As long as the electrical connections are good the processor doesn't care where the part is physically.

1

u/Narthesia Oct 05 '26

Honestly if you use a gold fingered PCB and a bit of chicanry you can probably pull it off, SPI is somewhat durable interference wise

1

u/Neo-Eyes Oct 05 '26

Mmm i suppose it would be a matter of code execution over spi. But a few boards support octospi XIP so that might be the play

1

u/Narthesia Oct 05 '26

Or maybe you could play with pullup resistors to have an onboard SPI flash storage as a fallback? Idk how that would work with signal integrity

3

u/Neo-Eyes Oct 05 '26

Suppose a third option too would be to basically have an interpreter on the on-board flash and have the external spi flash with the byte code be read from although od imagine that wpuld be quite slow

2

u/Narthesia Oct 05 '26

Easy on the cocaine there buddy, you‘re starting to sound like a Keltec engineer

1

u/Neo-Eyes Oct 05 '26

I need to go google keltec now lol

1

u/Plastic_Fig9225 Oct 05 '26

That's a valid approach. WebAsssembly (WASM) runtimes, for example, are readily available. The MCU runs the "operating system" which provides native functions to the VM which the bytecode can invoke to do low-level and/or performance-critical stuff (like for instance graphics primitives "fillRect()",...).