I am using FreeRTOS-MPU port with STM32F412. I have taken example which is given in STM32CubeF4 sdk package.
All things are working fine but I am not able to figure out that how to use “HAL_UART_Transmit” in FreeRTOS Usermode (Non- Priviledge) task. Currently it gives memory fault if I call this API inside the Use mode task. However this API is working fine if the task is in Privilege mode.
The UART will be memory mapped, so writing to the UART is just like
accessing a memory location. If you have a user mode task that needs to
write to the UART you will have to use an MPU region to grant it access
to the memory mapped UART registers, or make UART writes a system call
in which case the actual write is performed by whichever priliged task
services the system call (in other words have an SVC handler for UART
writers, the UART write API function readies the data to be written then
executes the SVC assembler instruction which results in an exception
executing in privileged mode, and once in privileged mode you can assess
the memory mapped UART registers).