Host-Target Workbench and the i.MX6ULL SoC
Build a first-principles mental model of cross-compilation across LP64 hosts and 32-bit ILP32 Cortex-A7 silicon, map the internal blocks of the i.MX6ULL SoC, isolate UART, TFTP, and NFS failure planes, and prove overflow-safe RAM window bounds in ISO C11.
What you'll learn
- Trace host, transport, RAM, and CPU boundaries in a bring-up experiment.
- Diagnose serial, TFTP, and NFS failures without conflating their layers.
- Record reproducible build evidence while identifying untested target behavior.
Host vs Target Machines and the i.MX6ULL Silicon Graph
When you compile and run ./hello on a desktop workstation, one computer performs every role: your x86_64 processor runs the C compiler, asks the running Linux kernel to map virtual memory pages and zero .bss, executes variable-length x86_64 machine instructions, and prints text through POSIX write() system calls. Embedded bare-metal bring-up splits that world across two physically distinct computers that share neither an instruction set, nor word widths, nor an operating system. Your build host is a 64-bit x86_64 workstation running under the LP64 data model (sizeof(long) == 8, sizeof(void *) == 8). Your execution target is a 32-bit ARMv7-A Cortex-A7 core inside an i.MX6ULL System-on-Chip (SoC), running freestanding (-ffreestanding -nostdlib) under the ILP32 data model (sizeof(long) == 4, sizeof(void *) == 4) with zero OS loader at power-on!
What physically sits inside that i.MX6ULL package alongside the Cortex-A7 CPU? Look at the right column of Figure 1.1a. A microcontroller or SoC is not a naked arithmetic unit wired straight to package pins; it is an interconnected silicon city bridged by AXI, AHB, and IPG on-chip buses:
- Mask
Boot ROM(0x00000000) &128 KiBOCRAM(0x00900000): Fixed boot firmware and static on-chip SRAM cells that work immediately after reset before external DRAM is configured. - Multi-Mode
DDRController (MMDC, externalDDR3at0x80000000+): High-capacity off-chip RAM that returns garbage or hangs the bus untilDCDtables orU-Bootcalibrate timings. - Clock Control (
CCM,0x020C4000) & Pin Multiplexer (IOMUXC,0x020E0000): Hardware gates that supply peripheral clocks and route internal signals out to physicalBGAballs. - Peripheral IP Blocks (
UART1at0x02020000,GPIO1..5at0x0209C000+,ENET): Memory-mapped controllers whose registers sit at fixed physical bus addresses.
Because every hardware block along that chain can fail independently, the Cortex-A7 core can fetch and execute valid ARMv7-A instructions while an external LED stays dark (gated CCM clock or unmuxed pad) or the serial terminal stays blank (wrong UART baud divisor or TX/RX swap). Engineering bring-up therefore treats host compilation, byte transport, target RAM placement, CPU execution, and peripheral routing as separate, testable hypotheses.
Figure 1.1a. Host-to-target workbench architecture — separating x86_64 LP64 compilation, three independent transport channels, and the internal silicon blocks of the i.MX6ULL .
mental model: Bringing up a bare-metal board from a workstation is like machining turbine blades in a CNC shop (build host), shipping the crate (TFTP transport), staging it on the plant floor (target RAM), and spinning the rotor (Cortex-A7 execution): a signed shipping receipt proves the bytes arrived intact, never that the rotor balanced or generated power.
Where it stops working: Unlike physical freight, host LP64 and target ILP32 compilers disagree on pointer and long widths before shipping, and writing to the wrong target RAM address can silently overwrite the live bootloader receiving the transfer.
definition (Cross-Compilation Host, Freestanding Target & Bring-Up Planes): A cross compiler executes on the build host (x86_64 LP64 workstation) while emitting machine instructions and binary data layouts for a distinct execution target (32-bit ARMv7-A ILP32 Cortex-A7). In a freestanding target image (-ffreestanding -nostdlib), no OS loader maps virtual addresses, zeroes .bss, or implements POSIX system calls. During bring-up, asynchronous UART serial (115200 8N1 character observation), TFTP (UDP block transfer into target RAM under U-Boot), and NFS (remote VFS filesystem mount under a running Linux kernel) operate on separate hardware and protocol layers with independent failure modes.
Step through the four workbench boundaries below to see exactly what each observation proves—and what remains untested until the next stage:
- Step 1. Step 1 (Build Host): C11 host verifiers prove math and struct layout; the cross toolchain emits EM_ARM ELF32 and raw binary artifacts.
- Step 2. Step 2 (Transport): UART1 observes asynchronous console text; U-Boot tftpboot moves UDP blocks into RAM without executing them.
- Step 3. Step 3 (Target Memory): 128 KiB works before DDR init; DDR3 loadaddr 0x87800000 must avoid U-Boot's relocated code and stack.
- Step 4. Step 4 (Execution): Cortex-A7 fetches 32-bit ARM instructions from the entry address; NFS mounts remote directories only after Linux boots.
Figure 1.1b. Identify which hardware or software boundary each workbench observation actually tests.
Isolating UART, TFTP, and NFS Transport Planes
Why do bring-up engineers wire both a 3.3 V USB-to-UART adapter and an isolated lab Ethernet cable to a development board, and why must you never conflate UART, TFTP, and NFS when diagnosing a failure? Each channel requires a completely different stack of active silicon:
UARTSerial Console (115200 8N1,3.3 VTTL): A two-wire (TX,RX+GND) asynchronous character stream. Always verify the schematic's logic voltage (3.3 Vvs1.8 V—never RS-232+/-12 V!) and ground continuity before connecting. Silence onUART1means the console port, baud rate,IOMUXCpad mux,UARTclock gate, or early boot path failed; it says nothing about Ethernet health.TFTPImage Download (UDPport69inU-Boot2025.x): Once a network-capable bootloader (U-Boot) is running in initializedDDR3RAM with a workingENETdriver,tftpboot ${loadaddr} bsp.bincopies raw file bytes from the hostTFTPexport directory into physical target RAM at${loadaddr}(0x87800000).TFTPcannot run on a blank bare-metal CPU without a network stack, and a passingcrc32proves only byte-identical delivery—not a validARMentry point or stack!NFSRoot Filesystem (RPC/TCPport2049): Mounts an exported host folder into a runningLinux kernelVirtual Filesystem (nfsroot=).NFSdoes not transfer bare-metal.binimages intoOCRAMorDDR3; restrict exports strictly to your isolated lab subnet (192.0.2.0/24) rather than disabling host firewalls globally.
Study the U-Boot 2025.x transfer sequence below from the target's perspective. Notice three distinct namespaces: bsp.bin is the host TFTP server's export filename, 0x87800000 (loadaddr) is a physical DDR3 address inside the i.MX6ULL 4 GiB address map (check bdinfo first so your download never overwrites U-Boot's own relocated image near the top of DDR3!), and ${filesize} records exact received byte count for crc32 verification before any jump.
learner@ksa:~/gl-e01/m01-l01$ bat workbench.uboot File: workbench.uboot # Example isolated lab assignments; adapt to your lab network. setenv ipaddr 192.0.2.20 setenv serverip 192.0.2.10 setenv loadaddr 0x87800000 printenv ipaddr serverip loadaddr # Run only after checking target RAM ownership and server policy. tftpboot ${loadaddr} bsp.bin crc32 ${loadaddr} ${filesize} # Downloading is not permission to jump to an uninspected image.Locking LP64 vs ILP32 Struct Widths and Window Bounds in C11
Throughout GL-E01, every lesson pairs real ARMv7-A target code with a native strict ISO C11 host verifier so you can prove bitfield algebra, binary header layouts, and state-machine invariants deterministically before touching hardware. Inspect Figure 1.1b to see the two classic host-tool bugs that abi_workbench_audit.c eliminates:
- Binary Struct Drift (
LP64vsILP32): If a host image-packing tool declares header fields asunsigned longorvoid *,gcconx86_64allocates8bytes per field plus alignment padding (24bytes total), whereasCortex-A7firmware expects4-byteILP32words (12or16bytes)—shiftingentry_addrby4+bytes! Locking every serialized field to<stdint.h>uint32_tand guarding with_Static_assert(sizeof(...) == 16U, ...)forces identical16-byte geometry on both machines. 32-Bit Unsigned Addition Wraparound (mod 2^32): Suppose a loader checks whether[start, start + length)fits inside[0x87800000, 0x87801000)usingstart >= base && start + length <= base + size. When a malformed header suppliesstart = 0xFFFFFFFCUandlength = 8U,ISO C11wraps32-bit unsigned addition modulo2^32to0x00000004U, which is<= 0x87801000U—accepting an out-of-bounds write across the4 GiBboundary! Checkingstart >= basefirst and then subtracting (offset = start - base,offset <= size && length <= size - offset) cannot overflow for anyuint32_tinputs.
Figure 1.1b. Locking 16-byte cross-ABI descriptor layout with uint32_t (top) and preventing 32-bit modular wraparound across the i.MX6ULL physical address map (bottom).
learner@ksa:~/gl-e01/m01-l01$ bat -H 9 -H 10 -H 11 -H 12 -H 18 -H 26 -H 27 -H 28 -H 29 abi_workbench_audit.c File: abi_workbench_audit.c #include <assert.h> #include <stdbool.h> #include <stdalign.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> struct armv7_load_desc { uint32_t load_addr; uint32_t entry_addr; uint32_t byte_len; uint32_t crc32_val; }; _Static_assert(sizeof(struct armv7_load_desc) == 16U, "descriptor size"); _Static_assert(alignof(struct armv7_load_desc) == 4U, "descriptor align"); static bool host_is_little_endian(void) { const uint32_t probe = UINT32_C(0x04030201); const unsigned char *bytes = (const unsigned char *)&probe; return bytes[0] == 1U && bytes[1] == 2U && bytes[2] == 3U && bytes[3] == 4U; } static bool ram_window_fits(uint32_t base, uint32_t size, uint32_t start, uint32_t length) { if (length == 0U || start < base) return false; uint32_t offset = start - base; return offset <= size && length <= size - offset; } int main(void) { assert(sizeof(uint32_t) == 4U && alignof(uint32_t) == 4U); assert(offsetof(struct armv7_load_desc, crc32_val) == 12U); assert(host_is_little_endian()); assert(ram_window_fits(0x87800000U, 0x1000U, 0x87800000U, 0x1000U)); assert(!ram_window_fits(0x87800000U, 0x1000U, 0x87800000U, 0x1001U)); assert(!ram_window_fits(0x87800000U, 0x1000U, 0x877fffffU, 1U)); assert(!ram_window_fits(0x87800000U, 0x1000U, UINT32_MAX, 8U)); assert(!ram_window_fits(0x87800000U, 0x1000U, 0x87800000U, 0U)); printf("abi_desc=%zuB align=%zuB host_ptr=%zuB arm32_ptr=4B le=%d window=ok\n", sizeof(struct armv7_load_desc), alignof(struct armv7_load_desc), sizeof(void *), host_is_little_endian() ? 1 : 0); return 0; }- Lock image-descriptor fields to uint32_t so LP64 hosts and ILP32 Cortex-A7 targets agree on a 16-byte layout.
- Probe little-endian byte order explicitly rather than assuming host memory matches ARMv7-A target byte lanes.
- Validate start >= base before subtracting so unsigned wrap near UINT32_MAX cannot masquerade as an in-bounds span.
Executing the ABI and Placement Verifier
Compile and run abi_workbench_audit.c under -std=c11 -Wall -Wextra -Werror -pedantic. Observe host_ptr=8B versus arm32_ptr=4B alongside the 16B descriptor proof, then inject the wraparound bug (start + length <= base + size) on (UINT32_MAX, 8U) in a scratch edit to watch assert(!ram_window_fits(...)) catch the mod 2^32 wrap immediately before restoring the subtraction check.
learner@ksa:~/gl-e01/m01-l01gcc -std=c11 -Wall -Wextra -Werror -pedantic abi_workbench_audit.c -o abi_workbench_auditlearner@ksa:~/gl-e01/m01-l01./abi_workbench_auditabi_desc=16B align=4B host_ptr=8B arm32_ptr=4B le=1 window=oklearner@ksa:~/gl-e01/m01-l01learner@ksa:~/gl-e01/m01-l01strace -e trace=write,exit_group \./abi_workbench_auditwrite(1, "abi_desc=16B align=4B host_ptr=8"..., 62) = 62exit_group(0) = ?+++ exited with 0 +++Evidence Boundaries, Wraparound Proofs, and Channel Trade-Offs
Look at the strace trace above (write(1, ..., 62) followed by exit_group(0) on an x86_64 host): that syscall boundary is visual proof of why host models and bare-metal targets differ. On x86_64, printf hands 62 bytes to a running OS kernel; on freestanding Cortex-A7 silicon, there is no write syscall—every character on UART1 will require your own CCM clock gate, IOMUXC pin mux, baud-rate divisor, and TX FIFO loop. Likewise, keep your engineering claims exact: this C11 check proves 16-byte fixed-width layout and overflow-free [base, base + size) window math, while DDR3 calibration, 3.3 V serial levels, and Cortex-A7 fetch require target measurements.
| Workbench Channel | Active Stage | Transport / Width | What Success Proves (and Cannot Prove) |
|---|---|---|---|
Host ISO C11 verifier (gcc) | Pre-transfer build | 64-bit host process (LP64) | Proves fixed-width uint32_t layout and range math; proves 0 target bus or pad facts |
UART serial console (115200 8N1) | Bootloader / runtime | Asynchronous 3.3 V TX/RX | Proves console clock, pad mux, baud rate, and TX code path; proves 0 Ethernet/NFS health |
TFTP image load (tftpboot) | U-Boot 2025.x | UDP blocks into RAM (loadaddr) | Proves byte delivery and filesize/crc32; does not prove valid EM_ARM code or stack |
NFS root mount (nfsroot=) | Linux kernel 6.12 | RPC/TCP or UDP VFS mount | Proves kernel TCP/IP + VFS export visibility; unusable before a kernel/network stack runs |
Later: Lesson m01-l02 opens the compiled binary itself to inspect how ARM AAPCS32 passes integer and VFPv4 floating-point arguments and how ELF32 separates file-backed .text/.data bytes from zero-initialized .bss RAM.
Common Production Pitfalls
warning: Symptom: A binary image header written by an x86_64 C host utility passes desktop unit tests, yet Cortex-A7 boot code reads 0x00000000 for entry_addr and jumps into upper zero padding. Root Cause: The host struct used unsigned long or size_t (8 bytes on LP64) instead of uint32_t (4 bytes on ILP32), doubling field offsets in the serialized byte stream. Fix: Declare every cross-target wire or image field with <stdint.h> fixed-width types (uint32_t, uint16_t) and enforce total byte size via _Static_assert.
warning: Symptom: tftpboot ${loadaddr} bsp.bin prints Bytes transferred = 262144 cleanly, yet U-Boot freezes or resets before you even type go ${loadaddr}. Root Cause: loadaddr overlapped U-Boot's own relocated code, malloc heap, stack, or active page tables near the top of DDR3 because the address was picked without inspecting bdinfo. Fix: Run bdinfo on the U-Boot console first, select a non-overlapping payload window such as 0x87800000, and verify filesize fits before transferring.
Practice & Retrieval
Guided Practice: Auditing a Mixed-Width Header & OCRAM Span
Step 1 (Stride Calculation): On x86_64 (LP64), compute offsetof(struct bad_hdr, entry) and sizeof(struct bad_hdr) for struct bad_hdr { unsigned long magic; uint32_t len; void *entry; }; (hint: 8-byte entry forces 4 bytes of alignment padding after len, placing entry at +16 and size at 24 B, versus +8 and 12 B on 32-bit Cortex-A7). Step 2 (Fixed-Width Fix): Replace every field with uint32_t target equivalents and verify sizeof == 12 B on both hosts. Step 3 (OCRAM Window): Evaluate ram_window_fits(0x00900000U, 0x00020000U, 0x0091FF00U, 0x200U) for 128 KiB OCRAM (0x1FF00 + 0x200 overruns 0x20000 by 256 bytes -> false).
Independent Practice: Multi-Region Target Memory Map Auditor (memmap_audit.c)
Write a standalone ISO C11 program memmap_audit.c encoding the i.MX6ULL bring-up map: Boot ROM workspace [0x00900000, 0x00907000) (reserved), free OCRAM [0x00907000, 0x00920000) (writable), payload DDR3 [0x87800000, 0x87900000) (writable), and U-Boot top-of-RAM [0x9FF00000, 0xA0000000) (reserved). Implement int validate_download(uint32_t addr, uint32_t len) requiring 4-byte alignment, containment inside one writable window, zero reserved overlap, and wraparound immunity across 7 positive/negative test vectors.
Key takeaways
- Cross-compilation separates an
LP64build host (8-byte pointers/longs) from a32-bitILP32freestandingCortex-A7target (4-byte pointers/longs, zero OS loader); lock shared binary structs touint32_t. - Inside the
i.MX6ULLSoC,Boot ROMand128 KiBOCRAM(0x00900000) work immediately at reset, whereas externalDDR3(0x80000000+),CCMclocks, andIOMUXCpads require explicit initialization. UARTserial (115200 8N1console),U-BootTFTP(UDPRAM download), andLinux kernelNFS(VFSmount) test distinct layers with independent failure modes.- Guard
32-bit RAM placement windows by validatingstart >= basebefore comparinglength <= size - (start - base), and distinguish hostC11proofs from target silicon execution. - A cross compiler runs on the build host and emits instructions for a different execution target.
- Serial console, TFTP file transfer, and NFS filesystem access are distinct paths with separate failure modes.
- The tested arithmetic satisfies the explicit RAM-window fixture.