Hard fault when reading flash beyond 0x60800000

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Hard fault when reading flash beyond 0x60800000

跳至解决方案
1,054 次查看
pm_2552
Contributor III

Summary:
I am testing the mcuboot_opensource bootloader with two applications of size 0x50_0000 but when I try to read the trailer of secondary image at address 0x60A3_FFF0, it results in Hardfault.

Details and steps to reproduce:
The primary application bin size is 0x50_0000 and start at 0x6004_0000.

The secondary application bin size is also 0x50_0000 and starts at 0x6054_0000.

#define BOOT_FLASH_BASE 0x60000000
#define BOOT_FLASH_ACT_APP 0x60040000
#define BOOT_FLASH_CAND_APP 0x60540000

The primary and secondary application are the basic hello world application with the change in the size and starting address. The images are signed using the following command:

python3 imgtool.py sign --key <MCUXpressoIDE_11.8.0_1165>/workspace/evkbmimxrt1060_mcuboot_opensource/keys/sign-rsa2048-priv.pem --align 4 --header-size 0x400 --pad-header --slot-size 0x500000 --max-sectors 800 --version "1.2.2+1" --pad --confirm <path_to>/evkbmimxrt1060_hello_world.bin <dest_path>/hello_world_60540000_500000_signed_1221.bin

I have flashed the two applications in flash at the correct addresses mentioned above.

The bootloader is able to read the image headers for both images and the image trailer only for the first image. When it tries to read image trailer for the second image, it results in Hard fault and trace points to

memcpy(buffer_u8, flash_ptr, readsize);

during flash_area_read in flash_api.c

Is there any restriction on the max flash address that can be used? Or rather is there any flag that restricts from writing into flash beyond a certain address?

I checked the memory during a debug session and the flash was written only till 0x6080_0000. Will attach a screenshot if the steps are not clear.

MCUXpressoIDE: 11.8.0

SDK: 2.14.0

sdk id: SDK_2.x_MIMXRT1060-EVKB

Board: MIMXRT1060-EVKB

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
994 次查看
pm_2552
Contributor III

For others who might come across this issue.
This will not be seen if you are using the same NOR flash which is 8MB. 6080_0000 is the end address of the NOR flash and so accessing addresses beyond that point will result in Hardfault.
If you increase the flash size, please modify the qspi flash config corresponding to the board in <board>_flexspi_nor_config.c

The 'sflashA1Size' value is the flash size.

在原帖中查看解决方案

0 项奖励
回复
1 回复
995 次查看
pm_2552
Contributor III

For others who might come across this issue.
This will not be seen if you are using the same NOR flash which is 8MB. 6080_0000 is the end address of the NOR flash and so accessing addresses beyond that point will result in Hardfault.
If you increase the flash size, please modify the qspi flash config corresponding to the board in <board>_flexspi_nor_config.c

The 'sflashA1Size' value is the flash size.

0 项奖励
回复