NXP BootLoader对应软件简单说明及blhost命令说明

 接触到Kinetis系列芯片,想使用下内置的BootLoader功能,发现官方有现成pc端控制软件blhost,所以尝试着跑着运行下。

但是这个软件只针对特定系列的chip,我分析原因是,这个pc应用程序只能通过发送98 66 98来识别有反应的芯片,没反应的就不支持。

另外发现有一个KinetisFlashTool兼容性好一点,可以发送98 66 98和5A A6来尝试连接BootLoader。

总结如下:

blhost:

缺点:命令行使用,只支持对98 66 98有反馈的芯片

优点:开放,可以通过自定义软件调用

KinetisFlashTool:

优点:图形界面操作简单,控制烧写方便,支持对98 66 98和5A A6两种ping包有反应的chip

缺点:封闭,无法通过自定义的软件调用

 

blhost运行help后的命令说明:

D:\blhost_2.6.2\blhost_2.6.2\bin\win>blhost.exe -h
usage: blhost.exe [-?|--help] [-v|--version] [-p|--port <name>[,<speed>]]
                  [-i|--i2c <name>[,<address>,<speed>]]
                  [-s|--spi <name>[,<speed>,<polarity>,<phase>,lsb|msb]]
                  [-b|--buspal spi[,<speed>,<polarity>,<phase>,lsb|msb] | i2c[,<address>,<speed>] | can[,<speed>,<txid>,<rxid>] | sai[,<speed>]]
                  [-l|--lpcusbsio spi[,<port>,<pin>,<speed>,<polarity>,<phase>]| i2c[,<address>,<speed>]]
                  [-u|--usb [[[[<vid>,]<pid>] | [<path>]]]] [-V|--verbose]
                  [-d|--debug] [-j|--json] [-n|--noping] [-t|--timeout <ms>]
                  -- command <args...>

Options:
  -?/--help                    Show this help
  -v/--version                 Display tool version
  -p/--port <name>[,<speed>]   Connect to target over UART. Specify COM port
                               and optionally baud rate
                                 (default=57600)
                                 If -b, then port is BusPal port
  -i/--i2c <name>[,<address>,<speed>] Connect to target over I2C. Only valid for
                               ARM Linux blhost
                                 name(I2C port), address(7-bit hex), speed(KHz)
                                 (default=0x10,100)
  -s/--spi <name>[,<speed>,<polarity>,<phase>,lsb|msb]
                               Connect to target over SPI. Only valid for ARM
                               Linux blhost
                                 name(SPI port), speed(KHz),
                                 polarity(0=active_high, 1=active_low),
                                 phase(0=rising_edge, 1=falling_edge),
                                 "lsb" | "msb"
                                 (default=100,1,1,msb)
  -b/--buspal spi[,<speed>,<polarity>,<phase>,lsb|msb] |
              i2c[,<address>,<speed>]
              can[,<speed>,<txid>,<rxid>]
              sai[,<speed>]
                               Use SPI or I2C for BusPal<-->Target link
                               All parameters between square brackets are
                               optional, but preceding parameters must be
                               present or marked with a comma.
                               (ex. -b spi,1000,0,1) (ex. -b spi,1000,,lsb)
                                 spi:  speed(KHz),
                                       polarity(0=active_high | 1=active_low),
                                       phase(0=rising_edge | 1=falling_edge),
                                       "lsb" | "msb"
                                       (default=100,1,1,msb)
                                 i2c:  address(7-bit hex), speed(KHz)
                                       (default=0x10,100)
                                 can:  speed(0=125K | 1=250K | 2=500K | 4=1M),
                                       txid (11 bits ID),
                                       rxid (11 bits ID)
                                       (default=4,0x321,0x123)
                                 sai:  speed(Hz),
                                       (default=8000)
  -l/--lpcusbsio spi[,<port>,<pin>,<speed>,<polarity>,<phase>] |
                 i2c[,<address>,<speed>]
                               Connect to target over SPI or I2C of LPC USB
                               Serial I/O
                                 spi: GPIO<port><pin> on LPC USB Serial I/O
                                      used as SPI->SSELn, speed(KHz),
                                      polarity(0=active_high | 1=active_low),
                                      phase(0=rising_edge | 1=falling_edge)
                                      (default=100,1,1)
                                 i2c: address(7-bit hex), speed(KHz)
                                      (default=0x10,100)
  -u/--usb [[[<vid>,]<pid>] | [<path>]]
                               Connect to target over USB HID device denoted by
                               vid/pid (default=0x15a2,0x0073) or device path.
                               If -l, then port is LPC USB Serial I/O port
                               (default=0x1fc9,0x0009), and <path> is ignored.
  -V/--verbose                 Print extra detailed log information
  -d/--debug                   Print really detailed log information
  -j/--json                    Print output in JSON format to aid automation.
  -n/--noping                  Skip the initial ping of a serial target
  -t/--timeout <ms>            Set packet timeout in milliseconds
                                 (default=5000)

Memory ID:
  Internal Memory              Device internal memory space
    0                            Internal Memory
                                 (Default selected memory)
    16 (0x10)                    Execute-only region on internal flash
                                 (Only used for flash-erase-all)
  Mapped External Memory       The memories that are remapped to internal space,

                               and must be accessed by internal addresses.
                               (IDs in this group are only used for flash-erase-all and
                               configure-memory, and ignored by write-memory, read-memory,
                               flash-erase-region and flash-image(use default 0))
    1                            QuadSPI Memory
    8                            SEMC NOR Memory
    9                            FlexSPI NOR Memory
    10 (0xa)                     SPIFI NOR Memory
  Unmapped External Memory     Memories which cannot be remapped to internal space,
                               and only can be accessed by memories' addresses.
                               (Must be specified for all commands with <memoryId> argument)
    256 (0x100)                  SEMC NAND Memory
    257 (0x101)                  SPI NAND Memory
    272 (0x110)                  SPI NOR/EEPROM Memory
    273 (0x111)                  I2C NOR/EEPROM Memory
    288 (0x120)                  uSDHC SD Memory
    289 (0x121)                  uSDHC MMC Memory

** Note that not all memories are supported on all platforms.

Command:
  reset                        Reset the chip
  get-property <tag> [<memoryId> | <index>]
                               Return bootloader specific property.
                               <memoryId> and <index> are required by some properties.
                               <memoryId> = 0, <index> = 0, if not specified.
                               <memoryId> and <index> are ignored for the other properties.
                               If <index> is over the range supported by the device, bootloader
                               will treat as <index> = 0.

    1                          Bootloader version
    2                          Available peripherals
    3                          Start of program flash, <index> is required
    4                          Size of program flash, <index> is required
    5                          Size of flash sector, <index> is required
    6                          Blocks in flash array, <index> is required
    7                          Available commands
    8                          Check Status, <status id> is required
    9                          Last Error
    10                         Verify Writes flag
    11                         Max supported packet size
    12                         Reserved regions
    14                         Start of RAM, <index> is required
    15                         Size of RAM, <index> is required
    16                         System device identification
    17                         Flash security state
    18                         Unique device identification
    19                         FAC support flag
    20                         FAC segment size
    21                         FAC segment count
    22                         Read margin level of program flash
    23                         QuadSpi initialization status
    24                         Target version
    25                         External memory attrubutes, <memoryId> is required
    26                         Reliable update status
    27                         Flash page size, <index> is required
    28                         Interrupt notifier pin
    29                         FFR key store update option set-property <tag> <value>
    10                         Verify Writes flag
    22                         Read margin level of program flash
    28                         Interrupt notifier pin
                               <value>:
                                   bit[31] for enablement, 0: disable, 1: enable

                                   bit[7:0] for GPIO pin index
                                   bit[15:8] for GPIO port index
    29                         FFR key store update option
                               <value>:
                                   0 for Keyprovisioning
                                   1 for write-memory
  flash-erase-region <addr> <byte_count> [memory_id]
                               Erase a region of flash according to [memory_id].

  flash-erase-all [memory_id]  Erase all flash according to [memory_id],
                               excluding protected regions.
  flash-erase-all-unsecure     Erase all internal flash, including protected regions
  read-memory <addr> <byte_count> [<file>] [memory_id]
                               Read memory according to [memory_id] and write to file
                               or stdout if no file specified
  write-memory <addr> [<file>[,byte_count]| {{<hex-data>}}] [memory_id]
                               Write memory according to [memory_id] from file
                               or string of hex values,
                               e.g. data.bin (writes entire file)
                               e.g. data.bin 8 (writes first 8 bytes from file)
                               e.g. "{{11 22 33 44}}" (w/quotes)
                               e.g. {{11223344}} (no spaces)
  fill-memory <addr> <byte_count> <pattern> [word | short | byte]
                               Fill memory with pattern; size is
                               word (default), short or byte
  receive-sb-file <file>       Receive SB file
  execute <addr> <arg> <stackpointer>
                               Execute at address with arg and stack pointer
  call <addr> <arg>            Call address with arg
  flash-security-disable <key> Flash Security Disable <8-byte-hex-key>,
                               e.g. 0102030405060708
  flash-program-once <index> <byte_count> <data> [LSB | MSB]
                               Program Flash Program Once Field
                               <data> is 4 or 8-byte-hex according to <byte_count>
                               <data> output sequence is specified by LSB(Default) or MSB
                               The output sequence of data "1234" is "4,3,2,1" by default,
                               while is "1,2,3,4" if MSB is specified
                               e.g. 0 4 12345678 MSB
  flash-read-once <index> <byte_count>
                               Read Flash Program Once Field
  flash-read-resource <addr> <byte_count> <option> [<file>]
                               Read Resource from special-purpose
                               non-volatile memory and write to file
                               or stdout if no file specified
  configure-memory <memory_id> <internal_addr>
                               Apply configuration block at internal memory address
                               <internal_addr> to memory with ID <memory_id>
  reliable-update <addr>
                               Copy backup app from address to main app region
                               or swap flash using indicator address
  key-provisioning <operation> [arguments...]
                               <enroll>
                                   Key provisioning enroll. No argument for this operation
                               <set_user_key> <type> <file>[,<size>]
                                   Send the user key specified by <type> to bootloader. <file> is
                                   the binary file containing user key plaintext. If <size> is not
                                   specified, the entire <file> will be sent. Otherwise, only send
                                   the first <size> bytes. The valid options of<type> and
                                   corresponding <size> are documented in the target's Reference
                                   Manual or User Manual.
                               <set_key> <type> <size>
                                   Generate <size> bytes of the key specified by
 <type>
                               <write_key_nonvolatile> [memoryID]
                                   Write the key to a nonvolatile memory
                               <read_key_nonvolatile> [memoryID]
                                   Load the key from a nonvolatile memory to bootloader
                               <write_key_store> <file>[,<size>]
                                   Send the key store to bootloader. <file> is the binary file
                                   containing key store. If <size> is not specified, the entire
                                   <file> will be sent. Otherwise, only send the first <size> bytes
                               <read_key_store> <file>
                                   Read the key store from bootloader to host(PC). <file> is the
                                   binary file to store the key store
  load-image <file>
                               Load a boot image to the device via specified interface
  flash-image <file> [erase] [memory_id]
                               Write a formated image <file> to memory with ID
                               <memory_id>. Supported file types: SRecord
                               (.srec and .s19) and HEX (.hex). Flash is erased
                               before writing if [erase]=erase. The erase unit
                               size depends on the target and the minimum erase
                               unit size is 1K.
  list-memory                  List all on-chip Flash and RAM regions, and off-chip
                               memories, supported by current device.
                               Only the configured off-chip memory will be list.

  efuse-program-once <addr> <data> [nolock/lock]
                               Program one word of OCOTP Field
                               <addr> is ADDR of OTP word, not the shadowed memory address.
                               <data> is hex digits without prefix '0x'
  efuse-read-once <addr>
                               Read one word of OCOTP Field
                               <addr> is ADDR of OTP word, not the shadowed memory address.
  program-aeskey <file>
                               Program AES key to OTP Field
                               <file> is a raw binary contains an 128-bits key.  generate-key-blob <dek_file> <blob_file> [key_sel]
                               Generate the Blob for a given DEK
                               <dek_file> - input, a binary DEK(128/192/256 bits) generated
                               by CST tool.
                               <blob_file> - output, a generated blob in binary format.
                               [key_sel] - optional input, select the BKEK used to wrap
                               the BK and generate the blob. For devices with SNVS, valid
                               options of [key_sel] are
                                   0, 1 or OTPMK: OTPMK from FUSE or OTP(default),
                                   2 or ZMK: ZMK from SNVS,
                                   3 or CMK: CMK from SNVS,
                               For devices without SNVS, this option will be ignored.

** Note that not all commands/properties are supported on all platforms.
 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yilonglucky

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值