Reading Data from NOR Flash: Methods, Tools, and Security Considerations
User question
did anyone try to read the data on the nor flash?
Artificial Intelligence Response
Direct answer to the question
- Yes. Reading data from NOR flash is routine in debugging, firmware backup, forensics, and reverse engineering.
- It is commonly done in-circuit via the device’s bootloader/OS or debug port, or off-board with a flash programmer if needed.
Detailed problem analysis
- Access paths (least to most invasive)
- Via bootloader/OS: If the device exposes a console (UART/USB) or runs Linux/RTOS, use built‑in tools. Examples: in U‑Boot use sf probe; sf read , then transfer the buffer over UART/Ethernet; in Linux use /proc/mtd to identify partitions and dd if=/dev/mtdX of=/tmp/dump.bin.
- Via CPU debug: Halt the CPU with JTAG/SWD and dump the memory‑mapped NOR (typical for XIP designs). Tools: OpenOCD, J‑Link. Beware of caches/MPU and address remaps; disable caches or read uncached windows when possible.
- Bus sniff or in‑circuit read: For SPI/QSPI parts, clip onto the SOIC‑8/WSON package (CS#, CLK, IO0/MOSI, IO1/MISO, IO2‑IO3 for QSPI, VCC, GND, WP#, HOLD#). Hold the SoC in reset or tristate its pins to avoid bus contention. Use a level‑correct reader (1.8 V or 3.3 V).
- Chip‑off: Desolder and read in a socket with a universal programmer when in‑circuit methods fail or security circuitry on the board interferes.
- Protocol specifics that matter
- Identify the device first: read JEDEC ID with command 0x9F; then read SFDP (0x5A) to discover supported opcodes, addressing (24/32‑bit), and dummy cycles.
- Choose a safe read opcode: legacy 0x03 (no dummy cycles) is slow but universal; fast reads (0x0B, 0x3B/0x6B QSPI, DTR/DDR octal) require correct dummy cycles per SFDP.
- Address width: devices ≥16 MiB typically require 32‑bit addressing (enter 4‑byte mode or use 0x13 fast‑read with embedded 32‑bit address).
- XIP/QSPI mapping: On systems executing‑in‑place, the external flash appears in the CPU’s memory map; dumping that region is equivalent to reading flash directly.
- Protection and why a dump can still fail
- Block protection: BP/Sec/SRP bits may lock sectors; clear with write‑enable + status register writes if allowed; WP# pin low can hard‑protect.
- Security registers/OTP: Small secure regions may be one‑time‑programmable and not erasable, but they are usually still readable.
- SoC‑side encryption/secure boot: Many MCUs/SoCs (e.g., ESP32, i.MX RT, some STM32 with OEM secure boot) support on‑the‑fly decryption. The raw NOR contents will then be encrypted; only the CPU sees plaintext.
- Board interference: Parallel pull‑ups/downs, series resistors, and an active SoC can corrupt in‑circuit reads. Isolate power, assert reset, or lift CS# to the SoC.
- Electrical/signal integrity considerations
- Voltage: Most SPI/QSPI NOR is 1.8 V or 3.3 V; 5 V is uncommon. Use proper level shifting; do not attach 3.3 V tools to 1.8 V parts.
- Clocks and wires: Keep clip leads short; start with low SPI clock (100 kHz–1 MHz) and increase once stable. For DTR/DDR octal modes, prefer a dedicated programmer.
- Data validation and analysis
- Verify with repeated reads and hashes; check for recognizable headers (bootloader strings, filesystem magic such as JFFS2/CRAMFS/SquashFS/UBI).
- Use tools like binwalk, strings, and file system unpackers to parse partitions; preserve original binary dumps as read‑only artifacts.
Current information and trends
- Interface trends: Migration from classic SPI/QSPI to Octal SPI (OSPI/OPI, often 1.8 V) with DTR/DDR and higher dummy‑cycle sensitivity; widespread SFDP support allowing software‑discoverable timing and opcodes.
- Security trends: Default enablement of secure boot/flash encryption on newer platforms; expect ciphertext in raw dumps and authenticated boot images that resist modification.
- Capacity and addressing: Larger densities (256 Mb–2 Gb) are common; 32‑bit addressing and 4‑byte mode are the norm for ≥128 Mb devices.
Supporting explanations and details
- Typical minimal workflow (in‑circuit, SPI NOR)
- Identify part marking; get the datasheet; confirm VCC.
- Isolate the bus (hold SoC in reset, pull its CS# high via resistor, or remove series resistor).
- Connect a level‑correct reader; read RDID (0x9F) and SFDP (0x5A).
- Start with opcode 0x03 reads; incrementally dump the address space; then switch to fast read once dummy cycles are known.
- Repeat read and compare; if unstable, reduce clock, shorten leads, or fully power the board from a lab supply.
- Typical minimal workflow (JTAG/XIP)
- Halt CPU, locate the external flash window in the memory map, disable caches, dump the region to a file.
Ethical and legal aspects
- Only access firmware you are authorized to read. Circumventing technical protection measures or extracting third‑party secrets may violate laws (e.g., anti‑circumvention) and contracts/warranties. Handle any personal data found in dumps per privacy regulations.
Practical guidelines
- Tools that reliably work
- Software: flashrom (broad device support), OpenOCD, vendor tools, sigrok/PulseView, binwalk.
- Hardware: level‑switchable USB programmers (3.3 V/1.8 V), SOIC‑8/WSON test clips, FT2232H‑based SPI bridges, logic analyzers, J‑Link/OpenOCD adapters.
- Quick triage checklist
- Part number and voltage known?
- Bus isolated from host SoC?
- RDID and SFDP readable?
- Correct address width and dummy cycles configured?
- Stable power and short wiring?
- Common pitfalls and remedies
- Reads return 0xFF/0x00 sporadically: lower SPI clock, shorten leads, ensure CS# integrity.
- Only the SoC can read plaintext: likely on‑the‑fly decryption; use a software path on the device (bootloader/OS) instead of raw bus reads.
Possible disclaimers or additional notes
- Some packages (WSON/BGA) are hard to clip; chip‑off may be the only option.
- Vendor‑specific opcodes (enter/exit 4‑byte mode, deep power‑down) vary; always confirm against the actual datasheet or SFDP table.
Suggestions for further research
- Look up the device’s JESD216 SFDP parameter table and the exact datasheet for status/configuration register layout.
- Review your SoC’s boot/flash controller manual for XIP mapping and any inline encryption.
- Explore platform‑specific communities (e.g., MCU/vendor forums) for known quirks with your exact flash and controller.
Brief summary
- Yes—NOR flash is routinely read both in‑system and off‑board. Start with the least invasive path (bootloader/OS), move to debug/bus access, and use chip‑off as a last resort. Pay attention to voltage, bus isolation, address/dummy‑cycle configuration, and possible SoC‑side encryption. If you share the exact part number, interface (SPI/QSPI/parallel), and your tools, I can give step‑by‑step instructions for your device.
Disclaimer: The responses provided by artificial intelligence (language model) may be inaccurate and misleading. Elektroda is not responsible for the accuracy, reliability, or completeness of the presented information. All responses should be verified by the user.