Embedded Security Basics: Secure Boot, Debug Locking and Key Storage

An embedded device sits in the hands of whoever owns it, including people who want to copy it, modify it or use it to reach your servers. Encryption on the network link does little if the firmware can be read out of the chip or replaced with a modified copy. This article covers three foundations of device security: verifying what boots, closing the debug port and keeping keys where they cannot be read.

At a glance

ROM
Secure boot starts in boot code that cannot be rewritten, so the first check cannot be bypassed.
SWD / JTAG
Debug ports that can read and write all memory unless they are locked in production.
Per-device
Unique keys per unit mean one extracted key compromises one device, not the fleet.
OTP
One-time programmable fuses hold key hashes and lock settings that cannot be reversed.

The problem

A production board shipped with its debug port open lets anyone with a low-cost probe dump the firmware, read stored credentials and load their own code. Locking it is usually one configuration step, often missed because development needs the port open.

Shared secrets are the other common failure. When every unit carries the same key or password, extracting it from one device opens every device and often the cloud service behind them.

Security that depends on nobody opening the enclosure is not security. Design as if the attacker has the board on their bench.

The chain of trust

Secure boot works in stages. Immutable boot code verifies the signature of the first-stage bootloader against a public key, or a hash of one, held in one-time programmable memory. That bootloader verifies the next stage in the same way, up to the application. The device holds only public keys for this; the private signing key never leaves your build infrastructure.

Each link has to be enforced, not just checked. If a failed verification merely logs a warning and continues, or if the debug port can rewrite the bootloader, the chain is broken.

What good looks like

List what an attacker with physical access could gain: firmware, credentials, code execution or a route to your servers.

Enable secure boot from immutable code, provision unique keys per device in production, and keep private signing keys in protected infrastructure.

Lock the debug port as part of the production programming step and verify the lock on every unit at end-of-line test.

Where keys can be stored
LocationProtects againstNotes
Internal flash, unprotectedNothingReadable through debug or a firmware dump
Flash with read-out protectionReadout over the debug portStrength varies by part and lock level
OTP or eFuseModification after programmingSuits key hashes and lock settings
TrustZone secure worldAccess from non-secure codeNeeds a core with TrustZone, such as many Cortex-M33 parts
Secure elementSoftware and many physical attacksSeparate chip; keys never leave it
Typical protection levels. What each option resists depends on the specific part and its threat model.

A secure boot chain

  1. Boot ROM: Immutable code runs first
  2. Check key: Public key matches hash in OTP
  3. Bootloader: Signature verified, then runs
  4. Application: Verified by the bootloader
  5. Debug locked: No path around the chain
Each stage verifies the next before handing over. A failure stops the boot.

What it changes

Firmware Integrity

Only images you signed will run on the device.

IP Protection

Locked debug and read-out protection make copying the firmware far harder.

Contained Breaches

A key taken from one unit does not unlock the rest of the fleet.

Buyer Confidence

A clear security design answers the questions customers and regulators increasingly ask.

Where to go next

Decide how authorised service access will work after locking, such as authenticated debug where the part supports it, before locking the first unit.

Check permanent options carefully. Some lock levels cannot be undone, and a mistake in the provisioning script can leave units impossible to reprogram.

Problems this prevents

  • Debug ports left open on shipped units
  • One key or password shared across every device
  • Private signing keys stored on the device
  • Secure boot that warns but still boots

Discuss your project

Email support@aavico.com or use Get in Touch when the website finishes loading.