AnsweredAssumed Answered

How to access peripherals device when enter user/unprivileged mode

Question asked by Vince Liu on Apr 2, 2020
Latest reply on Apr 16, 2020 by Vince Liu

Hi,

I have struggled for access the peripherals device under user/unprivileged mode for days.

Env: 

   RT1052

   IAR 8.3

   FreeRTOS 10.1.1

 

When I switch the task (FreeRTOS's) to unprivileged mode(CONTROL.nPRIV=1), access/read the the uart/i2c will cause a hardfault and the CFSR shows it's a bus fault:

CFSR = 00008200
Bus fault: Precise Data Access (address in BFAR)
Bus fault: BFAR Has Valid Contents

BFAR= 40184000 (uart base address)

 

The same code could run normally under privileged mode(CONTROL.nPRIV=0).

 

I have already configure 0x40000000 ~ 0x5FFFFFFF could be accessed under unprivileged mode via MPU. ( If not will generate a MemManage fault, that's correct according to ARM design document)

 

I also try to modify CSU_CSLx register(Central Security Unit) during the code running, but no any improvement.

But when I modify those initial configures bits may cause the code get same fault even under privileged mode. That's also make me confusion.

 

Would you please give me a hand?

Thank you!

Attachments

Outcomes