W dniu 2013-03-05 22:33, Jonathan Dumaresq pisze:
> Yeah. The only problem that I have not experiment, if it is possible to use
> the MPU only on part of the application or I must define region all the time

This works like this - there are two levels of privilege - privileged 
and unprivileged. Interrupts are always privileged, tasks can be both. 
For each region you can define whether it can be read and/or written by 
each level of privilege (privileged does not care about unprivileged 
settings), in FreeRTOS there are 4 defines:

>     portMPU_REGION_READ_WRITE
>     portMPU_REGION_PRIVILEGED_READ_ONLY
>     portMPU_REGION_READ_ONLY
>     portMPU_REGION_PRIVILEGED_READ_WRITE

but some more combinations are possible:

> #define portMPU_REGION_NO_ACCESS                              ( 0x00UL << 
> 24UL )
> #define portMPU_REGION_READ_ONLY_PRIVILEGED_READ_WRITE        ( 0x02UL << 
> 24UL )

The regions can overlap and they are checked in some order, so you can 
have sth like "all RAM accessible to privileged, this single region 
accessible R/W for unprivileged" - this will give all your privileged 
code unrestricted access and single unprivileged task can access only 
one single region. The opposite is probably also possible, so that 
privileged code can have access to whole RAM but not this single region.

You can also divide each region (the rules for region are really strict 
considering the alignment and size) into 8 sub-regions and each can be 
enabled/disabled independently.

I've used that some time ago and I remember it was hard (; MPU is a bit 
complicated... Eventually I gave up and switched to "normal" FreeRTOS, 
without MPU, as writting an app which actually takes advantage of it (so 
most of the task are unprivileged) was a nightmare. It would probably be 
easier if only some tasks would be unprivileged, but for me it makes no 
sense...

So you can use MPU only in part of your app, which will be unprivileged, 
and rest of the code can be privileged and have unrestricted access to 
everything. The problem is that MPU is configurable only when you're 
privileged (maybe MPU registers can be set as a region?) - in FreeRTOS 
the re-configuration on context switch is done by privileged system 
handlers.

There are some docs about MPU in ARM documentation (nothing in ST docs), 
or in LPC17xx manuals (probably easier to read than ARM's).

4\/3!!

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to