• I have accumulated lot of cheap stuff based on STMF103C8T6 chip. Before pandemic, these were typically for < 2 USD on Aliexpress/Ebay including shipping.

    They typically have 20KB RAM, 128KB Flash and USB. Some board files are still in https://github.com/espruino/Espruino/tre­e/UNMAINTAINED_BOARDS/boards

    Wanted to check whether current code still fits and how usable they are with Espruino now. Main reason was to have something to experiment with STLINK V2 dongle (see e.g. https://hackaday.io/project/162597-st-li­nk-clone-repurposing) as I wanted to port something to it so wanted to get familiar quickly with the hardware.

    I started with minimal SAVE_ON_FLASH configuration (only 128KB of Flash!) and then managed to add

    • Flash and Storage modules (including Storage.compact() and getFree())
    • tab completion
    • native calls - Inline C, compiled JS
    • loading modules from storage require("xx")
    • arrow functions (for Espruino IDE storage browsing/uploads)

    while still having 11KB flash free for persistent storage. So overall surprising success. With 20K RAM there is also ~1000 variables.

    So now I have very compact USB stick Espruino device with pin header with up to six GPIOs that can do HW UART (including console if usb is not plugged in), software SPI and I2C and other stuff. Tried e.g. to backup SPI flash (photo here https://i.ibb.co/fG3wRJf/IMG-20211119-01­2644.jpg ) and it was pretty easy to do. I can also load native C code quickly to test this platform.

    The only catch is that there is no bootloader so update is needed via SWD, but when bringing SWD pins outside, which is easy to do, reprogramming is easy and I have two more GPIOs (A13,A14) as SWD functionality can be turned off at runtime via one poke32 call. Also I am thinking about building some "bootloader" and upload it to storage (or RAM) temporarily to update it via USB or serial.

    Some photos, board file and binary build is here
    https://github.com/fanoush/EspruinoBoard­s/tree/master/STLINKV2

About

Avatar for fanoush @fanoush started