blhost how to offset flash-image

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

blhost how to offset flash-image

Jump to solution
1,825 Views
wilkinsw
Contributor III

I've ported mcuboot to MCUXpresso and am trying to use blhost to flash an image with the following command:

$ blhost -- flash-image blink.hex erase

This returns the following:

Ping responded in 1 attempt(s)
Inject command 'flash-image'
Wrote 96300 bytes to address 0x10000000
Successful generic response to command 'write-memory'
Data phase write aborted by status 0x2712 kStatus_AbortDataPhase
Response status = 10200 (0x27d8) kStatusMemoryRangeInvalid

Apparently it's trying to write the image to the start of flash (0x10000000), which of course isn't going to work.  How do I make blhost put the image after the bootloader in unreserved flash?

On a possibly related not if I get property 11 I see that the bootloader is reserving literally all memory addresses.  How would I go about fixing that?

Ping responded in 1 attempt(s)
Inject command 'get-property'
Response status = 0 (0x0) Success.
Response word 1 = 268435456 (0x10000000)
Response word 2 = 536879103 (0x20001fff)
Response word 3 = 268435456 (0x10000000)
Response word 4 = 537001983 (0x2001ffff)
Reserved Regions = Flash: 0x10000000-0x20001FFF (256.008 MB), RAM: 0x10000000-0x2001FFFF (256.125 MB)

0 Kudos
1 Solution
1,382 Views
wilkinsw
Contributor III

Looked through the source and found that the address comes from the hex file.  I had to divide the flash region of my test project to have a 48KB space for the bootloader with the project code starting at address 0x1000c000.  Everything seems to be in order now

View solution in original post

0 Kudos
3 Replies
1,382 Views
nguyentam
Contributor I

You can use command line with blhost : " blhost -p COMx -- flash-image blink.hex erase" for update hex file through bootloader. It's ok.

0 Kudos
1,383 Views
wilkinsw
Contributor III

Looked through the source and found that the address comes from the hex file.  I had to divide the flash region of my test project to have a 48KB space for the bootloader with the project code starting at address 0x1000c000.  Everything seems to be in order now

0 Kudos
1,382 Views
wilkinsw
Contributor III

Looks like I hadn't defined __DATA_END properly, it should be (__DATA_ROM + (_edata - _data))

I also had to adjust __RAM_START and __RAM_END to count from the end of RAM

My reserved flash is now only 48KB, much more reasonable:

Ping responded in 1 attempt(s)
Inject command 'get-property'
Response status = 0 (0x0) Success.
Response word 1 = 268435456 (0x10000000)
Response word 2 = 268484607 (0x1000bfff)
Response word 3 = 537001983 (0x2001ffff)
Response word 4 = 537001984 (0x20020000)
Reserved Regions = Flash: 0x10000000-0x1000BFFF (48 KB), RAM: 0x2001FFFF-0x20020000 (2 bytes)

0 Kudos