fl_startImageAddAt offset problems

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
malo
Active Member
Posts: 33
Joined: Fri Sep 16, 2016 9:03 pm
Contact:

fl_startImageAddAt offset problems

Post by malo »

Hello,

creating flash image with the following command:

xflash -v --factory app_1.xe 409600 --loader loader.xc --upgrade 1 app_2.xe 409600 --upgrade 2 app_3.xe 409600 --upgrade 3 app_4.xe 409600 --boot-partition-size 1892352 --data data_partition.bin --no-compression --noinq -o flash.bin

having four app images with equal size 409600 B and custom loader.xc

In the the output flash.bin file all looks fine, can see non zero data at addresses 0x0, 0x64000, 0xC8000 and 0x12C000 - perfect.

doing flash dump from the app_1 with hw_flash_get_factory_image & hw_flash_get_next_boot_image after the image write with xtag - looks ok as well.
app1 start 0xEFC len 409600
app2 start 0x64000 len 409600
app3 start 0xC8000 len 409600
app4 start 0x12C000 len 409600

The problem arises when app2 is erased (power off while doing ImageReplace) and new app2 is flashed with fl_startImageAddAt, fl_writeImagePage and fl_endWriteImage.

From the fl_startImageAddAt doc - offset Offset of this image write from the base of the first sector after the factory image.

So setting offset to 0 while calling fl_startImageAddAt and doing flash dump again gives me app2 start at 0x65000 - one sector further then expected 0x64000?

Seems to me like fl_startImageAddAt is taking into the account that app1 starts at 0xEFC while the rest of the tools do not?

ideas?
any help would be appreciated sine I would like to keep the full control of image addresses in the flash.

wbr
malo


User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Hi malo.
app1 start 0xEFC len 409600
app1 = factory image and starts @ 0xEFC. Length = 409600 bytes (dec) = 64000 bytes (hex). So your factory image ends @ 64EFC (hex).

Assuming that your flash device is based on 4k sector boundaries = 1000 (hex), the NEXT free sector after the ENDing of 64EFC address will be 65.

If you align your image data to reflect the sector boundary of your flash device then it should work out correctly. The tool is ignoring your fixed start address for app2 because if the tool follows your defined start address of app2 then some of your app1 image will be over written and corrupted (64000 to 64EFC of app1 will be corrupted). Please confirm these details.
malo
Active Member
Posts: 33
Joined: Fri Sep 16, 2016 9:03 pm
Contact:

Post by malo »

Hello,

in the command
xflash -v --factory app_1.xe 409600 --loader loader.xc --upgrade 1 app_2.xe 409600 --upgrade 2 app_3.xe 409600 --upgrade 3 app_4.xe 409600 --boot-partition-size 1892352 --data data_partition.bin --no-compression --noinq -o flash.bin

Im just setting the image lengths and looks to me, like something is added by the flash tool the very beginning of the flash image that my app_1 does not start at address 0 (assume some bootstrapping xmos code?)
I can not set the start address of my app_1 - 0xEFC - this value is returned by the hw_flash_get_factory_image - startAddress but I can not change it (can I?)

Surprisingly when examining output flash image file - assume xmos bootstrap code is included there, app_2 starts at address 0x64000 (409600) - seems like xflash command is ignoring the fact that app_1 does not start at addr 0 in the flash?
Im getting the same address 0x64000 of the app_2 when getting the info with hw_flash_get_next_boot_image.

Seems to me like fl_startImageAddAt is working correctly taking real start of the app_1 address and length while xflash command is ignoring real start address of the app_1.

wbr
malo
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Thanks for the rewording. I think it is clear now.There is a flash loader placed @ offset 0 in the flash.

You can customize this flash loader:

https://www.xmos.com/support/tools/docu ... ash-loader

Could be a tool bug so can you raise a ticket on xmos.com website?

Please update this thread when you have a resolution.
malo
Active Member
Posts: 33
Joined: Fri Sep 16, 2016 9:03 pm
Contact:

Post by malo »

Hello,

thanks for you assistance.
Created ticket Id: 31175 - https://www.xmos.com/rt4/SelfService/Di ... l?id=31175

wbr
malo
aelder
Active Member
Posts: 37
Joined: Mon Sep 24, 2012 1:45 pm

Post by aelder »

Is this fixed now?
aelder
Active Member
Posts: 37
Joined: Mon Sep 24, 2012 1:45 pm

Post by aelder »

We have run in to the same bug!
malo
Active Member
Posts: 33
Joined: Fri Sep 16, 2016 9:03 pm
Contact:

Post by malo »

Hello,

welcome in the club:)
I have created the ticked but seems that it disappeared from the xmos.com ticket system, so I would say that it is not fixed...

wbr
malo
aelder
Active Member
Posts: 37
Joined: Mon Sep 24, 2012 1:45 pm

Post by aelder »

We have given up using a length spec for the factory image. It won't work.
- Andrew
Post Reply