# mpu_wrappers.h bug?

sgardner123 wrote on Friday, January 27, 2012:

For v7.1.0, should line 59 be:

#if( portUSING_MPU_WRAPPERS == 1 )

#ifdef portUSING_MPU_WRAPPERS

since it will always be defined as either 1 or 0?

Thanks

rtel wrote on Friday, January 27, 2012:

I have to admit it is a little while since I tested the MPU version, but I have done a global search on this and I think the line of code you refer to is actually correct.

Everywhere else where the macro is tested it is tested against 1 or 0 - so the macro must be defined.  It is, however, only defined when using a port of FreeRTOS that supports the MPU, so will not be defined at all for other ports.  The line you have highlighted checks if it is defined, and if it is, does what it needs to do (if it is defined it can only be defined as 1).  If it is not defined it defines it as 0 in the #else part line 129.

Regards.