OpenOCD has different commands for NOR and NAND flash; the “flash” command works with NOR flash, while the “nand” command works with NAND flash. This partially reflects different hardware technologies: NOR flash usually supports direct CPU instruction and data bus access, while data from a NAND flash must be copied to memory before it can be used. (SPI flash must also be copied to memory before use.) However, the documentation also uses “flash” as a generic term; for example, “Put flash configuration in board-specific files”.
Flash Steps:
Many CPUs have the ablity to “boot” from the first flash bank. This means that misprogramming that bank can “brick” a system, so that it can't boot. JTAG tools, like OpenOCD, are often then used to “de-brick” the board by (re)installing working boot firmware.
Configures a flash bank which provides persistent storage for addresses from base to base + size - 1. These banks will often be visible to GDB through the target's memory map. In some cases, configuring a flash bank will activate extra commands; see the driver-specific documentation.
- name ... may be used to reference the flash bank in other flash commands. A number is also available.
- driver ... identifies the controller driver associated with the flash bank being declared. This is usually
cfifor external flash, or else the name of a microcontroller with embedded flash memory. See Flash Driver List.- base ... Base address of the flash chip.
- size ... Size of the chip, in bytes. For some drivers, this value is detected from the hardware.
- chip_width ... Width of the flash chip, in bytes; ignored for most microcontroller drivers.
- bus_width ... Width of the data bus used to access the chip, in bytes; ignored for most microcontroller drivers.
- target ... Names the target used to issue commands to the flash controller.
- driver_options ... drivers may support, or require, additional parameters. See the driver-specific documentation for more information.
Note: This command is not available after OpenOCD initialization has completed. Use it in board specific configuration files, not interactively.
Prints a one-line summary of each device that was declared using flash bank, numbered from zero. Note that this is the plural form; the singular form is a very different command.
Retrieves a list of associative arrays for each device that was declared using flash bank, numbered from zero. This returned list can be manipulated easily from within scripts.
Identify the flash, or validate the parameters of the configured flash. Operation depends on the flash type. The num parameter is a value shown by flash banks. Most flash commands will implicitly autoprobe the bank; flash drivers can distinguish between probing and autoprobing, but most don't bother.
One feature distinguishing NOR flash from NAND or serial flash technologies is that for read access, it acts exactly like any other addressible memory. This means you can use normal memory read commands like mdw or dump_image with it, with no special flash subcommands. See Memory access, and Image access.
Write access works differently. Flash memory normally needs to be erased before it's written. Erasing a sector turns all of its bits to ones, and writing can turn ones into zeroes. This is why there are special commands for interactive erasing and writing, and why GDB needs to know which parts of the address space hold NOR flash memory.
Note: Most of these erase and write commands leverage the fact that NOR flash chips consume target address space. They implicitly refer to the current JTAG target, and map from an address in that target's address space back to a flash bank. A few commands use abstract addressing based on bank and sector numbers, and don't depend on searching the current target and its address space. Avoid confusing the two command models.
Some flash chips implement software protection against accidental writes, since such buggy writes could in some cases “brick” a system. For such systems, erasing and writing may require sector protection to be disabled first. Examples include CFI flash such as “Intel Advanced Bootblock flash”, and AT91SAM7 on-chip flash. See flash protect.
Erase sectors in bank num, starting at sector first up to and including last. Sector numbering starts at 0. Providing a last sector of last specifies "to the end of the flash bank". The num parameter is a value shown by flash banks.
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length
Erase sectors ng a la>] address length