0
\$\begingroup\$

I am working on the STM32H753 Evaluation board and I have a software architecture with an SBSFU running in the internal flash, that jumps to the External NOR flash to execute the user application (Download and Active slot in External NOR flash). My user application is FreeRTOS based.

I am currently working on SBSFU v2.6.1 and have managed to customize the Nucleo H753's example project and my user application to execute successfully from the external NOR flash on my STM32H753 Evaluation board. But, in the process, I had to disable the Memory Protection Unit (MPU) in the SBSFU side due to the following couple of problems:

  • Enabling the MPU causes the user application to hang at the RTOS thread creation and not proceed further. I see that this is not supported at the IOC level also enter image description here
  • The Data Cache being enabled in the SBSFU side was corrupting the External NOR flash for some reason, causing the signature of the firmware to mismatch and causes critical error

Also, I see in FreeRTOS website that there is some additional support to enable MPU with FreeRTOS and it does not look straight forward for the H7 microcontroller family.

I have to use an RTOS in my user application. Is there any way at all to circumvent the above mentioned problems or should I run without the Memory Protection Unit (which ST does not recommend)? Thanks a lot in advance.

\$\endgroup\$
7
  • \$\begingroup\$ Are you sure you have the MPU's regions configured correctly? If you try to execute code from a region where that hasn't been allowed then you'll get a memory protection fault. \$\endgroup\$ Commented Mar 15, 2023 at 13:27
  • \$\begingroup\$ If you have the data cache enabled while writing to flash then you either need to ensure that you flush the cache after every write, or you need to use the MPU to configure that memory region as uncached or write-through cached. \$\endgroup\$ Commented Mar 15, 2023 at 13:29
  • \$\begingroup\$ @ brhans Thanks a lot for the point about configuring that region as non-cacheable. That solved my problem of the data cache corrupting the External NOR flash. I still do not have an answer for the MPU's non-support for FreeRTOS based user application though. If I just run my user application in the while(1), I don't have any problems at all. But when the FreeRTOS is part of the user app, the execution just hangs there till the Watchdog resets. Any ideas? \$\endgroup\$ Commented Mar 16, 2023 at 13:32
  • \$\begingroup\$ Can't think of any reason why FreeRTOS would break things like that. I'm currently working on a project which uses an STM32H750 and we're running ThreadX (aka AzureRTOS) on it. When it gets stuck, is it in an exception handler, and if so, which one? Make sure you set the Bus-, Usage- and Mem-Fault enable bits in SCB-SHCSR so that they don't all get lumped together as Hard-Faults as this helps to diagnose issues like these. If you're getting a Mem-Fault then it's likely an MPU configuration issue like trying to execute code from a region which doesn't have that enabled. \$\endgroup\$ Commented Mar 16, 2023 at 13:57
  • \$\begingroup\$ Ok, I'll check these points and get back, thanks again. I somehow feel it is FreeRTOS' issue, since I am not even able to enable MPU in the IOC file on STM32CubeMX for my project. There is a comment there which states - Use of Memory Protection Unit with FreeRTOS (not yet available, as it requires support of FreeRTOS Native API). Added a screenshot to the original question with this. Does this ring a bell? In your case with AzureRTOS, did you have to handle the MPU usage any differently to how you would have handled without the RTOS? \$\endgroup\$ Commented Mar 17, 2023 at 5:04

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.