Flash - nxp-mcuxpresso/vscode-for-mcux GitHub Wiki

Quick access links to program the flash or to fully erase the flash are available on the project context menu.

Flash erase quick access options

In case of flash operation, a dialog will ask to confirm (or to select in case of multiple binary files are found) the image file you want to program.

Flash options

In addition, there is a customized (by debug probe type) view providing an extended set of options for flashing, erasing and various other actions depending on the probe type.

Flash Programmer

Common Flash Programmer Features

The following sections describe common elements present in the flash programmer views.

Project

All flash operations require a project to be selected using the dropdown at the top of the view.

Project Dropdown

Operation Tabs: Program | Erase | Resurrect

The main flash operation can be selected using the tabs after the project. The options presented afterwards change to accomodate each major operation.

Operation tabs

Program

Program a file into flash. The available file formats depend on the probe type used. The extension will sometimes automatically convert the file into another format that is compatible with the probe type.

The file to be programmed can be selected using the Browse button or by entering the path directly into the field. If no file is selected, the project's default build target is used.

Note: For Zephyr projects the default image for flashing might be different than the one used for debugging. Zephyr projects also produce a binary file - which is used as the default file for flashing - but in some cases this file has been post-processed (e.g. signed for MCUboot).

Select file field

If the probe type supports programming binary files the following fields are also available. First toggle the "bin" format then input the start address of the binary in hex format. When "bin" is toggled, the file is always converted to binary format first.

Binary formaty

Erase

Erase the flash. Each probe type might provide options affecting the way in which the flash is erased.

Resurrect

Attempt to unlock a Kinetis MCU by restoring the Flash Configuration field at offset 0x400.

Before running, the extension tries to check that the selected project uses a Kinetis device that can be resurrected. A warning is shown otherwise. Since the check is just a heuristic, the warning can sometimes be ignored.

Resurrect Warning

Keep Wizard Open

If the "Keep wizard open upon completion" checkbox at the bottom is enabled, the flash programmer view remains open after Run / Preview.

Keep Wizard Open

Note: the wizard will remain open regardless of this option if the operation fails.

Preview

The Command Preview allows dumping the actual commands used in the operation. The preview can be generated without having any probe or board connected and is useful in certain scenarios (e.g. debugging a failed flash operation).

The preview can be accessed by pressing the Preview button next to Run button. This will open a new read-only text editor window with the information used in the flash operation.

Flash Programmer Preview

Note: Because the generated command line does not require a debug connection, the debug probe (see the <Insert Probe Serial here> field in the picture above) should be filled if the command will be executed on a real debug probe.

Specific options for each probe

  • LinkServer
    • PROGRAM
      • Reset Target on Execution: Reset target after programming.
      • Erase all Flash: Mass Erase the flash before programming.
    • ERASE
      • Erase by sector: Erase sector by sector instead of using chip erase.
    • RESURRECT
  • PEmicro
    • Common
      • Interface: SWD or JTAG.
      • Speed: Interface speed. You can input custom values to add them to the dropdown.
    • PROGRAM
      • Reset Target on Execution: Reset target after programming.
      • Erase: Erase before programming. Recommended since it works for all cases. Not erasing would only work if the flash was previously erased.
    • ERASE
  • Segger
    • Common

      • Interface: SWD or JTAG.
      • Speed: Interface speed. You can input custom values to add them to the dropdown.
      • Additional Options (input field at the bottom): Arguments to append to the command line.
    • PROGRAM

      • Reset Target on Execution: Reset before flashing.
      • Halt Target on Execution: Halt before flashing.
    • ERASE

      • Erase all flash banks: Erase all the flash data.
    • RESURRECT

    • CUSTOM SCRIPT

      • Custom script: Execute the custom commander script entered in the text field.

      Note: An "exit" command will be automatically added to the end of the script. This is mandatory in order for the JLink process to terminate.