Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

MPU and xTaskCreate(): error

Posted by Artem Pisarenko on November 1, 2012
FreeRTOS API documentation, function xTaskCreate() states that this function may be used with FreeRTOS-MPU:
“...
Using xTaskCreate() with FreeRTOS-MPU allows tasks to be created to run in either Privileged or User modes (see the description of uxPriority below). When Privileged mode it used the task will have access to the entire memory map, when User mode is used the task will have access to only its stack.
...”
It's wrong. In this case MPU region for task stack isn't being set up which causes task created in user mode crash system immediately after scheduler start.

RE: MPU and xTaskCreate(): error

Posted by Richard on November 1, 2012
“ It's wrong. In this case MPU region for task stack isn't being set up which causes task created in user mode crash system immediately after scheduler start.”


I have just stepped through the code, and am not sure the statement is right either, as a very quick look appears to show unprivileged tasks being given access to all unprivileged RAM not just the stack. However, I'm not sure your statement is correct either as I can create a task using xTaskCreate() and step into the task without a problem.

I do get an MPU fault, but it is from the check task, which is privileged anyway so it is curious.

I will need to look at that more, but have an urgent job to complete first.

Regards.

RE: MPU and xTaskCreate(): error

Posted by Artem Pisarenko on November 1, 2012
I didn't checked deeply and didn't notice that task being given access to all RAM. Also I didn't checked where crash happens exactly. Anyway, bug identified.

P.S. I've just figured out that even if you fix this it will not work in my case because of my heap implementation. I relocated whole heap to privileged_data section to protect system objects which are being placed there by freertos. I didn't considered task stacks because most of my tasks are created with xTaskCreateRestricted().


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS