kStatusMemoryCumulativeWrite error using blhost with K66

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

kStatusMemoryCumulativeWrite error using blhost with K66

4,091 Views
beth_altshuler
Contributor I

Hello,

I am using the Freedom K66 on the demo board.   I have the freedom_bootloader running from SDK 2.5.0.   I have been trying to load the led_demo_freedom_0000.bin created by IAR Release, but I get the following error.  Even though it says it wrote all of the bytes of the app, the led demo app does not work after a reset.    I verified that the led_demo app works successfully on the board / K66 when downloaded via MCU Expresso.  Please explain how to fix this.

Thanks,

Beth

C:\Work\Beth\Bootloader_Demo>blhost -u -- get-property 1
Inject command 'get-property'
Response status = 0 (0x0) Success.
Response word 1 = 1258424064 (0x4b020700)
Current Version = K2.7.0

C:\Work\Beth\Bootloader_Demo>blhost -u -- get-property 12
Inject command 'get-property'
Response status = 0 (0x0) Success.
Response word 1 = 0 (0x0)
Response word 2 = 49151 (0xbfff)
Response word 3 = 536805376 (0x1fff0000)
Response word 4 = 536820223 (0x1fff39ff)
Reserved Regions =
Region0: 0x0-0xBFFF (48 KB)
Region1: 0x1FFF0000-0x1FFF39FF (14.500 KB)


C:\Work\Beth\Bootloader_Demo>blhost -u -- write-memory 0xC000 led_demo_freedom_0000.bin
Inject command 'write-memory'
Preparing to send 2028 (0x7ec) bytes to the target.
Successful generic response to command 'write-memory'
(1/1)100% Completed!
usbhid: received data phase abort
Response status = 10203 (0x27db) kStatusMemoryCumulativeWrite
Wrote 2028 of 2028 bytes.

0 Kudos
Reply
14 Replies

3,600 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Beth,

    This is the blhos with usb port result:

pastedImage_1.png

pastedImage_2.png

So, both blhost and KinetisFlashTool works OK on my side, I also use the newest SDK, that's why I recommend you use my generated .bin file directly.

Please try it again on your side.

If you still have question about it, please kindly let me know.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

3,600 Views
beth_altshuler
Contributor I

Hello Kerry,

I have had a chance to try your bootloader.hex file.  This sequence of events below is repeatable.  

I loaded the Hello World program via MCU Expresso and JLink.  Works fine – I see the text get printed.  Then I use IAR to download the bootloader.hex file that you sent me.

 

Tue Jan 22, 2019 14:36:31: Target reset

Tue Jan 22, 2019 14:36:32: Downloaded C:\NXP_Kerry\freedom_bootloader.hex\freedom_bootloader.hex to flash memory.

Tue Jan 22, 2019 14:36:32: IAR Embedded Workbench 8.30.2 (C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.1\arm\bin\armproc.dll)

 

If I don’t do anything else, but hit the reset button on the development board, the LED Demo app starts running.  I didn’t even load the LED.bin file.  What is ‘hidden’ in this hex file?

 

Questions

Why would the LED demo program (alternating blue, red, green) run if I haven’t loaded the .bin file for this demo?

Why can’t the blhost.exe program erase everything?   It says it does, but the proof isn’t there from the output you sent.  

C:\NXP_Kerry\led_demo_freedom_c000.bin>blhost -u -- read-memory 0 64
Inject command 'read-memory'
Successful response to command 'read-memory'
00 3a ff 1f 11 04 00 00 89 04 00 00 69 61 00 00
7d 61 00 00 85 61 00 00 8b 61 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 89 04 00 00
89 04 00 00 00 00 00 00 89 04 00 00 89 04 00 00
(1/1)100% Completed!
Successful generic response to command 'read-memory'
Response status = 0 (0x0) Success.
Response word 1 = 64 (0x40)
Read 64 of 64 bytes.
C:\NXP_Kerry\led_demo_freedom_c000.bin>blhost -u -- flash-erase-all
Inject command 'flash-erase-all'
Successful generic response to command 'flash-erase-all'
Response status = 0 (0x0) Success.
C:\NXP_Kerry\led_demo_freedom_c000.bin>blhost -u -- read-memory 0 64
Inject command 'read-memory'
Successful response to command 'read-memory'
00 3a ff 1f 11 04 00 00 89 04 00 00 69 61 00 00
7d 61 00 00 85 61 00 00 8b 61 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 89 04 00 00
89 04 00 00 00 00 00 00 89 04 00 00 89 04 00 00
(1/1)100% Completed!
Successful generic response to command 'read-memory'
Response status = 0 (0x0) Success.
Response word 1 = 64 (0x40)
Read 64 of 64 bytes.
Thank-you,
Beth
0 Kudos
Reply

3,600 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Beth,

   Thank you for your updated information.

   Answer your question:

1.Why would the LED demo program (alternating blue, red, green) run if I haven’t loaded the .bin file for this demo?

   Do you mean after you download the bootloader, then the LED works automatically?

   If yes, this situation should caused you already download the app in the 0XC000 before.

   You can try to use : unlock kinetis, in the JLINK commander, then download the the bootloader again, the app can't work now, because no APP.

2.Why can’t the blhost.exe program erase everything?   It says it does, but the proof isn’t there from the output you sent.

  You need to use the erase command in the blhost, it won't do it automatically.

Wish it helps you!

If you still have question about it, please kindly let me know.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

3,600 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Beth,

   What the bootloader you are using now?

    As you know, the K66 don't have the ROM bootloader, so you need to use the flash bootloader, you can use the freedom_bootloader in this folder:

SDK_2.5.0_FRDM-K66F\boards\frdmk66f\bootloader_examples\freedom_bootloader

  Now, please note, this project default relocated address is 0XA000, if you want to relocate to 0XC000, please modify the bootloader_config.h

  #define BL_APP_VECTOR_TABLE_ADDRESS 0xc000

Then, this bootloader will relocate the app to 0XC000.

You can build and download this bootloader to your K66 at first.

Now, you can use the blhost or kinetisflash tool to download your app code.

Before you download you app, you need to modify your app, and relocate it to 0XC000, you can use this project:

SDK_2.5.0_FRDM-K66F\boards\frdmk66f\bootloader_examples\demo_apps\led_demo_freedom_a000

pastedImage_1.png

Then generate the .bin or .hex code, use the blhost or kinetisflash tool to download it.

This is my test result:

pastedImage_2.png

You can find my test result, no errors, it works ok on my board!

I also attach my bootloader and app code for your reference. All relocate to 0XC000.

Wish it helps you!

If you still have question about it, please kindly let me know.
Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

3,600 Views
beth_altshuler
Contributor I

Hi Kerry,

Thank-you for your reply.  I am still not able to get the led demo app to download.  I also found some other problems with blhost documented below.   Thank-you for your assistance.

Beth 

-------------------------------------------------------------------------------------------------------------------------------------------------------

I had originally tried sending the app to address 0xA000, but would receive the error of 'kStatusMemoryRangeInvalid'.  I am running the freedom bootloader as you mentioned on the demo board.

C:\Work\Beth\Bootloader_Demo>blhost -u -- get-property 1
Inject command 'get-property'
Response status = 0 (0x0) Success.
Response word 1 = 1258424064 (0x4b020700)
Current Version = K2.7.0
C:\Work\Beth\Bootloader_Demo>blhost -u -- get-property 12
Inject command 'get-property'
Response status = 0 (0x0) Success.
Response word 1 = 0 (0x0)
Response word 2 = 49151 (0xbfff)
Response word 3 = 536805376 (0x1fff0000)
Response word 4 = 536820223 (0x1fff39ff)
Reserved Regions =
        Region0: 0x0-0xBFFF (48 KB)
        Region1: 0x1FFF0000-0x1FFF39FF (14.500 KB)

C:\Work\Beth\Bootloader_Demo>blhost -u -- write-memory 0xA000 led_demo_freedom_0000.bin
Inject command 'write-memory'
Preparing to send 2028 (0x7ec) bytes to the target.
Successful generic response to command 'write-memory'
(1/1)100% Completed!
usbhid: received data phase abort
Response status = 10200 (0x27d8) kStatusMemoryRangeInvalid
Wrote 2028 of 2028 bytes.
I made the change to .icf, and tried again, but get same error.   

/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x0000C000; //  WHAT WAS HERE  = __ICFEDIT_region_FLASH_start__;
/*-Sizes-*/
C:\Work\Beth\Bootloader_Demo>blhost -u -- write-memory 0xC000 led_demo_freedom_0000.bin
Inject command 'write-memory'
Preparing to send 2028 (0x7ec) bytes to the target.
Successful generic response to command 'write-memory'
(1/1)100% Completed!
usbhid: received data phase abort
Response status = 10203 (0x27db) kStatusMemoryCumulativeWrite
Wrote 2028 of 2028 bytes.
After this, I tried some other basic commands through blhost.  I tried to erase everything, checking contents before and after.  The erase does not work either, although from output of blhost it says that it does the erase.  However, the read after shows that it didn't work.
C:\Work\Beth\Bootloader_Demo>blhost -u -- read-memory 0 64
Inject command 'read-memory'
Successful response to command 'read-memory'
00 3a ff 1f 11 04 00 00 89 04 00 00 69 61 00 00
7d 61 00 00 85 61 00 00 8b 61 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 89 04 00 00
89 04 00 00 00 00 00 00 89 04 00 00 89 04 00 00
(1/1)100% Completed!
Successful generic response to command 'read-memory'
Response status = 0 (0x0) Success.
Response word 1 = 64 (0x40)
Read 64 of 64 bytes.
C:\Work\Beth\Bootloader_Demo>blhost -u -- flash-erase-all
Inject command 'flash-erase-all'
Successful generic response to command 'flash-erase-all'
Response status = 0 (0x0) Success.
C:\Work\Beth\Bootloader_Demo>blhost -u -- read-memory 0 64
Inject command 'read-memory'
Successful response to command 'read-memory'
00 3a ff 1f 11 04 00 00 89 04 00 00 69 61 00 00
7d 61 00 00 85 61 00 00 8b 61 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 89 04 00 00
89 04 00 00 00 00 00 00 89 04 00 00 89 04 00 00
(1/1)100% Completed!
Successful generic response to command 'read-memory'
Response status = 0 (0x0) Success.
Response word 1 = 64 (0x40)
Read 64 of 64 bytes.
C:\Work\Beth\Bootloader_Demo>blhost -u -- get-property 1
Inject command 'get-property'
Response status = 0 (0x0) Success.
Response word 1 = 1258424064 (0x4b020700)
Current Version = K2.7.0
0 Kudos
Reply

3,600 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Beth Altshuler,

     Do you try the kinetis flash tool like me?

     Whether that tool also have problems?

    BTW, please also tell me, where you get the blhost, the newest SDK kboot package?

   Please tell me the details, then I will help you to test the blhost on my side.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

3,600 Views
beth_altshuler
Contributor I

Hi Kerry,

Here are the versions I am using and the date the SDK was built with the mcu-boot option.

I can run the KFT, it says it works, but even after resetting, hard by me, to board, LED is still not blinking. Similar to blhost -- it thinks it works, but it isn't.   I have loaded the app separately via MCU Expresso and it works just fine.

Please let me know if you need any other information.

Thank-you,

Beth

0 Kudos
Reply

3,600 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Beth,

     Please use the my bootloader code and the app code which located to 0XC000, that works OK on my side with KFT, after reset, you need to wait about 5 seconds, then the led will blink.

   1. Download freedom_bootloader.hex.zip to your K66 chip, this is the bootloader code.

    2. Press the reset button, then use the KFT to connect your K66 chip with uart, and download the my app:

led_demo_freedom_c000.bin.zip

  This code works OK on my side, please try my generated files.

  Whether it works OK on your side or not?

   If it still can't work, please check your NMI pin, whether it is high during reset?


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

3,600 Views
beth_altshuler
Contributor I

Hi Kerry,

I can try your files, but what revisions are they from?

It doesn't look like my screenshots came through on my previous posting.  I downloaded KDS 3.2.0 and SDK2.5 on Dec 18, 2018.   It didn't matter whether I used blhost or the Flash Tool, both 'think' that they work, but do not.   

I would like to know why the version that I downloaded in December does not work?   Using some previous version (unknown) when bugs exist in newer versions is not helpful.

Thanks,

Beth Altshuler

0 Kudos
Reply

3,600 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Beth Altshuler,

    I also use the SDK2.5 version, you can check my first reply:

SDK_2.5.0_FRDM-K66F\boards\frdmk66f\bootloader_examples\freedom_bootloader

   But, just as I have told you, I didn't relocated to flash address 0XA000, I am using the IAR project, you can check my first reply picture, I relocate the app address to 0XC000, because I find after build, the bootloader size already larger than 0XA000, but small than 0xc000, that's why I suggest you also relocated to 0XC000, and try my generated files.

  Please test my generated code first, I also use the SDK2.5, then same as you, my generated code works OK on my frdm-k66 board with KinetisFlashTool.

  After you try my generated code, tell me the test result.

  You said you are using KDS, but in the SDK generated tool, the toolchian IDE don't have the KDS version, how you generate it? Maybe you need to use the MCUXrpesso IDE instead of the KDS:

pastedImage_2.png

 If your FRDM-K66 board on board debugger is using the JLINK firmware, you can use the JLINK commander to do the mass erase at first, then just follow my way to test my generated code, after make your board works, then we can check more details:

1. Change the opensda firmware to JLINK firmware, please check this link:

  www.nxp.com/opensda

2. use JLINK commander(find in the JLINK driver) to do the mass erase: unlock kinetis

pastedImage_4.png

3. Send my file:freedom_bootloader.hex to the FRDM-K66FJ

pastedImage_5.png

4, Then open the kinetis flash tool, also use my led_demo_freedom_c000.bin

pastedImage_6.png

After updated it, wait about 5 seconds, the led will blink.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

3,600 Views
beth_altshuler
Contributor I

Hi Kerry,

I wasn't able to get to it today.  Hopefully, tomorrow.   Could you also send the blhost program from your package?

Thanks,

Beth

0 Kudos
Reply

3,600 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Beth Altshuler,

   This is the blhost using the com test result:

pastedImage_1.png


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

3,600 Views
beth_altshuler
Contributor I

Hello,

I am using K66, not K82.

Beth

0 Kudos
Reply

3,600 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Beth,

   Sorry, it's just mistyping, I have tested the K66, you can check my first reply:

SDK_2.5.0_FRDM-K66F\boards\frdmk66f\bootloader_examples\freedom_bootloader


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply