cancel
Showing results for 
Search instead for 
Did you mean: 

RAM size is not increasing and giving runtime error

Nitin
Associate III

Hi I am working on SBSFU Application project from STM32U585 project. I have done below changes to the existing project.

1. Added my project code SBSFU_Appli_NonSecure project.

2. Previously this project was assigned 192KB and it was hardly using 3% of it. And now the requirement is of more RAM, I have increased RAM boundry to 256KB as below in STM32U585AIIX_FLASH.ld

RAM (xrw) : ORIGIN = NS_DATA_START, LENGTH = 256KB/*NS_DATA_SIZE*/

3. Now what I am seeing is I am not getting to jump to NS main() after this

"[INF] Jumping to the first image slot"

 

Same kind of experiment I have tried in TFM project and it worked, but I am not able to get the catch here.

Need help, thanks in advance...

@Jocelyn RICARD 

12 REPLIES 12
Nitin
Associate III

Hi Jocelyn, SRAM3 application run it is working out now. I did a small change in unsecure_sram3() definition as below

 

 

static void  unsecure_sram3(uint32_t start, uint32_t end)
{

  MPCBB_ConfigTypeDef MPCBB_desc;
  uint32_t regwrite = 0xffffffff;
  uint32_t index;
  uint32_t block_start = (start - _SRAM3_BASE_NS) / GTZC_MPCBB_BLOCK_SIZE;
  uint32_t block_end = block_start + ((end - start) + 1) / GTZC_MPCBB_BLOCK_SIZE;

  if (start & 0xff)
    /*  Check alignment to avoid further problem  */
    /*  FIX ME  */
    while (1);

  if (HAL_GTZC_MPCBB_GetConfigMem(_SRAM3_BASE_NS, &MPCBB_desc) != HAL_OK)
  {
    /* FIX ME */
    Error_Handler();
  }

  for (index = 0; index < SRAM3_SIZE / GTZC_MPCBB_BLOCK_SIZE; index++)
  {
    /* clean register on index aligned */
    if (!(index & 0x1f))
    {
      regwrite = 0xffffffff;
    }
    if ((index >= block_start) && (index < block_end))
    {
      regwrite = regwrite & ~(1 << (index & 0x1f));
    }
    /* write register when 32 sub block are set  */
    if ((index & 0x1f) == 0x1f)
    {
      MPCBB_desc.AttributeConfig.MPCBB_SecConfig_array[index >> 5] = regwrite;
    }
  }
  if (HAL_GTZC_MPCBB_ConfigMem(_SRAM3_BASE_NS, &MPCBB_desc) != HAL_OK)
    /* FIX ME */
  {
    Error_Handler();
  }
}
 
 
For the sake of completeness of the ticket, I did two more changes in STM32U585AIIX_FLASH.ld as below,
 
.testprotection NS_DATA_START : to be replaced with  .testprotection NS_DATA_START_2:
and
.data (NS_DATA_START+NS_NO_INIT_DATA_SIZE) : AT (__etext) to be replaced with  .data (NS_DATA_START_2+NS_NO_INIT_DATA_SIZE) : AT (__etext)
 
 
But please cross check at your end why debugging is not working since past some time, even with untouch ST release package.
 
I really appreciate your kind support to us. Thank you so much once again.
Nitin

Hello Nitin,

The change in HAL_GTZC_MPCBB_GetConfigMem was not mandatory but this is cleaner. 

Other changes are necessary indeed. I'm sorry I forgot to mention them. If you can edit your post for test protection to add _2 at the end.

For debugging, you must disable the RDP at least. Please also disable HDP and WRP.

If you disabled protection debugger should be able to attach.

Best regards

Jocelyn

 

Hi Jocelyn,

I missed doing that, edited now.

I will try debug thing. Thanks for the clue.

Closing this ticket now. Much thanks for the support.

 

Regards

Nitin