Embedded HandbookApps
All sections › 0. About the handbook
STM32F103, STM32F407 · level intermediate · 6 min read
Open in the interactive handbook

0в. Topic routes: from prototype to product

The prototype works on the desk — and then it turns out that a device you can give away or sell is still half the way off. The program must survive interference and its own errors, the image must reach the device and not be replaced, the board must be assembled at the factory and pass the in-line test, and the product must get its documents and conformity assessment. All of this is in the handbook, but spread across seven parts.

Route E: from prototype to product gathers these sections into one order — fourteen steps from the map of stages to certification. The rules are the same as for the beginner's route (0а.1) and route D (0б.1): one step is one section or a pair of sections, and from each you take away the "What to take away" column.

Prerequisites: the beginner's route (0а) or route A (0.3) — a device that already works; section 0 — levels and boards (0.1, 0.2).

Terms used in the documentation

Term Meaning
first article the first unit from a production run: it is checked before the batch is started
release candidate a build proposed for release
field failure a failure at the user's site, in the field
product lifecycle the life cycle of a product

0в.1 How to follow route E

The route goes in the order in which questions come up for a product: first a program that survives a failure (steps 2–5), then the path of the image from the build to the device (6–9), then the board at the factory (10–11) and the product itself — robustness, documents, conformity (12–14).

The first step is the map: section 79 shows the whole path at once, the other steps are its stages in close-up. The route level is basic → advanced: step 1 is basic, the advanced ones are 36в, 48 and 48а, 11в.


0в.2 Route E: from prototype to product

Route level: basic → advanced. Fourteen steps: a program that survives a failure, the path of the image to the device, the board at the factory and the product as a whole.

Step Section What to take away What to skip for now
1 79 the stages form a loop, and an error costs more the later it is found; a requirement is measurable; from day one the program is written as for series production 79.9 the team
2 12 the IWDG and WWDG watchdogs, how to recognize a watchdog reset; the hardware CRC 12.6 RTC
3 36в you catch not the interference itself but its consequences; a trap in free Flash memory, no empty vectors, program flow monitoring 36в.5 redundant storage of settings — on a second pass
4 35в a fault record in an area that startup does not zero survives a reset; analysis on the computer using the ELF 35в.6 what the record survives and what it does not
5 184 three levels of tests and what each one catches; a module that is tested without a board; what to keep in the pipeline 184.5–184.6: mutations, sanitizers and random inputs
6 110, 110а building in a container, the version from the history, a red build stops the release; the size delta on every change 110.5 a matrix of two boards
7 48, 48а your own bootloader: layout, header, image check; a signature protects against substitution, the device holds only the public key 48.10 over-the-air update
8 11в what readout protection promises and what it does not give on F1; what each level gives on F1, F4 and U5 11в.4 checking on a core model
9 201а the version from a git tag, metadata at a fixed place in Flash memory, the CRC computed by the release script, one file for the line 201а.4 reproducible build
10 199, 200 what the factory wants from you: the BOM, the pick-and-place file, Gerbers; bringing up the board in order — inspection, continuity check, current-limited power, SWD 199.6 panelization
11 201 the in-line test answers "is the board assembled", not "is the code correct"; a bed of nails, flashing from a script, the serial number, configuration bytes 201.3 calculating the flashing time
12 203, 204 EMC: you make noise yourself — and you get jammed, a check in the workshop; reliability: what ages first, margins, in-house testing 204.1 reliability in numbers
13 205, 205б the documentation set, board revisions and the firmware version, the change log; licences of borrowed open-source code and the SBOM 205.3 designations
14 206 selling a device means conformity assessment; a radio module or your own radio; weed out errors at home before the lab 206.6 marking and documents after testing

Route E: fourteen steps in a zigzag — stages, the watchdog, interference-tolerant firmware, the fault snapshot, tests, the pipeline, the bootloader and signing, readout protection, the release, the factory and first power-up, the in-line test, EMC and reliability, documents, certification — and eight forks; the block colour is the level of the hardest section in it

The order rests on one thing: every step builds on the previous one. The fault snapshot (4) is written by a handler that the program reaches thanks to the traps (3); the pipeline (6) runs the tests (5); the release (9) puts a header into the image that the bootloader checks (7); the in-line test (11) flashes the release file (9) and sets readout protection (8).


0в.3 What you need on the desk


0в.4 Where next: forks after route E


0в.5 Pitfalls

Thinking about series production after the prototype. A program "as for series production" starts on day one, not after the prototype has started working (79.5): a watchdog, an image check and a version cost more to build into code that did not know about them.

Signing the image and not comparing the version. An honestly signed old image passes the signature check; only a version comparison after the signature check saves you from a rollback to it (48а.2).

Taking F1 readout protection for firmware protection. On F1 the first level is protection against casual copying, not against a targeted attack (11в.8).

Building the release on your own machine. A commit after the tag or a change without a commit means a rejected release (201а.6); the release is built by the pipeline (110).

Powering a new board without current limiting. The first power-up is from a supply with a current limit (200.3): a defect then heats up by milliwatts instead of burning out.


0в.6 Summary


Next: section 0г "Topic routes: a device on an RTOS — architecture and observability" — the third topic route: how to build a device out of FreeRTOS tasks and how to see what is happening inside it.

Open in the interactive handbook