User Guide - pfr#

This user’s guide describes how to use pfr application.

PFR application is a command line tool for working with Protected Flash Region (PFR) areas (CMPA, CFPA). User might use this tool to read, write, parse, erase, and display PFR areas.

Get-template command is used to generate a template file for PFR configuration. Then, user can modify this file and use it for PFR configuration. Values might be passed as enums or as a hexadecimal number.

Note

Special prefix “RAW:” is used to pass a hexadecimal number that won’t be pre-processed. For example IPED_CTX0_START_ADDR: “RAW:0x123456”

Command line interface#

pfr#

Utility for generating and parsing Protected Flash Region data (CMPA, CFPA).

pfr [OPTIONS] COMMAND [ARGS]...

Options

-v, --verbose#

Print more detailed information

-vv, --debug#

Display more debugging information.

--version#

Show the version and exit.

--help#

Show this message and exit.

erase-cmpa#

Erase CMPA PFR page in the device if is not sealed and write the default values into CMPA page.

pfr erase-cmpa [OPTIONS]

Options

-p, --port <COM[,speed>#

Serial port configuration. Default baud rate is 57600. Use ‘nxpdevscan’ utility to list devices on serial port.

-u, --usb <VID:PID|USB_PATH|DEV_NAME>#

USB device identifier. | Following formats are supported: <vid>, <vid:pid> or <vid,pid>, device/instance path, device name. | <vid>: hex or dec string; e.g. 0x0AB12, 43794. | <vid/pid>: hex or dec string; e.g. 0x0AB12:0x123, 1:3451. | Use ‘nxpdevscan’ utility to list connected device names.

This option can be omitted if ‘–family’ option is used.
-sd, --sdio <SDIO_PATH|DEV_NAME>#

SDIO device identifier.

Following formats are supported: device/instance path, device name.
device/instance path: device string; e.g. /dev/mcu-sdio.
Use ‘nxpdevscan’ utility to list connected device names.
-l, --lpcusbsio <usb,VID:PID|USB_PATH|SER_NUM,]spi|i2c>#

USB-SIO bridge interface.

Optional USB device filtering formats: [usb,vid:pid|usb_path|serial_number]

Following serial interfaces are supported:

spi[index][,port,pin,speed_kHz,polarity,phase]
- index … optional index of SPI peripheral. Example: “spi1” (default=0)
- port … bridge GPIO port used as SPI SSEL(default=0)
- pin … bridge GPIO pin used as SPI SSEL
default SSEL is set to 0.15 which works
for the LPCLink2 bridge. The MCULink OB
bridge ignores the SSEL value anyway.(default=15)
- speed_kHz … SPI clock in kHz (default 1000)
- polarity … SPI CPOL option (default=1)
- phase … SPI CPHA option (default=1)
- nirq_port … nIRQ port number (default None)
- nirq_pin … nIRQ pin number (default None)
i2c[index][,address,speed_kHz]
- index … optional index of I2C peripheral. Example: “i2c1” (default=0)
- address … I2C device address (default 0x10)
- speed_kHz … I2C clock in kHz (default 100)
- nirq_port … nIRQ port number (default None)
- nirq_pin … nIRQ pin number (default None)
Following types of interface configuration formats are supported:
- string with coma separated arguments i.e. spi1,0,15,1000,1
- string with coma separated keyword arguments (the order may not be maintained) i.e.spi1,port=0,speed_kHz=1000,nirq_port=1,nirq_pin=7
- string with combination of coma separated arguments and keyword arguments i.e.spi1,0,15,nirq_port=1,nirq_pin=7
-cb, --can <interface[,channel,bitrate,rxid,txid>#

CAN Bus settings

interface[,channel,bitrate,rxid,txid]
- interface … CAN interface name (refer to python-can library)
- channel … CAN channel number
- bitrate … CAN bitrate (default=1000000)
- rxid … default arbitration ID for RX (default=0x123)
- txid … default arbitration ID for TX (default=0x321)
-b, --buspal <spi[,speed,polarity,phase,lsb|msb] | i2c[,address,speed>#

Buspal settings

-x, --plugin <identifier=PLUGIN_IDENTIFIER[,param1=value1,param2=value2>#

Plugin interface settings.

Following format of plugin setting is supported:

identifier=<PLUGIN_IDENTIFIER>[,<key1>=<value1>,<key2>=<value2>,…]
- <PLUGIN_IDENTIFIER>: Corresponds to the ‘identifier’ attribute of the plugin class
- <key1>=<value1>: Represent a single interface parameter
Optional interface settings:
- Any number of optional <key>=<value> scan settings separated by comma can be defined
- The <key>=<value> pairs are used as keyword parameters for ‘scan’ method of a plugin class
--timeout <ms>#

Sets timeout when waiting on data over a serial line. The default is 5000 milliseconds.

-f, --family <family>#

Select the chip family.

Options:

lpc5502 | lpc5504 | lpc5506 | lpc5512 | lpc5514 | lpc5516 | lpc5526 | lpc5528 | lpc5534 | lpc5536 | lpc55s04 | lpc55s06 | lpc55s14 | lpc55s16 | lpc55s26 | lpc55s28 | lpc55s36 | lpc55s66 | lpc55s69 | mcxa132 | mcxa133 | mcxa142 | mcxa143 | mcxa144 | mcxa145 | mcxa146 | mcxa152 | mcxa153 | mcxa154 | mcxa155 | mcxa156 | mcxa165 | mcxa166 | mcxa175 | mcxa176 | mcxa275 | mcxa276 | mcxn235 | mcxn236 | mcxn546 | mcxn547 | mcxn946 | mcxn947 | mcxw235 | mcxw236 | nhs52s04

-r, --revision <revision>#

Chip revision; if not specified, most recent one will be used

generate-binary#

Generate binary data.

pfr generate-binary [OPTIONS]

Options

-e, --rot-config <rot_config>#

Specify Root Of Trust from MBI or Cert block configuration file/binary file

-sf, --secret-file <secret_file>#

Secret file (certificate, public key, private key); can be defined multiple times

-c, --config <config>#

Required Path to the YAML/JSON configuration file.

-o, --output <output>#

Required Path to a file, where to store the output.

-a, --add-seal#

Add seal mark digest at the end.

-p, --password <password>#

Password when using Encrypted private keys as –secret-file

--ignore#

Ignore validation failures and generate the binary.

get-families#

Shows the full family info for commands in this group.

pfr get-families [OPTIONS]

Options

-c, --cmd-name <cmd_name>#

Choose the command name to get full information about NXP families support.

Options:

get-template | parse-binary | write | read | erase-cmpa

get-template#

Generate user configuration template file.

pfr get-template [OPTIONS]

Options

-f, --family <family>#

Select the chip family.

Options:

lpc5502 | lpc5504 | lpc5506 | lpc5512 | lpc5514 | lpc5516 | lpc5526 | lpc5528 | lpc5534 | lpc5536 | lpc55s04 | lpc55s06 | lpc55s14 | lpc55s16 | lpc55s26 | lpc55s28 | lpc55s36 | lpc55s66 | lpc55s69 | mcxa132 | mcxa133 | mcxa142 | mcxa143 | mcxa144 | mcxa145 | mcxa146 | mcxa152 | mcxa153 | mcxa154 | mcxa155 | mcxa156 | mcxa165 | mcxa166 | mcxa175 | mcxa176 | mcxa275 | mcxa276 | mcxn235 | mcxn236 | mcxn546 | mcxn547 | mcxn946 | mcxn947 | mcxw235 | mcxw236 | nhs52s04

-t, --type <area>#

Required Select PFR partition

Options:

cmpa | cfpa

-r, --revision <revision>#

Chip revision; if not specified, most recent one will be used

-o, --output <output>#

Required Path to a file, where to store the output.

--force#

Force overwriting of existing files.

parse-binary#

Parse binary and extract configuration.

pfr parse-binary [OPTIONS]

Options

-f, --family <family>#

Select the chip family.

Options:

lpc5502 | lpc5504 | lpc5506 | lpc5512 | lpc5514 | lpc5516 | lpc5526 | lpc5528 | lpc5534 | lpc5536 | lpc55s04 | lpc55s06 | lpc55s14 | lpc55s16 | lpc55s26 | lpc55s28 | lpc55s36 | lpc55s66 | lpc55s69 | mcxa132 | mcxa133 | mcxa142 | mcxa143 | mcxa144 | mcxa145 | mcxa146 | mcxa152 | mcxa153 | mcxa154 | mcxa155 | mcxa156 | mcxa165 | mcxa166 | mcxa175 | mcxa176 | mcxa275 | mcxa276 | mcxn235 | mcxn236 | mcxn546 | mcxn547 | mcxn946 | mcxn947 | mcxw235 | mcxw236 | nhs52s04

-t, --type <area>#

Required Select PFR partition

Options:

cmpa | cfpa

-r, --revision <revision>#

Chip revision; if not specified, most recent one will be used

-o, --output <output>#

Path to a file, where to store the output.

-b, --binary <binary>#

Required Binary to parse

-d, --show-diff#

Show differences comparing to defaults

read#

Read PFR page from the device.

pfr read [OPTIONS]

Options

-p, --port <COM[,speed>#

Serial port configuration. Default baud rate is 57600. Use ‘nxpdevscan’ utility to list devices on serial port.

-u, --usb <VID:PID|USB_PATH|DEV_NAME>#

USB device identifier. | Following formats are supported: <vid>, <vid:pid> or <vid,pid>, device/instance path, device name. | <vid>: hex or dec string; e.g. 0x0AB12, 43794. | <vid/pid>: hex or dec string; e.g. 0x0AB12:0x123, 1:3451. | Use ‘nxpdevscan’ utility to list connected device names.

This option can be omitted if ‘–family’ option is used.
-sd, --sdio <SDIO_PATH|DEV_NAME>#

SDIO device identifier.

Following formats are supported: device/instance path, device name.
device/instance path: device string; e.g. /dev/mcu-sdio.
Use ‘nxpdevscan’ utility to list connected device names.
-l, --lpcusbsio <usb,VID:PID|USB_PATH|SER_NUM,]spi|i2c>#

USB-SIO bridge interface.

Optional USB device filtering formats: [usb,vid:pid|usb_path|serial_number]

Following serial interfaces are supported:

spi[index][,port,pin,speed_kHz,polarity,phase]
- index … optional index of SPI peripheral. Example: “spi1” (default=0)
- port … bridge GPIO port used as SPI SSEL(default=0)
- pin … bridge GPIO pin used as SPI SSEL
default SSEL is set to 0.15 which works
for the LPCLink2 bridge. The MCULink OB
bridge ignores the SSEL value anyway.(default=15)
- speed_kHz … SPI clock in kHz (default 1000)
- polarity … SPI CPOL option (default=1)
- phase … SPI CPHA option (default=1)
- nirq_port … nIRQ port number (default None)
- nirq_pin … nIRQ pin number (default None)
i2c[index][,address,speed_kHz]
- index … optional index of I2C peripheral. Example: “i2c1” (default=0)
- address … I2C device address (default 0x10)
- speed_kHz … I2C clock in kHz (default 100)
- nirq_port … nIRQ port number (default None)
- nirq_pin … nIRQ pin number (default None)
Following types of interface configuration formats are supported:
- string with coma separated arguments i.e. spi1,0,15,1000,1
- string with coma separated keyword arguments (the order may not be maintained) i.e.spi1,port=0,speed_kHz=1000,nirq_port=1,nirq_pin=7
- string with combination of coma separated arguments and keyword arguments i.e.spi1,0,15,nirq_port=1,nirq_pin=7
-cb, --can <interface[,channel,bitrate,rxid,txid>#

CAN Bus settings

interface[,channel,bitrate,rxid,txid]
- interface … CAN interface name (refer to python-can library)
- channel … CAN channel number
- bitrate … CAN bitrate (default=1000000)
- rxid … default arbitration ID for RX (default=0x123)
- txid … default arbitration ID for TX (default=0x321)
-b, --buspal <spi[,speed,polarity,phase,lsb|msb] | i2c[,address,speed>#

Buspal settings

-x, --plugin <identifier=PLUGIN_IDENTIFIER[,param1=value1,param2=value2>#

Plugin interface settings.

Following format of plugin setting is supported:

identifier=<PLUGIN_IDENTIFIER>[,<key1>=<value1>,<key2>=<value2>,…]
- <PLUGIN_IDENTIFIER>: Corresponds to the ‘identifier’ attribute of the plugin class
- <key1>=<value1>: Represent a single interface parameter
Optional interface settings:
- Any number of optional <key>=<value> scan settings separated by comma can be defined
- The <key>=<value> pairs are used as keyword parameters for ‘scan’ method of a plugin class
--timeout <ms>#

Sets timeout when waiting on data over a serial line. The default is 5000 milliseconds.

-f, --family <family>#

Select the chip family.

Options:

lpc5502 | lpc5504 | lpc5506 | lpc5512 | lpc5514 | lpc5516 | lpc5526 | lpc5528 | lpc5534 | lpc5536 | lpc55s04 | lpc55s06 | lpc55s14 | lpc55s16 | lpc55s26 | lpc55s28 | lpc55s36 | lpc55s66 | lpc55s69 | mcxa132 | mcxa133 | mcxa142 | mcxa143 | mcxa144 | mcxa145 | mcxa146 | mcxa152 | mcxa153 | mcxa154 | mcxa155 | mcxa156 | mcxa165 | mcxa166 | mcxa175 | mcxa176 | mcxa275 | mcxa276 | mcxn235 | mcxn236 | mcxn546 | mcxn547 | mcxn946 | mcxn947 | mcxw235 | mcxw236 | nhs52s04

-t, --type <area>#

Required Select PFR partition

Options:

cmpa | cfpa

-r, --revision <revision>#

Chip revision; if not specified, most recent one will be used

-o, --output <output>#

Store PFR data into a file. If not specified hexdump data into stdout.

-y, --yaml <yaml_output>#

Parse data read from device into YAML config.

-d, --show-diff#

(applicable for parsing) Show differences comparing to defaults

write#

Write PFR page to the device.

pfr write [OPTIONS]

Options

-p, --port <COM[,speed>#

Serial port configuration. Default baud rate is 57600. Use ‘nxpdevscan’ utility to list devices on serial port.

-u, --usb <VID:PID|USB_PATH|DEV_NAME>#

USB device identifier. | Following formats are supported: <vid>, <vid:pid> or <vid,pid>, device/instance path, device name. | <vid>: hex or dec string; e.g. 0x0AB12, 43794. | <vid/pid>: hex or dec string; e.g. 0x0AB12:0x123, 1:3451. | Use ‘nxpdevscan’ utility to list connected device names.

This option can be omitted if ‘–family’ option is used.
-sd, --sdio <SDIO_PATH|DEV_NAME>#

SDIO device identifier.

Following formats are supported: device/instance path, device name.
device/instance path: device string; e.g. /dev/mcu-sdio.
Use ‘nxpdevscan’ utility to list connected device names.
-l, --lpcusbsio <usb,VID:PID|USB_PATH|SER_NUM,]spi|i2c>#

USB-SIO bridge interface.

Optional USB device filtering formats: [usb,vid:pid|usb_path|serial_number]

Following serial interfaces are supported:

spi[index][,port,pin,speed_kHz,polarity,phase]
- index … optional index of SPI peripheral. Example: “spi1” (default=0)
- port … bridge GPIO port used as SPI SSEL(default=0)
- pin … bridge GPIO pin used as SPI SSEL
default SSEL is set to 0.15 which works
for the LPCLink2 bridge. The MCULink OB
bridge ignores the SSEL value anyway.(default=15)
- speed_kHz … SPI clock in kHz (default 1000)
- polarity … SPI CPOL option (default=1)
- phase … SPI CPHA option (default=1)
- nirq_port … nIRQ port number (default None)
- nirq_pin … nIRQ pin number (default None)
i2c[index][,address,speed_kHz]
- index … optional index of I2C peripheral. Example: “i2c1” (default=0)
- address … I2C device address (default 0x10)
- speed_kHz … I2C clock in kHz (default 100)
- nirq_port … nIRQ port number (default None)
- nirq_pin … nIRQ pin number (default None)
Following types of interface configuration formats are supported:
- string with coma separated arguments i.e. spi1,0,15,1000,1
- string with coma separated keyword arguments (the order may not be maintained) i.e.spi1,port=0,speed_kHz=1000,nirq_port=1,nirq_pin=7
- string with combination of coma separated arguments and keyword arguments i.e.spi1,0,15,nirq_port=1,nirq_pin=7
-cb, --can <interface[,channel,bitrate,rxid,txid>#

CAN Bus settings

interface[,channel,bitrate,rxid,txid]
- interface … CAN interface name (refer to python-can library)
- channel … CAN channel number
- bitrate … CAN bitrate (default=1000000)
- rxid … default arbitration ID for RX (default=0x123)
- txid … default arbitration ID for TX (default=0x321)
-b, --buspal <spi[,speed,polarity,phase,lsb|msb] | i2c[,address,speed>#

Buspal settings

-x, --plugin <identifier=PLUGIN_IDENTIFIER[,param1=value1,param2=value2>#

Plugin interface settings.

Following format of plugin setting is supported:

identifier=<PLUGIN_IDENTIFIER>[,<key1>=<value1>,<key2>=<value2>,…]
- <PLUGIN_IDENTIFIER>: Corresponds to the ‘identifier’ attribute of the plugin class
- <key1>=<value1>: Represent a single interface parameter
Optional interface settings:
- Any number of optional <key>=<value> scan settings separated by comma can be defined
- The <key>=<value> pairs are used as keyword parameters for ‘scan’ method of a plugin class
--timeout <ms>#

Sets timeout when waiting on data over a serial line. The default is 5000 milliseconds.

-f, --family <family>#

Select the chip family.

Options:

lpc5502 | lpc5504 | lpc5506 | lpc5512 | lpc5514 | lpc5516 | lpc5526 | lpc5528 | lpc5534 | lpc5536 | lpc55s04 | lpc55s06 | lpc55s14 | lpc55s16 | lpc55s26 | lpc55s28 | lpc55s36 | lpc55s66 | lpc55s69 | mcxa132 | mcxa133 | mcxa142 | mcxa143 | mcxa144 | mcxa145 | mcxa146 | mcxa152 | mcxa153 | mcxa154 | mcxa155 | mcxa156 | mcxa165 | mcxa166 | mcxa175 | mcxa176 | mcxa275 | mcxa276 | mcxn235 | mcxn236 | mcxn546 | mcxn547 | mcxn946 | mcxn947 | mcxw235 | mcxw236 | nhs52s04

-t, --type <area>#

Required Select PFR partition

Options:

cmpa | cfpa

-r, --revision <revision>#

Chip revision; if not specified, most recent one will be used

-b, --binary <binary>#

Path to the BIN file with PFR data to write.

-y, --yaml <yaml_config>#

Path to the PFR YAML config to write.