This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Concurrently using XIP and QSPI to read back data from external flash

Dear Nordic,

I have a 4MB external flash on my board, I've successfully run the code on it by using XIP. However, I got stuck when I was trying to read back data from external flash. The following picture has the call stack trace. It's a failure of NRFX_ASSERT.

Some more details:

Using nrfx driver both in bootloader and application is not a good idea, because the driver status is stored in the different RAM area. I add a fake initialization function for QSPI to keep the peripheral status consistent. Do you have any better ideas?

Best Regards,

Eugene

Parents
  • Hi Eugene, 

    We are releasing the PAN and the workaround for the issue. I attached here the draft version:

    Condition

    Code executing from internal flash or RAM reads data located in XIP region.
    The read performs two consecutive LDR instructions from XIP addresses, where the result of the first LDR instruction is used as the address of the second LDR. This occurs when dereferencing a pointer located in the XIP addresses

    Result

    • Data read from XIP area is incorrect.

    Workaround

    To avoid the race condition, where code executing in internal memory accesses data stored in the XIP region, perform one of the following:
    * Copy the read-only data into internal RAM before accessing it by the use of the memcpy() function.
    * Place the read-only data in internal flash memory at compile time in the linker script

    I'm not sure the issue you are experiencing now is exactly the issue described in the PAN. Could you check if it is ? And could you try the workaround to use memcpy()? 

    (Please don't redistribute the PAN before it's published)

Reply
  • Hi Eugene, 

    We are releasing the PAN and the workaround for the issue. I attached here the draft version:

    Condition

    Code executing from internal flash or RAM reads data located in XIP region.
    The read performs two consecutive LDR instructions from XIP addresses, where the result of the first LDR instruction is used as the address of the second LDR. This occurs when dereferencing a pointer located in the XIP addresses

    Result

    • Data read from XIP area is incorrect.

    Workaround

    To avoid the race condition, where code executing in internal memory accesses data stored in the XIP region, perform one of the following:
    * Copy the read-only data into internal RAM before accessing it by the use of the memcpy() function.
    * Place the read-only data in internal flash memory at compile time in the linker script

    I'm not sure the issue you are experiencing now is exactly the issue described in the PAN. Could you check if it is ? And could you try the workaround to use memcpy()? 

    (Please don't redistribute the PAN before it's published)

Children
No Data
Related