cancel
Showing results for 
Search instead for 
Did you mean: 

Running into restricted memory issues with STM32H742VIT6?

briankaz
Associate III

Hello,

I'm having issues with software behaving inconsistently and freezing when I add certain lines, try to access certain variables, etc.  I suspect maybe it has something to do with the restricted flash regions in the MCU.  Is there any way around this?  Can I "democratize" the whole flash and eliminate all of these restrictions somehow?

Here are my ROM/RAM settings in my project in Keil, if it is helpful for answering my question: options_target.png

Thanks to anyone who can help make my project compile and run according to my actual code!
-Brian

9 REPLIES 9
KDJEM.1
ST Employee

Hi @briankaz ,

Which version of Keil do you use?

I think that the issue is due to breakpoints. 

Could you please try to disable this behavior by following the instructions provided  here.

I hope this help you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

SofLit
ST Employee

Hello @briankaz ,

What do you mean by "the restricted flash regions in the MCU" ? which regions you are referring to? and what are you trying to do?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Hello, I am using Keil uVision V5.29.0.0.

I am confused about how to use this SBC command.  Do I include it somewhere in the target settings for the project?  Or write it at the top of main.c?

Thanks,
-Brian

 

Hello,

I am referring to this in the reference manual:
"Flash memory enhanced protections, activated by option bytes
– Read protection (RDP), preventing unauthorized Flash memory dump to safeguard sensitive application code
– Write-protection of sectors (WRPS), available per bank (128 Kbyte sectors)
– Two proprietary code readout protection (PCROP) areas (one per user Flash bank). When enabled, this area is execute-only.
– Two secure-only areas (one per user Flash bank). When enabled this area is accessible only if the STM32 microcontroller operates in Secure access mode."
Maybe this doesn't apply to me since I didn't activate any option bytes...
I'm also a bit confused about where these RAM address settings come from in the project settings:

IRAM1: Start 0x20000000 Size 0x20000
IRAM2: Start 0x24000000 Size 0x80000
I meant maybe the MCU is sometimes trying to write/read RAM where it's not allowed?
Thanks!
-Brian

Hi @briankaz ,

For Flash example: SBC 0x08000000, 0x0807FFFF, 0 // Disable usage of SW Breakpoints for the address range.

This command should be added to an INI file and configured for inclusion in the "Options for Target" dialog in the Debugger tab.

Please take a look to this post.

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello,

I am still having problems but I think the issue is with the way I've defined RAM locations:

briankaz_0-1703031713495.png

There's a piece of code that is causing problems with overwriting RAM which was initialized in another function which should have been left untouched:

static bool check_img_header(const img_header_t *header)
{
    __log("Before strncmp\n\r");
    if (strncmp((char *) header->start_mrkr, IMG_START_MARKER, 16U))
        return false;
    if (strncmp((char *) header->end_mrkr, IMG_END_MARKER, 16U))
        return false;
    
    return true;
}

This is a really simple piece of code which just compares two fields of a structure with text constants.  The __log() function outputs text to the UART and I can observe it on my PC terminal.  This __log() function works when it is called before the first strncmp but when I try to call it after the strncmp() the whole program crashes (it doesn't output anything via the UART, even for __log() calls which happen before we get to this strncmp).

So I feel like I've defined the RAM areas incorrectly but I'm not sure how they should be defined...

-Brian

 

Hello @briankaz ,

So I feel like I've defined the RAM areas incorrectly but I'm not sure how they should be defined..

The start address of AXI-SRAM memory is 0x2400 0000 and the size is 384 Kbytes which is 0x 60000 in keil. Please refer to DS12110 and precisely Memory mapping section.  

Please let me know if the issue is solved.

Thank you.

Kaouthar

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

OK wait a minute — isn’t 128kB actually 0x6000 and not 0x60000?

EDIT:  Sorry, I was getting 0000 and 000 confused!

Hi @briankaz ,

128KBytes= 128x1024 Byte (decimal)= 0x20000 hex,

384 Kbytes=384x1024 Byte (decimal)=0x60000 hex

KDJEM1_0-1703165618595.png

Thank you.

Kaouthar

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.