[i.MX RT1064] FlexSPI NOR ROM API get_config writes to flash when using DDR option

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

[i.MX RT1064] FlexSPI NOR ROM API get_config writes to flash when using DDR option

225 次查看
jar
Contributor I

Hello!

I'm currently developing a custom firmware update mechanism on the MIMXRT1064 CVL5B processor. For the most part things are working as expected, but I noticed that the checksum for the firmware image in flash memory wasn't correct. After some investigating I realized that the get_config function of the FlexSPI NOR ROM API writes some values (a test pattern?) to address 0x70000200.

I'm running my code using the FlexSPI NOR XIP configuration from SDK_25_09_00_MIMXRT1064xxxxB/boards/evkmimxrt1064/xip/evkmimxrt1064_flexspi_nor_config.c/h.

The ROM API gets called from a function running from RAM (using IAR's __ramfunc keyword) with interrupts disabled:

#define g_bootloaderTree ((bootloader_api_entry_t *)*(uint32_t *)0x0020001c)
flexspi_nor_config_t nor_config = {0};
serial_nor_config_option_t nor_option = {.option0.U = 0xc0100003, .option1.U = 0};

status_t status = g_bootloaderTree->flexSpiNorDriver->get_config(1, &nor_config, &nor_option);

 

Flash memory before running the code:

0x70000200: ff ff ff ff ff ff ff ff
0x70000208: ff ff ff ff ff ff ff ff

 

Flash memory after running the code:


0x70000200: 00 11 22 33 44 55 66 77
0x70000208: 88 99 aa bb cc dd ee ff

 

Interestingly enough this doesn't happen when I set option0 to 0xc0000008 instead of 0xc0100003, but the second value results in a better read performance so I would prefer to keep using it. I have also tried to use the configuration I get from get_config directly as the qspiflash_config in the XIP boot header but that doesn't solve the issue either.

Is this expected behaviour or some kind of error? I didn't see anything about this in the documentation.

Best regards
Jan

标签 (1)
0 项奖励
回复
2 回复数

101 次查看
IsaulO
NXP Employee
NXP Employee

Hello @jar ,

ROM APIs documentation is located in the Reference Manual, it appears to be a simple testing pattern, however the specific process that the get_config function executes is not public, on the other hand you can check the following community thread which provide more useful info about the get_config function: Solved: Re: FlexSPI ROM API get_config - NXP Community

BR,
IsaulO.

0 项奖励
回复

61 次查看
jar
Contributor I

Hello @IsaulO ,

thank you for your reply!

I'm pretty sure I came across the thread you linked when I was first trying to understand the FlexSPI NOR configuration and ROM APIs and it was very helpful.

Unfortunately, I didn't see anything about the get_config function writing to the flash. It's not really a behaviour I would expect from a function like that so I was hoping to get some clarification on that aspect of the ROM API.

I also noticed that the memory that gets overwritten could potentially be used as the secondary image table for redundant boot support as described in section 9.6.3.4 "Redundant boot support for expansion device" (i.MX RT1064 Processor Reference Manual, Rev. 2, 07/2021). But I'm not sure if the internal flash memory counts as an expansion device in this case or if that section is only relevant when you boot from SD/MMC. One interesting detail is that the secondary image table contains a tag entry that must be equal to 0x00112233 but I think the offset doesn't match.

Best regards
Jan

0 项奖励
回复