implicit declaration of function 'xTaskCreateRestricted', 'vPortResetPrivilege'

dnadler wrote on Wednesday, December 14, 2016:

Hi Guys - A minor nit but I know you try hard to make all your code compile clean.
I get warnings about two implicit declarations (everything else compiles without warnings).
Details below.
Thanks as always,
Best Regards, Dave

Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -Wextra  -g3 -D"CPU_MK64FN1M0VDC12" -DUSB_STACK_FREERTOS -DHSB_BUILD_WPA -I../source -I../CMSIS -I../Generated_uC_setup -I../board -I../drivers -I../freertos/Source/include -I../freertos/Source/portable/GCC/ARM_CM4F -I../startup -I../utilities -I"E:/Cap/MFW2/MFW2_firmware/USB/include" -I"E:/Cap/MFW2/MFW2_firmware/USB/device/include" -I"E:/Cap/MFW2/MFW2_firmware/USB/device/class" -I"E:/Cap/MFW2/MFW2_firmware/USB/osa" -I"E:/Cap/MFW2/MFW2_firmware/USB/device/class/cdc" -I"E:/Cap/MFW2/MFW2_firmware/USB/device/source" -I"E:/Cap/MFW2/MFW2_firmware/USB/device/source/khci" -std=gnu99 -Wno-unused-parameter -MMD -MP -MF"FreeRTOS/Source/portable/Common/mpu_wrappers.d" -MT"FreeRTOS/Source/portable/Common/mpu_wrappers.o" -c -o "FreeRTOS/Source/portable/Common/mpu_wrappers.o" "../FreeRTOS/Source/portable/Common/mpu_wrappers.c"
../FreeRTOS/Source/portable/Common/mpu_wrappers.c: In function 'MPU_xTaskCreateRestricted':
../FreeRTOS/Source/portable/Common/mpu_wrappers.c:104:2: warning: implicit declaration of function 'xTaskCreateRestricted' [-Wimplicit-function-declaration]
  xReturn = xTaskCreateRestricted( pxTaskDefinition, pxCreatedTask );
  ^
../FreeRTOS/Source/portable/Common/mpu_wrappers.c:105:2: warning: implicit declaration of function 'vPortResetPrivilege' [-Wimplicit-function-declaration]
  vPortResetPrivilege( xRunningPrivileged );
  ^

rtel wrote on Thursday, December 15, 2016:

Hi Dave - thanks for taking the time to report this.

I’ve just compared the head revision of mpu_wrappers.c with the revision
from the FreeRTOS V9.0.0 release and it looks like this has already been
picked up as MPU_xTaskCreateRestricted() is now only compiled if
configSUPPORT_DYNAMIC_ALLOCATION is set to 1.

dnadler wrote on Friday, December 16, 2016:

Is the updated code available? I only find 9.0.0 on sourceforge (sorry if I’m looking in the wrong place)…
Thanks, Best Regards, Dave

rtel wrote on Friday, December 16, 2016:

Did you look in the SVN repository - also on SourceForge?

https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Source/portable/Common/mpu_wrappers.c

dcrocker wrote on Tuesday, January 02, 2018:

I am getting these same warnings, compiling freshly-downloaded FreeRTOS 10.0.0 with target GCC/ARM_CM4F. Shouldn’t these prototypes be declared in task.h?

Edit: looks like xTaskCreateRestricted does get declared in task.h, but only if portUSING_MPU_WRAPPERS=1 is defined. Where is that macro supposed to be defined?

rtel wrote on Tuesday, January 02, 2018:

Is this also the case in FreeRTOS V10.0.1? If so, please describe how
to replicate the problem (e.g. which port are you using, what are
configSUPPORT_DYNAMIC_ALLOCATION and configSUPPORT_STATIC_ALLOCATION set
to, and any other relevant configuration items).

fjrg76mx wrote on Sunday, April 15, 2018:

I’m facing the same situation with these specs:

FreeRTOS 10.0.1, ATMega328 port
Compiler and flags: avr-gcc, -std=gnu11 -Wall, -Wpedantic
avr-gcc version: 4.9.2
FreeRTOSConfig flags:

  #define configSUPPORT_DYNAMIC_ALLOCATION    1
  #define configSUPPORT_STATIC_ALLOCATION     1

The situation is the same even if configSUPPORT_STATIC_ALLOCATION is set to 0.

An output’s excerpt:

/home/fjrg76/Documentos/arduino-1.8.5/hardware/tools/avr/bin/**avr-gcc** -MMD -c **-mmcu=atmega328p** -DF_CPU=16000000L -DARDUINO=185 -DARDUINO_ARCH_AVR -D__PROG_TYPES_COMPAT__ -I/home/fjrg76/Documentos/arduino-1.8.5/hardware/arduino/avr/cores/arduino -I/home/fjrg76/Documentos/arduino-1.8.5/hardware/arduino/avr/variants/standard    -I/home/fjrg76/Documentos/arduino-1.8.5/libraries/FreeRTOS/src   -Wall -ffunction-sections -fdata-sections -Os -std=gnu11 -Wall -Wpedantic  /home/fjrg76/Documentos/arduino-1.8.5/libraries/FreeRTOS/src/mpu_wrappers.c -o build-uno/libs/FreeRTOS/src/mpu_wrappers.o
*/home/fjrg76/Documentos/arduino-1.8.5/libraries/FreeRTOS/src/mpuwrappers.c: **In function 'MPUxTaskCreateRestricted':**
/home/fjrg76/Documentos/arduino-1.8.5/libraries/FreeRTOS/src/mpuwrappers.c:64:3: warning: implicit declaration of function 'xTaskCreateRestricted' [-Wimplicit-function-declaration]
   xReturn = xTaskCreateRestricted( pxTaskDefinition, pxCreatedTask );*

If you guys need more information please don’t hesitate. Greetings!

rtel wrote on Sunday, April 15, 2018:

From the looks of it you are not using code provided by us, but from a
third party, so we can only provide general assistance and ideas as we
are not familiar with the code you are building (mpuwrappers.c).

These warnings are nothing to do with static or dynamic allocation, but
with whether or not you are using a FreeRTOS port that support memory
protection or not. I’m not aware of a port for the ATMega that has
memory protection, and in fact are not aware that any ATMega parts even
have memory protection unit - so I think you are just building the wrong
files for that target.

fjrg76mx wrote on Sunday, April 15, 2018:

I got it. It’s a compressed version of FreeRTOS, directly downloaded from sourceforge.net. I took only what it was needed it to make it work from the ATMega323 official port, and it works! Perhaps it’s important to mention that this port is using heap_3.c. Maybe you want to take a look the files that are been compiled, please see the attached pic.

As others have said, such situation isn’t critical, but I read that you like clean compilations.