Using the command line flash programming tool

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using the command line flash programming tool

24,663 Views
lpcware-support
Senior Contributor I

Flash programming is usually invoked automatically when you launch a debug session from within the LPCXpresso IDE, but can also be accessed directly using a command line utility.

This can be useful for things like programming the flash for devices with limited production runs.

Note: Some debug probes require booting before the flash programming utility can be run. For more details:

Running the flash programming utility


The LPCXpresso IDE flash programming stubs are located at:

  • <install_dir>/lpcxpresso/bin/

To run a flash programming operation from the command line, the correct flash utility stub for your part should be called with appropriate options.

For example:

crt_emu_cm_redlink -flash-load-exec "LPC11U68_App.axf" -vendor=NXP -pLPC11U68

Note: A simple way of finding the correct command and options, is to use the GUI Flash Utility, the completion dialog shows the exact command line invoked by the GUI. see Using the GUI flash programming tool.

The flash programming utility takes the following options:

  • flash_utility wire -ptarget -vendor=NXP -flash-load[-exec] "filename" [-load-base=base_address] [-flash-driver=flashdriver]

where:

  • flash_utility when using LPCLink-2 or any CMSIS-DAP probe connected to a Cortex-M CPU is:
    • crt_emu_cm_redlink
      • Note: Both the LPCXpresso V2/V3 boards and RDB4078 incorporate a built in LPC-Link2 debug probe
      • Note: From LPCXpresso IDE v8.1 and later, LPCLink and Red Probe should also be used with the redlink flash utility
  • flash_utility when using LPCLink or Red Probe(+) with LPCXpresso IDE 8.0 and earlier:
    • crt_emu_cm_gen
      • for use with LPC11U6x, LPC11E6x, LPC8xx, LPC15xx parts
    • crt_emu_lpc11_13
      • for use with LPC11xx, LPC11Axx, LPC11Cxx, LPC11Dxx, LPC11xxLV, LPC11U1x/2x/3x, LPC11E1x/2x/3x, LPC12xx, LPC13xx parts
    • crt_emu_cm3_nxp
      • for use with LPC17xx, LPC407x_8x parts
    • crt_emu_lpc18_43_nxp
      • for use with LPC18xx and LPC43xx parts
    • crt_emu_a7_nxp
      • for use with LPC21xx/22xx/23xx/24xx parts
    • crt_emu_a9_nxp
      • for LPC31xx/32xx and LPC29xx parts
  • wire is one of:
    • (empty) for LPC-Link2
    • (empty) for Red Probe+, Red Probe
    • -wire=winusb for RDB1768v2
    • -wire=winusb for LPC-Link on Windows XP, Windows 8, Linux and Mac OSX
    • -wire=hid (or LPC-Link on Windows Vista or Windows 7
  • target is the target chip name. For example LPC1343, LPC1114/301, LPC1768 etc.
  • filename is the file to flash program. It may be an executable (axf) or a binary (bin) file. If using a binary file, the base_address also must be specified.
  • base_address is the address where the binary file will be written. It should be specified as a hex value with a leading 0x.
  • flashdriver for parts with external flash, a flash driver can be specified, see LPC18 / LPC43 External Flash Drivers for more information.
  • Note:
    • -flash-load will leave the processor in a stopped state.
    • -flash-load-exec will start execution of application as soon as download has completed.

Examples


To load the executable file app.axf and start it executing on an LPC1768 target using LPC-Link2, use the following command line:

crt_emu_cm_redlink -pLPC1768 -vendor=NXP -flash-load-exec "app.axf"

To load the binary file binary.bin to address 0x1000 to an LPC1343 target using LPC-Link on Windows 8, Linux or Mac OSX, use the following command line:

crt_emu_lpc11_13_nxp -wire=hid -pLPC1343 -vendor=NXP -flash-load "binary.bin" -load-base=0x1000

To load the executable file app.axf and start executing on an LPC11U68 target, using RedProbe+ use the following command line:

crt_emu_cm_gen -pLPC11U68 -vendor=NXP -flash-load-exec "app.axf"

Also see....


Using the GUI flash programming toolUsing the GUI flash programming tool

What is Redlink?What is Redlink?

Labels (1)
0 Replies