Memory retention over reset?

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

Memory retention over reset?

Jump to solution
2,770 Views
p_shep
Contributor IV

Hello,

Assuming the .ld file is properly setup to ensure nothing is written to memory, are any of the memory areas (DTCM/ITCM/OCRAM) able to retain data over a warm-boot?

And a follow-on: With the FlexRam's ability to re-assign memory. If data was written to one of the banks, and that bank as re-assigned to another memory type, would it be retained? I assume that one would have to work out where in the memory it would be, based on the 32K bank.

Labels (1)
0 Kudos
Reply
1 Solution
2,717 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @p_shep ,

   Thanks for your updated information and sharing.

    When you do the flexRAM reconfiguration, please note, not all the item can be supported, please check the application note AN12077

   https://www.nxp.com/docs/en/application-note/AN12077.pdf

  OCRAM at least 64KB.

  the size of ITCM/DTCM to be a power of two number.

Wish it helps you!

Best Regards,

kerry

View solution in original post

0 Kudos
Reply
6 Replies
2,764 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi p_shep,

  Do you want to re-assign the flexRAM memory in the project after some code is running? Normally, when enter the application code, the flexRAM will be assigned, and as you know, the IDE project will also define the specific memory range in the ld.

So, I don't recommend you do it like that, .ld already give the RAM size, but you do other reassign for the flexRAM, that is not proper.

RAM data will persist until your RAM is power down.

 

Wish it helps you!

If you still have questions about it, please kindly let me know.

Best Regards,

kerry

0 Kudos
Reply
2,763 Views
p_shep
Contributor IV

Hi,

Yes, I have an experimental branch looking at re-assigning the memory at run time, with the linkers set up to the sizes the regions will be after re-assignment, which itself is performed in the systeminit hook, so it's done before all the copying.

 

Thanks for the info on the RAM retention - couldn't find anything stating explicitly either way.

0 Kudos
Reply
2,750 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @p_shep ,

   I think your usage has risk, just as I told you, the compiler will use the determined ld file to compile the code, if you reassign the RAM during the code is running, especially already out of the reset handler.

   Talk about the normal operation of the flexRAM reassignment.

   1. ld use your new assigned configuration

   2. in the reset handler add the register control for the flexRAM reassignment.

 If in the run time you modify it, how you make sure your code won't run to the RAM area which will be used as other RAM, and how you modify the ld files?

Why you need to use this method: reconfigure the flexRAM in the run time?

 

Best Regards,

kerry

  

0 Kudos
Reply
2,740 Views
p_shep
Contributor IV

Normal linker will look something like this:

MEMORY
{
/* Define each memory region */
BOOT_FLASH (rx) : ORIGIN = 0x70000000, LENGTH = 0x20000 /* 128K bytes (Boot Area) */
PROGRAM_FLASH (rx) : ORIGIN = 0x70020000, LENGTH = 0x3e0000 /* 3968K bytes (alias Flash) */
SRAM_DTC (rwx) : ORIGIN = 0x20000000, LENGTH = 0x20000 /* 128K bytes (alias RAM) */
SRAM_ITC (rwx) : ORIGIN = 0x0, LENGTH = 0x20000 /* 128K bytes (alias RAM2) */
SRAM_OC (rwx) : ORIGIN = 0x20200000, LENGTH = 0xc0000 /* 768K bytes (alias RAM3) */
HYPERRAM (rwx) : ORIGIN = 0x60000000, LENGTH = 0x800000 /* 8M bytes (alias RAM5) */
}

Which I've changed to:

MEMORY
{
/* Define each memory region */
BOOT_FLASH (rx) : ORIGIN = 0x70000000, LENGTH = 0x20000 /* 128K bytes (Boot Area) */
PROGRAM_FLASH (rx) : ORIGIN = 0x70020000, LENGTH = 0x3e0000 /* 3968K bytes (alias Flash) */
SRAM_DTC (rwx) : ORIGIN = 0x20000000, LENGTH = 0x38000 /* 224K bytes (alias RAM) */
SRAM_ITC (rwx) : ORIGIN = 0x0, LENGTH = 0x8000 /* 32K bytes (alias RAM2) */
SRAM_OC (rwx) : ORIGIN = 0x20200000, LENGTH = 0xc0000 /* 768K bytes (alias RAM3) */
HYPERRAM (rwx) : ORIGIN = 0x60000000, LENGTH = 0x800000 /* 8M bytes (alias RAM5) */
}

DTCM increase, ITCM decreased

Then we have:

static const flexram_allocate_ram_t ramAllocate =
{
.ocramBankNum = 8, /* 8 * 32K = 256K for OCRAM (unchanged) */
.dtcmBankNum = 7, /* 7 * 32K = 224K for D-TCM */
.itcmBankNum = 1, /* 1 * 32K = 32K for I-TCM */
};

void SystemInitHook (void)
{
/* Re-allocate the RAM from default to expand the more useful fast D-TCM */
FLEXRAM_AllocateRam( (flexram_allocate_ram_t*) &ramAllocate);

}

Where SystemInitHook() is called just inside ResetISR(), well before any copies take place.

I want as much DTCM as I can, to give FreeRTOS all the fast memory for task stacks (new FreeRTOS feature).

 

So yeah, it's experimental, but seems to work!

2,718 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @p_shep ,

   Thanks for your updated information and sharing.

    When you do the flexRAM reconfiguration, please note, not all the item can be supported, please check the application note AN12077

   https://www.nxp.com/docs/en/application-note/AN12077.pdf

  OCRAM at least 64KB.

  the size of ITCM/DTCM to be a power of two number.

Wish it helps you!

Best Regards,

kerry

0 Kudos
Reply
2,701 Views
p_shep
Contributor IV

Ok, thanks, I missed the note on power of 2 requirement. So I'll adjust DTCM to 256K, ITCM to 32K and reduce OCRAM to 224K.

0 Kudos
Reply