AnsweredAssumed Answered

how to burn mcuboot into FRDM_K64F Board

Question asked by chen wei on Mar 23, 2018
Latest reply on Mar 27, 2018 by Maureen Helm

Dear All:

I have a problem. It is described as follow:

I need to replace mbed bootloader of freescale frdm_k64 board with mcuboot. I followed the steps described by mcuboot docs :

It is listed in file that located in mcuboot-master/samples/zephyr/Makefile and the content is:

 

# This is an example Makefile to demonstrate how to use mcuboot to
# deploy and upgrade images. The image building should work on any
# supported target, however flashing will likely require changes to
# the flash addresses, depending on the partition layout of the device
# in question.
#
# running
#
# make BOARD=frdm_k64f all
#
# should generate three "*.bin" files in this directory:
#
# mcuboot.bin: The bootloader itself
# signed-hello1.bin: A signed sample.
# signed-hello2.bin: An upgrade image, signed and marked for
# upgrade.
#
# "make flash_boot" should flash the bootloader into the flash,
# erasing the rest of the device. If you examine the device at this
# time, you should see a message about the bootloader not being able
# to find a bootable image.
#
# "make flash_hello1" will then flash the first application into
# "slot0". This should boot into this app, print a small message, and
# give the zephyr console.
#
# "make flash_hello2" will flash hello2 into the second slot. The
# reset should upgrade and run the new image. Resetting again should
# then revert back to the first app, since we did not mark this image
# as good.

 

I compile the code successfully and generate the three files:

[root@localhost zephyr]# ll[root@localhost zephyr]# ll

总用量 478

drwxrwxrwx 1 root root      0 9月  20 2017 bad-keys

-rwxrwxrwx 1 root root  31388 3月  20 18:47 bak.mcuboot.bin

-rwxrwxrwx 2 root root    501 9月  20 2017 build-boot.sh

-rwxrwxrwx 2 root root    510 9月  20 2017 build-hello.sh

drwxrwxrwx 1 root root   4096 3月  22 18:20 hello-world

-rwxrwxrwx 1 root root   9038 9月  20 2017 Makefile

-rwxrwxrwx 1 root root  31312 3月  24 10:35 mcuboot.bin-rwxrwxrwx 1 root root    426 9月  20 2017 README.md

-rwxrwxrwx 1 root root  11640 3月  22 18:24 signed-hello1.bin

-rwxrwxrwx 1 root root 393216 3月  22 18:24 signed-hello2.bin

[root@localhost zephyr]# 

 

the I use pyocd tool to burn these bins into flash of frdm_k64f board:

[root@localhost zephyr]# make flash_boot
pyocd-flashtool -ce -a 0 mcuboot.bin
INFO:root:DAP SWD MODE initialised
WARNING:root:K64F in secure state: will try to unlock via mass erase
WARNING:root:K64F secure state: unlocked successfully
INFO:root:ROM table #0 @ 0xe00ff000 cidr=b105100d pidr=4000bb4c4
INFO:root:[0]<e000e000:SCS-M4 cidr=b105e00d, pidr=4000bb00c, class=14>
WARNING:root:Invalid coresight component, cidr=0x0
INFO:root:[1]<e0001000: cidr=0, pidr=0, component invalid>
INFO:root:[2]<e0002000:FPB cidr=b105e00d, pidr=4002bb003, class=14>
WARNING:root:Invalid coresight component, cidr=0xb1b1b1b1
INFO:root:[3]<e0000000: cidr=b1b1b1b1, pidr=b1b1b1b1b1b1b1b1, component invalid>
WARNING:root:Invalid coresight component, cidr=0x0
INFO:root:[4]<e0040000: cidr=0, pidr=0, component invalid>
INFO:root:[5]<e0041000:ETM-M4 cidr=b105900d, pidr=4000bb925, class=9, devtype=13, devid=0>
INFO:root:[6]<e0042000:ETB cidr=b105900d, pidr=4003bb907, class=9, devtype=21, devid=0>
INFO:root:[7]<e0043000:CSTF cidr=b105900d, pidr=4001bb908, class=9, devtype=12, devid=28>
INFO:root:CPU core is Cortex-M4
INFO:root:FPU present
targetXML:
<?xml version="1.0"?><!DOCTYPE feature SYSTEM "gdb-target.dtd"><Element 'target' at 0x7f87e15de1d8>
xml_root:
<Element 'target' at 0x7f87e15de1d8>
INFO:root:6 hardware breakpoints, 4 literal comparators
INFO:root:4 hardware watchpoints
[====================] 100%
INFO:root:Programmed 32768 bytes (8 pages) at 14.30 kB/s
[root@localhost zephyr]# make flash_hello1
pyocd-flashtool -a 0x20000 signed-hello1.bin
INFO:root:DAP SWD MODE initialised
INFO:root:K64F not in secure state
INFO:root:ROM table #0 @ 0xe00ff000 cidr=b105100d pidr=4000bb4c4
INFO:root:[0]<e000e000:SCS-M4 cidr=b105e00d, pidr=4000bb00c, class=14>
WARNING:root:Invalid coresight component, cidr=0x0
INFO:root:[1]<e0001000: cidr=0, pidr=0, component invalid>
INFO:root:[2]<e0002000:FPB cidr=b105e00d, pidr=4002bb003, class=14>
WARNING:root:Invalid coresight component, cidr=0x1010101
INFO:root:[3]<e0000000: cidr=1010101, pidr=101010101010101, component invalid>
WARNING:root:Invalid coresight component, cidr=0x0
INFO:root:[4]<e0040000: cidr=0, pidr=0, component invalid>
INFO:root:[5]<e0041000:ETM-M4 cidr=b105900d, pidr=4000bb925, class=9, devtype=13, devid=0>
INFO:root:[6]<e0042000:ETB cidr=b105900d, pidr=4003bb907, class=9, devtype=21, devid=0>
INFO:root:[7]<e0043000:CSTF cidr=b105900d, pidr=4001bb908, class=9, devtype=12, devid=28>
INFO:root:CPU core is Cortex-M4
INFO:root:FPU present
targetXML:
<?xml version="1.0"?><!DOCTYPE feature SYSTEM "gdb-target.dtd"><Element 'target' at 0x7f693e1b4c78>
xml_root:
<Element 'target' at 0x7f693e1b4c78>
INFO:root:6 hardware breakpoints, 4 literal comparators
INFO:root:4 hardware watchpoints
[====================] 100%
INFO:root:Programmed 12288 bytes (3 pages) at 10.68 kB/s
[root@localhost zephyr]# pyocd-tool reset
WARNING:root:Invalid coresight component, cidr=0x0
WARNING:root:Invalid coresight component, cidr=0x1010101
WARNING:root:Invalid coresight component, cidr=0x0
targetXML:
<?xml version="1.0"?><!DOCTYPE feature SYSTEM "gdb-target.dtd"><Element 'target' at 0x7f8d0b83d2c8>
xml_root:
<Element 'target' at 0x7f8d0b83d2c8>
Resetting target

 

but when I restarted the board,and I found the mcuboot is not workable. The bootloader is still the mbed bootloader.

That is, The replacement of bootloader is not successful!

 

I think that when frdm_k64f is working in Normal Mode(mapping to Mbed disk),we can not replace it's bootloader.

but I pull the mcuboot.bin into the disk MAINTENANCE (under bootloader upgrade mode),there has  an error. The mcuboot

cannot burn into it.

before burning

 

is burning

 

after burning

 

How can the mcboot burn into the frdm_k64f board as bootloader?

so,I need your help to solve this problem, thank you!

 

best regards!

Outcomes