MPU on cortex-m3

michaldemin wrote on Monday, November 30, 2009:

Hello

I have successfully  compiled and executed the “nonMPU” FreeRTOS 6.0.1 on Cortex-M3.

I am using the xTaskCreate to create process. This proces sets up SPI, DMA, interrups for driving LCD.

But if i change the port from ARM\_CM3 to ARM\_CM3\_MPU the code crashes when trying to setup NVIC.

Is this problem that the 0xE000Exxx (SCS_BASE) addresses are not allowed to be accessed ?

None of the two Demos uses interrupt handling so I assume that this has not been tested :frowning:

Any suggestions ?

michaldemin wrote on Monday, November 30, 2009:

I forgot that im using STM32

Anyone knows how is the stm32 behaving when DMA transfer is in progress and i change the content of MPU ?

rtel wrote on Monday, November 30, 2009:

First, are you sure your STM32 has an MPU?

*If* it does, then I would expect the NVIC registers will be protected.  There are a few that you can access without a fault being generated, but without the CPU taking notice of the read or write.

If you want to access the registers then you need to do it from privileged code, this is in the end of the point of the MPU, to protect critical data.  You can either setup the NVIC from main() before the scheduler is started, or do it from a privileged task, or do it from a task that is created privileged to allow it to perform this type of setup before being set to User mode to carry out its main function.

Regards.

michaldemin wrote on Monday, November 30, 2009:

Thanks for reply.

I didn’t notice that MPU is _optional_ for the Cortex-M3. So that’s where my problem was.

“Type” register check from GDB confirms my mistake:

print/x *0xe000ed90
$2 = 0x0

Thanks a lot  :slight_smile:

dimasusl wrote on Thursday, December 09, 2010:

Hi, Richard!
You wrote "First, are you sure your STM32 has an MPU? "

Yes, today we have a STM32F103VGT6 with MPU.
The question is whether the port for LPC1768 (via GCC) is suitable for this ST MCU?

rtel wrote on Thursday, December 09, 2010:

The port layer for the LPC and STM parts will be the same - its just a matter of creating a project with the correct settings (linker script, LED outputs, etc.) for the STM part.

Regards.

dimasusl wrote on Thursday, December 09, 2010:

That’s greate. Thanks!