NevynUK opened a new issue, #8288:
URL: https://github.com/apache/nuttx/issues/8288

   Came across a problem configuring the MPU for a board running the STM32F777. 
 The system locked the board and I believe that the lock was caused by the` 
MPU_RASR_S` attribute being used on a memory region that didi not support 
sharing.
   
   The code was configuring the MPU using the `mpu_user_intsram` macro in 
`mpu.h` which expands to the following:
   
   ```C
   #define mpu_user_intsram(base, size) \
     do \
       { \
         /* The configure the region */ \
         mpu_configure_region(base, size, \
                              MPU_RASR_TEX_SO   | /* Ordered            */ \
                              MPU_RASR_C        | /* Cacheable          */ \
                                                  /* Not Bufferable     */ \
                              MPU_RASR_S        | /* Shareable          */ \
                              MPU_RASR_AP_RWRW    /* P:RW   U:RW        */ \
                                                  /* Instruction access */); \
       } while (0)
   ```
   
   This passes the `MPU_RASR_S` attribute to `mpu_configure_region` which 
attempts to set the appropriate attributes for the memory region.
   
   I was executing `mpu_user_intsram(0x20070000, 0x8000)` and this address is 
in a region that is not shareable and this caused my application to lock.
   
   I finally resolved this by removing the shareable attribute to get the 
system running.
   
   Now according to _PM0253 - STM32 Programming Manual_, the majority of the 
memory map is not shareable (Table 17 in Rev 5 of this document).  In fact only 
0xA0000000-0xBFFFFFFF and 0xE0000000-0xE00FFFFF are allowed to be shareable.
   
   Given this restriction I think it would be advisable to make shareable an 
explicit option as these macros only work correctly for a small portion of the 
memory map.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to