iMXRT1052 Link Application to RAM

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

iMXRT1052 Link Application to RAM

3,349 Views
jh1
Contributor III

I have a question regarding the linker option: "Link application to RAM" when using Managed Linker Scripts in MCUXpresso IDE (v10.3.1 [Build 2233] [2019-02-20] Manifest for SDK SDK_2.x_EVKB-IMXRT1050 V 2.5.1).


When i look at the resulting map file i can see that the resulting image starts at 0x20000000 which is the beginning of the DTCM-RAM. 

In the Reference Manual it says under "9.6.1.3 FlexSPI NOR boot flow chart" (the image is loaded from a FlexSPI NOR-Flash)

pastedImage_1.png

that the image is copied to the OCRAM. 

So my questions are:

1. Why is the application liked to the DTCM and not to OCRAM?

2. How exactly does the ROM-code figure out that the image is XIP?

Thank you very much,

Johann

0 Kudos
Reply
7 Replies

3,197 Views
jh1
Contributor III

Hi Victor,

i tried the sample with MCUXpresso 11.1.1 and SDK 2.7.0 -> same issue.

I figured out what the problem was:

Linked to DTCM:

pastedImage_2.png

The ocramAddr-pointer is itself located inside the ocram and will be set back with

*ocramAddr = 0xCC; when it reaches its own location creating an endless loop.

The Flash - Version works because the pointer is located in DTCM:

Linked to NOR-Flash:

pastedImage_1.png

In this case the pointer is correctly located on the stack (0x20020000 - 0x2001f000).

I don't really understand why this is happening.

Kind regards,

Johann

0 Kudos
Reply

3,197 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Johann,

I made more tests on my side and I'm still unable to reproduce the behavior that you mentioned. In my case, the example works fine even if select the option Link application to RAM. I'm also using the SDK 2.7 to make these tests and I'm using the onboard debugger with the CMSIS firmware, what debugger are you using? Is there anything I'm missing in my test environment? 

Regards,
Victor

0 Kudos
Reply

3,197 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Johann, 

1. Why is the application liked to the DTCM and not to OCRAM?

When you select the option Link application to Ram in MCUXpresso IDE, the IDE will put the application in the first RAM block that if fines, which is the DTCM. You can easily modify this on the MCU settings of the project. By default you have the following settings: 

pastedImage_2.png

If you want to place the application on the OCRAM memory you will need to select it and send it all the way below the BOARD_FLASH, like shown below: 

pastedImage_3.png

2. How exactly does the ROM-code figure out that the image is XIP?

This is determined by the address that you use when building your application. If when you compile the image you select the FlexSPI address then it detects that the image is XIP, but when you select the internal RAM then it detects that it's non XIP because the address is not from the FlexSPI memory mapped. 

Have a great day,

Victor

-------------------------------------------------------------------------------

Note:

- If this post answers your question, please click the "Mark Correct"button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored

Please open a new thread and refer to the closed one, if you have a related question at a later point in time.

------------------------------------------------------------------------------- 

0 Kudos
Reply

3,197 Views
jh1
Contributor III

Hello Victor,

thx for the clarifications.

I stumbled upon an issue regarding Link to RAM. I was playing around with the exkbimxrt1050_flexram_ram_access - sample. If i execute the code from NOR-Flash everything is as expected but if i use "Link to RAM" and execute the 

code from ITCM (or DTCM, doesn't matter) the application somehow gets stuck. 

It does enter the APP_FLEXRAM_IRQ_HANDLER but then the final printf statement 

PRINTF("\r\nOCRAM access 0x%x to boundary.\r\n", (uint32_t)(ocramAddr));

is not executed. The application also doesn't exit from the loop in OCRAM_Access(). 

If i uncheck the "Link application to RAM" box everything is normal again.

Thank you,

Johann

0 Kudos
Reply

3,197 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Johann, 

What version of the SDK are you using? I ran some tests on the newest version available (2.7) and I wasn't able to reproduce the behavior that you mentioned. 

Regards, 

Victor 

0 Kudos
Reply

3,197 Views
jh1
Contributor III

Hi Victor,

as mentioned above i'm using SDK SDK_2.x_EVKB-IMXRT1050 V 2.5.1.

Are you sure you tried with the NOR-Flash (not the Hyperflash) incl. the necessary adjustments regarding driver and xip.

I use MIMXRT1050-EVK_IS25WP064A.cfx

and the following config (in evkbimxrt1050_flexspi_nor_config.c):

const flexspi_nor_config_t qspiflash_config = {
.memConfig =
{
.tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION,
.readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad,
// .readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackInternally,
.csHoldTime = 3u,
.csSetupTime = 3u,
.sflashPadType = kSerialFlash_4Pads,
// .serialClkFreq = kFlexSpiSerialClk_100MHz,
.serialClkFreq = kFlexSpiSerialClk_133MHz,


.sflashA1Size = 8u * 1024u * 1024u,


.lookupTable =
{
// Read LUTs
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18),
FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04),
},
},
.pageSize = 256u,
.sectorSize = 4u * 1024u,
.blockSize = 256u * 1024u,
.isUniformBlockSize = false,
};

Kind regards,

Johann

0 Kudos
Reply

3,197 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Johann,

I have my EVK configured to boot from the Hyperflash, not the QSPI flash, but since the problem is when you select the option "Link Application to RAM" it doesn't matter which external memory you have configured.

Could you please try to reproduce this issue with version 2.7.0 of the SDK?

Regards,
Victor

0 Kudos
Reply