FLEXSPI_SoftwareReset(base); Crashing RT1060 Dev Board

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

FLEXSPI_SoftwareReset(base); Crashing RT1060 Dev Board

Jump to solution
2,691 Views
chadgraham
Contributor V

Hello,

I have the beginnings of a functional secondary bootloader that I am trying to added a second QSPI to FlexSPI A.  I have a working functional sample that I sucessfully debugged, but I'm having issues adding the functionality to my bootloader.

Whenever I run my bootloader, at the section of code that initializes the FlexSPI bus, the "FLEXSPI_SoftwareReset(base);" command in fsl_flexspi.c causes the program to hard crash.  I am using XIP, which might have something to do with it, but the example nor_polling_transfer also uses XIP so I'm not certain if that is part of the issue.

Other threads have mentioned similar problems.  To date, I have tried using different RAM configurations (SDRAM vs DTC vs ITC) and I have confirmed that the files are generating the compiled output files.  Additionally, I have walked both my bootloader and example projects and can detect no noticeable difference.

Does anyone have any thoughts?

0 Kudos
Reply
1 Solution
2,634 Views
chadgraham
Contributor V

Hello Jing,

Thank you for the assistance.  Ignoring what is actually in the linkscripts folder project, I was successful implementing the FLEXSPI_Init() function call without a reset.

For me, the problem I encountered was specific to resetting the FlexSpi bus while I was in XIP mode.  the linkerscript templates allowed me to shift the fsl_flexqspi.o and my QspiMaster.o files to RAM.  However, the files listed in the example project did not move the files properly. Specifically, I made the linkscripts folder and used only the following files.  (Reference the MCUXpresso IDE User Manual Chapter 17.15.1)

main_data.ldt

*QspiMaster.o(.text*)
*QspiMaster.o(.rodata .rodata.* .constdata .constdata.*)
*fsl_flexspi.o(.text*)
*fsl_flexspi.o(.rodata .rodata.* .constdata .constdata.*)
. = ALIGN(${text_align});
*(.data*)

main_rodata.ldt

*(EXCLUDE_FILE(*QspiMaster.o *fsl_flexspi.o) .rodata)
*(EXCLUDE_FILE(*QspiMaster.o *fsl_flexspi.o) .rodata.*)
*(EXCLUDE_FILE(*QspiMaster.o *fsl_flexspi.o) .constdata)
*(EXCLUDE_FILE(*QspiMaster.o *fsl_flexspi.o) .constdata.*)
*(.rodata .rodata.* .constdata .constdata.*)
. = ALIGN(${text_align});

main_text.ldt

*(EXCLUDE_FILE(*QspiMaster.o *fsl_flexspi.o) .text*)

View solution in original post

0 Kudos
Reply
7 Replies
2,684 Views
chadgraham
Contributor V

Further information.

Upon crashing, the console complains: "assertion "src != NULL" failed: file ".fsl_flexspi.c", line 116, function: FLEXSPI_Memset".

This, to me, seems to imply that the command successfully reset the FlexSPI, but since I'm XIP it doesn't know how to recover.  I'm stuck at trying to determine how this project is different than the sample code that allowed the bus to be reset without blowing up the XIP.

0 Kudos
Reply
2,668 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @chadgraham ,

Here is a demo which use two SPI Flash on FlexSPI A. Please take a look.

 

Regards,

Jing

0 Kudos
Reply
2,665 Views
chadgraham
Contributor V

Hello,

In the Debug\evkmimxrt1060_flexspi_nor_polling_transfer_Debug.ld, there are a couple additions that I cannot figure out how they are implmented.  On line 98, there is "*(EXCLUDE_FILE(*flexspi_nor_flash_ops.o *fsl_flexspi.o) .text*) *(.rodata .rodata.* .constdata .constdata.*)" and on lines 129-130 has " *flexspi_nor_flash_ops.o(.text*) *fsl_flexspi.o(.text*)".

    .text : ALIGN(4)
    {
        *(EXCLUDE_FILE(*flexspi_nor_flash_ops.o *fsl_flexspi.o) .text*)       *(.rodata .rodata.* .constdata .constdata.*)
       . = ALIGN(4);
    } > BOARD_FLASH
    /*
     * for exception handling/unwind - some Newlib functions (in common
     * with C++ and STDC++) use this.
     */
    .ARM.extab : ALIGN(4)
    {
        *(.ARM.extab* .gnu.linkonce.armextab.*)
    } > BOARD_FLASH

    .ARM.exidx : ALIGN(4)
    {
        __exidx_start = .;
        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
        __exidx_end = .;
    } > BOARD_FLASH
 
    _etext = .;
        
    /* DATA section for SRAM_ITC */

    .data_RAM2 : ALIGN(4)
    {
        FILL(0xff)
        PROVIDE(__start_data_RAM2 = .) ;
        PROVIDE(__start_data_SRAM_ITC = .) ;
        *(.ramfunc.$RAM2)
        *(.ramfunc.$SRAM_ITC)
        
        *flexspi_nor_flash_ops.o(.text*)
        *fsl_flexspi.o(.text*)

Where/how is this accomplished?  The C/C++ Build\Tool Setting\MCU Linker\Managed Link Script still has the "Managed linker script" enabled and I do not see anything that would place those functions in RAM.

chadgraham_0-1629138290991.png

 

0 Kudos
Reply
2,659 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

There is some linker template file in linkscripts folder. MCUXpresso IDE can load this files to modify certain aspects of the generated linker script.

jingpan_0-1629195380854.png

 

Regards,

Jing

0 Kudos
Reply
2,651 Views
chadgraham
Contributor V

Hello,

I found the linkscripts and modified them to my application.  The .ld file now looks as I expected, but I'm still no convinced that I've located all of the differences between the apps.

To that end, I am still crashing when I try to reset the FlexSPI bus as part of the FLEXSPI_Init function in fsl_flexspi.c.  Comparing the provided sample and my application, the sp, msp and psp are in the correct memory bank (SDRAM).  However, the lr and pc both still point back to my flash where as the sample application points to RAM.

Would you agree that this is a possible reason the program keeps crashing and how do I go about forcing them to RAM?  Additionally, the trick only seems to work with the SDRAM and won't fit into the other banks.  Why?

bss.ldt

 

<#if memory.name=="BOARD_SDRAM">
*(.bss*)
</#if>

 

data.ldt

 

<#if memory.name=="BOARD_SDRAM">
*QspiMaster.o(.text*)
*QspiMaster_Properties.o(.text*)
*fsl_flexspi.o(.text*)
</#if>

 

main_text.ldt

 

*(EXCLUDE_FILE(*QspiMaster.o *QspiMaster_Properties.o *fsl_flexspi.o) .text*)

 

 

0 Kudos
Reply
2,642 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

You flexspi code is still in flash? You can look into MCUXpresso user guide. It has guide to put data and program in any space. This guide is in MCUXpresso install folder.

 

Regards,

Jing

0 Kudos
Reply
2,635 Views
chadgraham
Contributor V

Hello Jing,

Thank you for the assistance.  Ignoring what is actually in the linkscripts folder project, I was successful implementing the FLEXSPI_Init() function call without a reset.

For me, the problem I encountered was specific to resetting the FlexSpi bus while I was in XIP mode.  the linkerscript templates allowed me to shift the fsl_flexqspi.o and my QspiMaster.o files to RAM.  However, the files listed in the example project did not move the files properly. Specifically, I made the linkscripts folder and used only the following files.  (Reference the MCUXpresso IDE User Manual Chapter 17.15.1)

main_data.ldt

*QspiMaster.o(.text*)
*QspiMaster.o(.rodata .rodata.* .constdata .constdata.*)
*fsl_flexspi.o(.text*)
*fsl_flexspi.o(.rodata .rodata.* .constdata .constdata.*)
. = ALIGN(${text_align});
*(.data*)

main_rodata.ldt

*(EXCLUDE_FILE(*QspiMaster.o *fsl_flexspi.o) .rodata)
*(EXCLUDE_FILE(*QspiMaster.o *fsl_flexspi.o) .rodata.*)
*(EXCLUDE_FILE(*QspiMaster.o *fsl_flexspi.o) .constdata)
*(EXCLUDE_FILE(*QspiMaster.o *fsl_flexspi.o) .constdata.*)
*(.rodata .rodata.* .constdata .constdata.*)
. = ALIGN(${text_align});

main_text.ldt

*(EXCLUDE_FILE(*QspiMaster.o *fsl_flexspi.o) .text*)
0 Kudos
Reply