portUSING_MPU_WRAPPERS is not defined but I get some: warning: implicit declaration of function


I’m using a port that doesn’t have a MPU, the atmega323 port. The constant portUSING_MPU_WRAPPERS is not defined anywhere (I think so) but I’m getting this warnings:

mpu_wrappers.c: In function 'xPortRaisePrivilege':
mpu_wrappers.c:67:26: warning: implicit declaration of function 'portIS_PRIVILEGED'; did you mean 'portPRIVILEGE_BIT'? [-Wimplicit-function-declaration]
     xRunningPrivileged = portIS_PRIVILEGED();
mpu_wrappers.c:72:9: warning: implicit declaration of function 'portRAISE_PRIVILEGE' [-Wimplicit-function-declaration]
mpu_wrappers.c: In function 'vPortResetPrivilege':
mpu_wrappers.c:83:9: warning: implicit declaration of function 'portRESET_PRIVILEGE'; did you mean 'portEXIT_CRITICAL'? [-Wimplicit-function-declaration]

In this post it’s said that such constant has 3 states: not defined, 0 and 1.

Even when I un-define it in my FreeRTOSConfig.h file the problem still shows up:


If I set the constant to 0 or 1 then I get some errors: ‘xMPU_SETTINGS’ (and others) was not declared in this scope or undefine reference to…, respectively.

Is there something I can do in order to avoid the warnings? Should I delete the mpu_wappers.c file (seems to be a really bad idea)? As my chip is not using those functions, then there is no problem with the warnings that might arise soon, but it would be nice not to have them at all.

Thank you!

If you are not using MPU, you do not need to compile mpu_wappers.c file. Please remove it from your build tool.


1 Like

An alternative if it isn’t easy to change which files your system compiles is to wrap all those functions with an #if portUSING_MPU_WRAPPERS statement (after it has done the include to get the definition of it).

1 Like

It gets worst:

portable.h:204:37: error: variable or field 'vPortStoreTaskMPUSettings' declared void
     void vPortStoreTaskMPUSettings( xMPU_SETTINGS * xMPUSettings,
portable.h:204:37: error: 'xMPU_SETTINGS' was not declared in this scope
portable.h:205:37: error: expected primary-expression before 'const'

I think the best I can do is to delete the mpu_wappers.c file as my chip is not using it:

If the chip doesn’t have an mpu, you can’t build the mpu source files. I recommend using one of the avr examples in the download, or an example provided by microchip, as a reference.

1 Like


The file mpu_wrappers.c is included in:


so I thought it was needed for any port (because of its name and location). Now I understand that chips without MPU don’t need it all, so I can remove it safely from the building.