0

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.

Sreedhar
  • 11
  • 2
  • 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. – brhans Mar 15 '23 at 13:27
  • 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. – brhans Mar 15 '23 at 13:29
  • @ 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? – Sreedhar Mar 16 '23 at 13:32
  • 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. – brhans Mar 16 '23 at 13:57
  • 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? – Sreedhar Mar 17 '23 at 05:04
  • In my project, AzureRTOS is not "aware" of the MPU at all. I enable and manage it "manually" using the ST HAL library functions without a by involvement from the RTOS. – brhans Mar 17 '23 at 11:15
  • Ok, thanks for the information. – Sreedhar Mar 17 '23 at 11:38

0 Answers0