Hello,
Today I merged the latest FreeRTOS Kernel repo into my forked repo, then various compilers show many warnings like the followings. (I prefer to use high warning level compile option.)
'rx-elf-gcc -O3 -ffunction-sections -fdata-sections -Wunused -Wuninitialized -Wall -Wextra -Wmissing-declarations -Wpointer-arith -Wbad-function-cast -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wno-unused-function -Wno-unused-label -Wno-unused-variable -Wno-main -Wstack-usage=100 -g2 -m64bit-doubles -mcpu=rx72t -misa=v3 -mlittle-endian-data -mdfpu -std=gnu99 -fstack-usage -fdump-rtl-pro_and_epilogue -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS-Plus\\Source\\FreeRTOS-Plus-CLI" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Demo\\Common\\include" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Demo\\RX700_RX72N_RenesasSim_GCC_e2studio\\src\\FreeRTOS_Demo\\Full_Demo" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Demo\\RX700_RX72N_RenesasSim_GCC_e2studio\\src\\FreeRTOS_Demo" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Demo\\RX700_RX72N_RenesasSim_GCC_e2studio\\src" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Demo\\RX700_RX72N_RenesasSim_GCC_e2studio\\src\\smc_workaround" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Demo\\RX700_RX72N_RenesasSim_GCC_e2studio\\src\\smc_workaround\\r_bsp_patch" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Source\\include" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Source\\portable\\GCC\\RX_RenesasSim" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Demo\\RX700_RX72N_RenesasSim_GCC_e2studio\\src\\frtos_startup" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Demo\\RX700_RX72N_RenesasSim_GCC_e2studio\\src\\frtos_config" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Demo\\RX700_RX72N_RenesasSim_GCC_e2studio\\src\\frtos_skeleton" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Demo\\RX700_RX72N_RenesasSim_GCC_e2studio\\src\\smc_gen\\r_gpio_rx" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Demo\\RX700_RX72N_RenesasSim_GCC_e2studio\\src\\smc_gen\\r_gpio_rx\\src" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Demo\\RX700_RX72N_RenesasSim_GCC_e2studio\\src\\smc_gen\\r_config" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Demo\\RX700_RX72N_RenesasSim_GCC_e2studio\\src\\smc_gen\\r_bsp" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Demo\\RX700_RX72N_RenesasSim_GCC_e2studio\\src\\smc_gen\\general" -I"C:\\Renesas\\GitHubDesktop\\work\\FreeRTOS\\FreeRTOS\\Demo\\RX700_RX72N_RenesasSim_GCC_e2studio\\src\\smc_gen\\r_pincfg" -DRENESAS_SIMULATOR_DEBUGGING=1 -Wa,-adlnh="EventGroupsDemo.lst" -MMD -MP -MF"src/FreeRTOS_Demo/Full_Demo/Standard_Demo_Tasks/EventGroupsDemo.d" -MT"src/FreeRTOS_Demo/Full_Demo/Standard_Demo_Tasks/EventGroupsDemo.o" "C:/Renesas/GitHubDesktop/work/FreeRTOS/FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c" -c -o "src/FreeRTOS_Demo/Full_Demo/Standard_Demo_Tasks/EventGroupsDemo.o"'
In file included from C:\Renesas\GitHubDesktop\work\FreeRTOS\FreeRTOS\Source\include/portable.h:100,
from C:\Renesas\GitHubDesktop\work\FreeRTOS\FreeRTOS\Source\include/FreeRTOS.h:63,
from C:/Renesas/GitHubDesktop/work/FreeRTOS/FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c:42:
C:\Renesas\GitHubDesktop\work\FreeRTOS\FreeRTOS\Source\include/mpu_wrappers.h:32:7: warning: "portUSING_MPU_WRAPPERS" is not defined, evaluates to 0 [-Wundef]
#if ( portUSING_MPU_WRAPPERS == 1 )
^~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Renesas\GitHubDesktop\work\FreeRTOS\FreeRTOS\Source\include/FreeRTOS.h:63,
from C:/Renesas/GitHubDesktop/work/FreeRTOS/FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c:42:
C:\Renesas\GitHubDesktop\work\FreeRTOS\FreeRTOS\Source\include/portable.h:182:6: warning: "configSTACK_ALLOCATION_FROM_SEPARATE_HEAP" is not defined, evaluates to 0 [-Wundef]
#if( configSTACK_ALLOCATION_FROM_SEPARATE_HEAP == 1 )
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I read the kernel souce code and the commit history then I noticed that FreeRTOS Kernel repo’s PR #267 is insufficient for high warning level compile option. The reason is as followings.
FreeRTOS/Source/include/FreeRTOS.h
/* Definitions specific to the port being used. */
#include "portable.h" <--- configSTACK_ALLOCATION_FROM_SEPARATE_HEAP is used here
...
#include "mpu_wrappers.h"
...
#ifndef configSTACK_ALLOCATION_FROM_SEPARATE_HEAP
/* Defaults to 0 for backward compatibility. */
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0 <--- but default configSTACK_ALLOCATION_FROM_SEPARATE_HEAP is defined here
#endif
FreeRTOS/Source/include/portable.h
#if( configSTACK_ALLOCATION_FROM_SEPARATE_HEAP == 1 ) <--- configSTACK_ALLOCATION_FROM_SEPARATE_HEAP is used here
void *pvPortMallocStack( size_t xSize ) PRIVILEGED_FUNCTION;
void vPortFreeStack( void *pv ) PRIVILEGED_FUNCTION;
#else
#define pvPortMallocStack pvPortMalloc
#define vPortFreeStack vPortFree
#endif
And unfotunately there are no default definition for the following code.
FreeRTOS/Source/include/mpu_wrappers.h
/* This file redefines API functions to be called through a wrapper macro, but
* only for ports that are using the MPU. */
#if ( portUSING_MPU_WRAPPERS == 1 ) <--- portUSING_MPU_WRAPPERS has no default definition
...
#endif /* MPU_WRAPPERS_H */
I think that the following code is necessary in the portable.h.
FreeRTOS/Source/include/portable.h
#ifndef portUSING_MPU_WRAPPERS
/* Defaults to 0 for backward compatibility. */
#define portUSING_MPU_WRAPPERS 0
#endif
#ifndef configSTACK_ALLOCATION_FROM_SEPARATE_HEAP
/* Defaults to 0 for backward compatibility. */
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
#endif
And the following code is no longer necessary in the FreeRTOS.h.
FreeRTOS/Source/include/FreeRTOS.h
#ifndef configSTACK_ALLOCATION_FROM_SEPARATE_HEAP
/* Defaults to 0 for backward compatibility. */
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
#endif
Is there better code than above code to fix warnings?
Best regards,
NoMaY