Boot Straps, eFUSE Selection, and Internal OCRAM
Start from the reset-edge physics of boot-strap D-latches and irreversible eFUSE overrides, decode SRC_SBMR1 and SRC_SBMR2 bitfields, and partition pre-DDR 128 KiB internal OCRAM without trampling active Boot ROM workspace.
What you'll learn
- Decode all BOOT_MODE values without treating a reserved value as a recovery mode.
- Distinguish strap-selected media policy from fuse-selected policy.
- Place pre-DDR work in an explicitly reserved OCRAM region rather than uninitialized external RAM.
What Happens Electrically on Reset Before Any User Instruction Exists
When power stabilizes on an i.MX6ULL board and the external power-on-reset pin (POR_B) rises from 0 V to 3.3 V, your bare-metal start.S and main() are not running yet—external DDR3 is unclocked, UART1 is dark, and the ARM Cortex-A7 core fetches its very first instruction from mask-programmed on-chip Boot ROM at 0x00000000. How does fixed silicon ROM know whether to boot from an SD card, an eMMC chip, QSPI NOR, NAND, or wait on USB_OTG1 for host recovery?
As Figure 4.1a illustrates, the i.MX6ULL System Reset Controller (SRC, 0x020D8000) wires 26 dual-purpose package balls—BOOT_MODE0..1 plus LCD_DATA00..23 (BOOT_CFG1/2/4)—into edge-triggered hardware capture latches clocked by the rising edge of POR_B. On the carrier board, weak bias resistors (typically 10 kOhm pull-ups and 47 kOhm pull-downs) and DIP switches establish a clean 0 V or 3.3 V DC voltage on each strap ball while reset is held low. At the exact nanosecond POR_B deasserts, SRC snapshots those voltages into read-only status registers SRC_SBMR1 (0x020D8004) and SRC_SBMR2 (0x020D801C). Two immediate hardware laws follow from this circuit:
- Post-reset pin reuse is safe, but reset-time load contention is fatal: Once
POR_Brises, firmware can freely re-muxLCD_DATA00..23to drive an RGB panel without altering the already-latchedSRC_SBMR1flip-flops. Conversely, soldering an unbuffered1 kOhmexternal pull-up or active sensor output onto anLCD_DATAtrace overpowers the47 kOhmboard strap duringPOR_B, latching the wrong boot medium before your code ever executes! - Moving a DIP switch while power stays on does nothing: Flipping
BOOT_MODEswitches changes live pad voltage, notSRC_SBMR2. Only asserting a freshPOR_Breset re-clocks the capture latches. Furthermore, persistent one-time-programmable eFUSEs (BT_FUSE_SEL) can override pin straps permanently—never burn eFUSEs on a bring-up board!
Figure 4.1a. POR_B rising-edge strap capture circuit (top) and the four BMOD[1:0] Boot ROM selection paths governed by BT_FUSE_SEL (bottom).
mental model: Reset-time boot selection works like an automated rail-yard switch tower that photographs a train's routing placard at the exact instant it crosses the entry sensor (POR_B): repainting the placard down the track (IOMUXC reuse or live DIP flips) never reroutes the train already on the spur.
Where it stops working: Unlike a mechanical rail placard, Boot ROM routing is also governed by permanent silicon eFUSE bits and active ROM workspace reservations inside that remain live until handoff completes.
definition (System Reset Controller Boot Mode Registers (SRC_SBMR1/2) & Internal OCRAM): At POR_B deassertion, SRC_SBMR2 (0x020D801C) latches BMOD[1:0] in bits [25:24] (00 Boot From Fuses, 01 Serial Downloader SDP, 10 Internal Boot, 11 Reserved) and reflects eFUSE override state in BT_FUSE_SEL (bit 4), while SRC_SBMR1 (0x020D8004) latches BOOT_CFG1..4 strap bytes (LCD_DATA00..23). Note that Internal Boot (10) means ROM-directed boot flow (fetching from external SD, eMMC, NAND, or QSPI), not that the image is stored inside the ! Before external DDR3 is trained, internal On-Chip RAM (OCRAM) provides 128 KiB of static SRAM at [0x00900000, 0x00920000)—with low bytes reserved by the active Boot ROM itself.
Step through the four-stage reset-to-handoff pipeline below to connect pad sampling, policy selection, and OCRAM memory readiness:
- Step 1. Step 1: At POR_B rising edge, SRC latches BOOT_MODE[1:0] and LCD_DATA00..23 into read-only SBMR2 and SBMR1.
- Step 2. Step 2: ROM decodes BMOD[1:0] (00 Fuse, 01 SDP recovery, 10 Internal via straps or eFUSEs, 11 Reserved).
- Step 3. Step 3: Pre-DDR code executes only inside unreserved OCRAM [0x00907000, 0x00920000), sparing ROM workspace.
- Step 4. Step 4: ROM validates the boot image on the selected medium (or falls back to USB/UART SDP on failure).
Figure 4.1b. Separate reset-latched boot policy and ROM-reserved low OCRAM from post-boot GPIO/LCD pin behavior.
Decoding SRC_SBMR1/2 Bitfields & Partitioning 128 KiB Internal OCRAM
Inspect Figure 4.1b to map the exact 32-bit register slices and physical SRAM boundaries used during board bring-up. In SRC_SBMR2 (0x020D801C), BMOD[1:0] ([25:24]) selects the top-level ROM state: notably, BMOD == 01 (Serial Downloader) enters the binary USB_OTG1 / UART Serial Download Protocol (SDP) even if BT_FUSE_SEL (bit 4) is 1, giving engineers a non-destructive recovery path whenever an SD or eMMC image is corrupted. When BMOD == 10 (Internal Boot) and BT_FUSE_SEL == 0, the ROM consults SRC_SBMR1 (0x020D8004), where BOOT_CFG1[7:4] (SBMR1[7:4]) selects SD/eSD (010x), MMC/eMMC (011x), NAND (1xxx), QSPI (0001), or NOR/EIM.
Look equally closely at panel 3 of Figure 4.1b. Why can't a pre-DDR payload load straight into 0x80000000 (DDR3) or 0x00900000 (the first byte of OCRAM)? External DDR3 (0x80000000+) requires MMDC clock gating, pad drive calibration, and JEDEC initialization sequences before a single word can retain bits. Meanwhile, OCRAM ([0x00900000, 0x00920000), 128 KiB) consists of six-transistor static CMOS SRAM cells ready immediately at POR_B—but the Boot ROM itself is a C program that needs a stack, USB SDP descriptors, MMU translation tables, and HAB scratch RAM! Those ROM structures occupy [0x00900000, 0x00907000) (28 KiB), leaving the upper 100 KiB window [0x00907000, 0x00920000) (0x19000 bytes) safe for pre-DDR SPL code and stacks.
Figure 4.1b. Exact 32-bit bitfields of SRC_SBMR2 and SRC_SBMR1 alongside the 28 KiB ROM-reserved vs 100 KiB usable OCRAM split.
| Boot / Storage Mechanism | Register / Address Encoding | Reset-Time Precondition | Failure Boundary When Misapplied |
|---|---|---|---|
BMOD = 10, BT_FUSE_SEL = 0 | SBMR2[25:24] = 2, [4] = 0 | LCD_DATA strap pulls undisturbed at POR_B | Strong external load on LCD_DATA latches wrong medium |
BMOD = 01 (Serial Downloader) | SBMR2[25:24] = 1 (ignores [4]) | USB_OTG1 cable + host SDP loader (uuu) | Mistaken for an ASCII UART1 shell (ROM speaks binary SDP) |
Usable Pre-DDR OCRAM (100 KiB) | [0x00907000, 0x00920000) | Ready at t = 0 (0 DCD writes needed) | Loading at 0x00900000 clobbers active Boot ROM stack/state! |
External DDR3 (MMDC) | 0x80000000+ | Valid DCD table or OCRAM SPL training | Jumping to 0x87800000 uninitialized hangs or fetches garbage |
In boot_policy.c below, our freestanding ARMv7-A helper inspects SRC_SBMR2 strictly through a volatile const uint32_t * pointer—collecting diagnostic evidence of what POR_B latched without ever touching OCOTP fuse-programming registers.
learner@ksa:~/gl-e01/m04-l01$ bat -H 2 -H 3 -H 4 -H 5 -H 6 -H 9 boot_policy.c File: boot_policy.c #include <stdint.h> static volatile const uint32_t *const src_sbmr2 = (volatile const uint32_t *)(uintptr_t)0x020d801cU; unsigned sampled_boot_mode(void) { return (*src_sbmr2 >> 24) & 3U; } unsigned fuse_policy_selected(void) { return (*src_sbmr2 >> 4) & 1U; } /* Read-only inspection: no fuse programming and no boot-media writes. */- Qualify 0x020D801C as volatile const uint32_t * so hardware status reads are never optimized away and writes fail compilation.
- Extract BT_FUSE_SEL at bit 4 (not bit 0!) to distinguish fuse-governed internal boot from pin-strapped internal boot.
Proving SBMR1/SBMR2 Policy Decoding & Overflow-Safe OCRAM Bounds in C11
Before touching target hardware, sbmr_boot_decoder.c proves the complete Boot ROM decision tree and OCRAM allocation math in strict host ISO C11. Notice three defensive invariants in the code: (1) decode_sbmr2() routes BMOD == 1U to BP_USB_SERIAL even when BT_FUSE_SEL (0x10U) is set, while explicitly flagging BMOD == 3U as BP_RESERVED; (2) decode_sbmr1_dev() decodes the BOOT_CFG1[7:4] upper nibble into NAND, SD/eSD, MMC/eMMC, QSPI, or NOR/EIM; and (3) ocram_user_fits(addr, len) subtracts off = addr - base and checks len <= span - off so addr + len can never wrap 32-bit unsigned arithmetic!
learner@ksa:~/gl-e01/m04-l01$ bat -H 10 -H 11 -H 12 -H 13 -H 14 -H 15 -H 16 -H 17 -H 18 -H 19 -H 20 -H 21 -H 22 -H 24 -H 25 -H 26 -H 27 -H 28 -H 29 -H 30 -H 31 -H 34 -H 35 -H 36 -H 37 -H 38 -H 39 sbmr_boot_decoder.c File: sbmr_boot_decoder.c #include <assert.h> #include <stdbool.h> #include <stdint.h> #include <stdio.h> enum boot_path { BP_FUSE, BP_USB_SERIAL, BP_INT_STRAPS, BP_INT_FUSE, BP_RESERVED }; enum boot_dev { DEV_NONE, DEV_NOR_EIM, DEV_QSPI, DEV_SD_ESD, DEV_MMC_EMMC, DEV_NAND }; static enum boot_path decode_sbmr2(uint32_t sbmr2) { unsigned bmod = (sbmr2 >> 24) & 3U; bool bt_fuse_sel = ((sbmr2 >> 4) & 1U) != 0U; switch (bmod) { case 0U: return BP_FUSE; case 1U: return BP_USB_SERIAL; case 2U: return bt_fuse_sel ? BP_INT_FUSE : BP_INT_STRAPS; default: return BP_RESERVED; } } static enum boot_dev decode_sbmr1_dev(uint32_t sbmr1) { unsigned cfg1_hi = (sbmr1 >> 4) & 0x0fU; if ((cfg1_hi & 0x8U) != 0U) return DEV_NAND; if ((cfg1_hi & 0xeU) == 0x4U) return DEV_SD_ESD; if ((cfg1_hi & 0xeU) == 0x6U) return DEV_MMC_EMMC; return (cfg1_hi == 0x1U) ? DEV_QSPI : DEV_NOR_EIM; } static bool ocram_user_fits(uint32_t addr, uint32_t len) { const uint32_t base = 0x00907000U, span = 0x00019000U; /* [0x907000, 0x920000) */ if (len == 0U || addr < base) return false; uint32_t off = addr - base; return off <= span && len <= span - off; } int main(void) { assert(decode_sbmr2(0x00000000U) == BP_FUSE); assert(decode_sbmr2(0x01000010U) == BP_USB_SERIAL); assert(decode_sbmr2(0x02000000U) == BP_INT_STRAPS); assert(decode_sbmr2(0x02000010U) == BP_INT_FUSE); assert(decode_sbmr2(0x03000000U) == BP_RESERVED); assert(decode_sbmr1_dev(0x00000040U) == DEV_SD_ESD); assert(decode_sbmr1_dev(0x00000060U) == DEV_MMC_EMMC); assert(decode_sbmr1_dev(0x00000080U) == DEV_NAND); assert(!ocram_user_fits(0x00900000U, 0x1000U)); /* overlaps ROM workspace */ assert(ocram_user_fits(0x00907000U, 0x19000U)); assert(!ocram_user_fits(0x0091ffffU, 2U)); printf("SBMR2=0x02000000->INT_STRAPS SBMR1=0x40->SD_ESD OCRAM_free=100KiB\n"); return 0; }- Decode BMOD[1:0] (SBMR2[25:24]) and BT_FUSE_SEL (SBMR2[4]), explicitly rejecting reserved BMOD == 3.
- Classify BOOT_CFG1[7:4] (SBMR1[7:4]) into SD/eSD, MMC/eMMC, NAND, QSPI, or NOR/EIM when straps drive internal boot.
- Reject pre-DDR placements inside the [0x00900000, 0x00907000) Boot ROM workspace as well as overflows past 0x00920000.
Running the Host Policy Verifier & Freestanding Cortex-A7 Object Check
Compile and execute sbmr_boot_decoder.c on the workstation, then cross-compile boot_policy.c with clang --target=armv7a-none-eabi to verify freestanding Cortex-A7 code generation. Try fault-injecting ocram_user_fits(0x00906FFFU, 4U) or decode_sbmr2(0x03000010U) locally to watch the boundary assertions catch low-OCRAM overlap and reserved BMOD encodings immediately.
learner@ksa:~/gl-e01/m04-l01gcc -std=c11 -Wall -Wextra -Werror -pedantic sbmr_boot_decoder.c -o sbmr_boot_decoderlearner@ksa:~/gl-e01/m04-l01./sbmr_boot_decoderSBMR2=0x02000000->INT_STRAPS SBMR1=0x40->SD_ESD OCRAM_free=100KiBlearner@ksa:~/gl-e01/m04-l01clang --target=armv7a-none-eabi -mcpu=cortex-a7 -marm -mfloat-abi=soft -ffreestanding -std=c11 -Wall -Wextra -Werror -x c -c boot_policy.c -o target.olearner@ksa:~/gl-e01/m04-l01learner@ksa:~/gl-e01/m04-l01strace -e trace=write,exit_group \./sbmr_boot_decoderwrite(1, "SBMR2=0x02000000->INT_STRAPS SBM"..., 66) = 66exit_group(0) = ?+++ exited with 0 +++Separating Bench Symptoms Across Reset Edges, USB SDP & Image Headers
Keeping the reset-edge capture model in mind resolves three bench mysteries that routinely stall bring-up teams. First, if a board boots nothing on UART1 after you flip its DIP switches to SD, verify that you pulsed POR_B (full power-cycle), not just a peripheral warm reset, and check lsusb on the host: if the Boot ROM rejected a missing or malformed SD image, it silently falls into USB_OTG1 Serial Downloader (SDP), enumerating as a USB HID device while emitting zero characters on UART1! Second, remember that selecting SD via BOOT_CFG only tells the ROM where to look; it does not prove the card holds a valid boot header. Later: Lesson m04-l02 constructs the exact 32-byte Image Vector Table (IVT) and 12-byte Boot Data header the ROM looks for at sector 2 (0x400).
Common Production Pitfalls
warning: Symptom: A custom carrier attaches an external 1 kOhm pull-up or active sensor output to LCD_DATA05 or LCD_DATA06, and cold power-on stops booting from SD even though BOOT_MODE[1:0] switches still select 10 (Internal Boot). Root Cause: LCD_DATA00..23 double as BOOT_CFG1/2/4 inputs sampled on the rising edge of POR_B; the 1 kOhm external load overpowered the weak 47 kOhm board strap resistor during reset, latching eMMC or NAND into SRC_SBMR1. Fix: Isolate or tri-state external drivers on LCD_DATA pins until POR_B completes, and read back SRC_SBMR1 (0x020D8004) over SDP or JTAG to confirm latched strap bits.
warning: Symptom: Linking an early pre-DDR diagnostic image directly at 0x00900000 (the base of physical OCRAM) causes USB SDP download or SD boot handoff to crash before reaching _start. Root Cause: Physical validity ([0x00900000, 0x00920000)) is not allocation ownership: the Boot ROM itself uses [0x00900000, 0x00907000) (28 KiB) for its live execution stack, MMU/cache descriptors, and SDP state during transfer. Fix: Place pre-DDR SPL images and stacks strictly inside the unreserved 100 KiB window [0x00907000, 0x00920000).
Practice & Retrieval
Guided Practice: Decoding SBMR1/SBMR2 & Sizing an OCRAM Stack
Solve each bring-up check step by step. Step 1 (Register Decode): Given SRC_SBMR2 = 0x02000001U and SRC_SBMR1 = 0x00001860U, extract BMOD[1:0] (bits [25:24] = 2), BT_FUSE_SEL (bit 4 = 0, ignoring bit 0!), and BOOT_CFG1[7:4] (0x6), confirming BP_INT_STRAPS -> DEV_MMC_EMMC. Step 2 (OCRAM Budget): Place an 8-byte-aligned SVC stack top at 0x00920000 reserving 8 KiB (0x2000 B down to 0x0091E000), and compute the maximum payload span starting at 0x00908000 (0x0091E000 - 0x00908000 = 0x16000 = 88 KiB).
Independent Practice: USDHC Port & Bus-Width Strap Auditor
Extend sbmr_boot_decoder.c into boot_cfg_audit.c decoding BOOT_CFG2 (SBMR1[15:8]) alongside BOOT_CFG1: extract USDHC controller port (USDHC1 vs USDHC2) and data width (1-bit, 4-bit, 8-bit), reject 8-bit bus configurations when DEV_SD_ESD (rather than DEV_MMC_EMMC) is selected, and verify that IVT + Boot Data + payload + stack fit non-overlapping inside [0x00907000, 0x00920000).
Key takeaways
BOOT_MODE[1:0](SRC_SBMR2[25:24]) selects00Fuse Boot,01USB/UART Serial Downloader (SDPrecovery),10ROM-directed Internal Boot, or11Reserved (invalid).- Under
Internal Boot(10),BT_FUSE_SEL(SBMR2[4]) chooses between reset-sampledBOOT_CFGpin straps (SRC_SBMR1) and permanent eFUSE configuration. - Strap pads (
BOOT_MODEandLCD_DATA00..23) are latched on the rising edge ofPOR_B; post-reset peripheral pin reuse cannot alterSBMR1/SBMR2, whereas external loads during reset can corrupt media selection. - Internal
128 KiBOCRAM([0x00900000, 0x00920000)) operates immediately before externalDDR3initialization, with[0x00907000, 0x00920000)(100 KiB) available above the Boot ROM's own workspace. - BOOT_MODE values 00, 01, 10, and 11 select fuse boot, serial downloader, internal boot, and a reserved encoding respectively.
- Internal boot media policy can depend on sampled BOOT_CFG inputs or fuse-selected configuration.
- No; ROM or handoff state may reserve part of that window.