ExtFlashUploader is a bare-metal firmware running on STM32F103C8T6, designed to manipulate memory regions directly and upload application images from internal Flash to external W25Q64 SPI NOR Flash.
It also generates a metadata table (valid flag, address, size, CRC32) which is later used by the Bootloader for program validation and vector table relocation.
This project demonstrates low-level memory management, Flash programming sequence, and system integration in embedded environments — making it a showcase for both firmware engineering and bootloader design.
- Direct memory access: Reads application image directly from STM32 internal Flash (
0x0800xxxx
) via memory-mapped addresses - External Flash programming: Erase (4KB sector) + Page Program (256 bytes) to W25Q64
- Hardware CRC32: Utilizes STM32 CRC peripheral for data integrity check
- Metadata management: Writes metadata structure into sector0 of external Flash for Bootloader reference
- Multi-repo support: Store multiple application images with independent metadata entries
- Optional OLED display: Shows status (
Done
) for user confirmation
- MCU: STM32F103C8T6 (ARM Cortex-M3)
- External Flash: W25Q64 (64Mbit(8MB) SPI NOR Flash)
- OLED Display (I2C, optional for status output)
- Interfaces:
- SPI1 for W25Q64 access
- GPIO/I2C for OLED
Field | Size | Description |
---|---|---|
ValidFlag | 4 Bytes | Constant 0xA5A5A5A5 = valid entry |
Address | 4 Bytes | Start address in external Flash |
Size | 4 Bytes | Program size (bytes) |
CRC32 | 4 Bytes | Integrity check (STM32 hardware CRC32 result) |
Example (Hex Dump):
----------------------------------------------------------
| Repo | ValidFlag | Address | Size | CRC32 |
----------------------------------------------------------
| 1 | A5A5A5A5 | 0x001000 | 0x00023C | 0x5E3B9A7C |
| 2 | A5A5A5A5 | 0x005000 | 0x0001E0 | 0x4D92ABF1 |
----------------------------------------------------------
ExtFlashUploader prepares external Flash with:
- Application image(s) written at fixed addresses
- Metadata table at sector0 for validation
The Bootloader then:
- Reads metadata entries
- Verifies CRC32
- Relocates vector table
- Jumps to the selected application (Repo1, Repo2, etc.)
Address Range | Size | Usage |
---|---|---|
0x000000 ~ 0x000FFF |
4 KB | Sector 0 – Metadata Table |
0x001000 ~ ... |
Application Images (Repo1, Repo2, ...) | |
... ~ 0x7FFFFF |
~8 MB | Remaining space for image storage |
-
Metadata Table (Sector 0)
Stores multiple entries, each describing one application image:ValidFlag
(0xA5A5A5A5)Address
(image start in external Flash)Size
(image size in bytes)CRC32
(integrity check)
-
Application Images
Each repo is placed in the Flash starting from0x001000
, aligned to sector boundaries (4 KB).
Example:- Repo1 @
0x001000
- Repo2 @
0x005000
- Repo3 ... etc.
- Repo1 @
- Flash ExtFlashUploader into STM32F103 using Keil or STM32CubeProgrammer.
- On reset, the firmware automatically:
- Reads the specified memory region in internal Flash (application image).
- Performs sector erase on the target region of external Flash.
- Executes page programming (256 bytes per write) into W25Q64.
- Calculates CRC32 checksum via STM32 CRC peripheral.
- Stores metadata structure in external Flash sector0.
- OLED (if connected) shows
Done
upon success. - Bootloader then validates metadata, checks CRC, and jumps to the selected repo.
This project emphasizes low-level firmware engineering skills highly relevant to embedded R&D roles:
- Direct manipulation of memory-mapped regions in internal Flash
- Implementation of Flash programming protocol (Erase / Program / CRC)
- Handling metadata structures for multi-image bootloader systems
- Integration with Bootloader for image validation and jump execution
- Demonstrates system-level thinking: from binary image handling to runtime execution flow