ARM_CM3_MPU does not seem to build in FreeRTOS 9.0.0

hengblom wrote on Tuesday, July 26, 2016:

Hi,

First I’m new to this forum, don’t know if this question belongs here.
I’ve been working with FreeRTOS for a couple of years now, and I think it is great.

However, I’m having problems building ARM CortexM3, the MPU vairant, for FreeRTOS 9.0.0, with GCC

First there seem to be a “BIT” (With an underscore before but that is for some reason interpreted as a “start of italic” here…) missing in the end of line 176 in portable/GCC/ARMCM3_MPU/portmacro.h

But after having fixed that, there are still some problems. I also run completely static memory allocation, new to 9.0.0, and as long as I don’t use MPU, that works fine. However the MPU variant don’t seem to be completely compliant to an entirely static memory allocation. It complains about this:

Linking build_rls_11/SW0033-11v03pre.elf
build_rls_11/FreeRTOS/tasks.o: In function xTaskCreateRestricted': /opt/repos/git/src/SW/SW0033-GenIV_TX/09_11-TigerGenIV_MidiJoystick_CPU1/src/FreeRTOS/tasks.c:643: undefined reference to pvPortMalloc’

And looking in the code, it seems FreeRTOS cannot run completely static in the MPU-case:

xTaskCreateRestricted() calls pvPortMalloc() and there don’t seem to be a xTaskCreateRestrictedStatic(). Neither can I find any config-option in FreeRTOSConfig.h that disables this function if i run MPU. (I don’t think I need xTaskCreateRestricted() , I’ll use xTaskCreateStatic() instead, so it’s not a big problem for me, I can just put “#if 0” around it)

Has anyone else run in to the same problem, or is it me that has missed to configure something ?

Should I write a new bug-ticket about this ?

br Håkan

rtel wrote on Wednesday, July 27, 2016:

Thank you for pointing out the missing “_BIT” on the end of the constant
name. This has been corrected in the code, and added to the known
issues list (which will be published when I am back in the office) so
there is no need to create a ticket.

On your other point. Currently (but not for long) the MPU port is not
compatible with a completely statically allocated system. I think this
is documented somewhere, but it might be somewhere too obscure, like in
the change history or SVN comments. I thought there was a

#error
in the code to warn people of this if they attempted

to use both, but evidently not.

hengblom wrote on Wednesday, July 27, 2016:

Thanks for the info. As I said, I can live without xTaskCreateRestricted() as of now. How far into the future do you think it is to have support for MPU without dynamic memory allocation ?

I can of course comment out xTaskCreateRestricted() but it feels a bit risky and too “unsupported”.

/Håkan

rtel wrote on Wednesday, July 27, 2016:

If it is useful for people we can prioritise the work.

hengblom wrote on Wednesday, July 27, 2016:

For me it is not urgent, technically. As I said, I think I can live with just commenting out xTaskCreateRestricted(). I’ll try that, and see if things work as expected.

The only thing that would make it more “urgent” for me is that it would be nice to have a released version of FreeRTOS that supports it, so that I don’t have to apply any patch for it. But I don’t consider that very important to me.