FreeRTOS - memory management best practices - Where could I find it?

Well, I am not sure that a correct definition of ConfigTotal_HEAP_SIZE, in the FreeRTOSConfig file. Take a look in my screenshot and code in the end of this post

I saw that I had the heap3.c in the other directory: “C:\Users\Claudio Rosa.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5\freertos\Source\portable\MemMang” , then I renamed the heap3.c as heap3.c.old and I added the heap4.c in this directory, and error messages were reduced, take a look:

The error messages:

Executing task in folder RastAtivos: C:\Users\Claudio Rosa\.platformio\penv\Scripts\platformio.exe run 

Processing wiscore_rak4631 (platform: nordicnrf52; board: wiscore_rak4631; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/wiscore_rak4631.html
PLATFORM: Nordic nRF52 (10.4.0) > WisCore RAK4631 Board
HARDWARE: NRF52840 64MHz, 243KB RAM, 796KB Flash
DEBUG: Current (jlink) External (jlink, stlink)
PACKAGES: 
 - framework-arduinoadafruitnrf52 @ 1.10600.0 (1.6.0) 
 - framework-cmsis @ 2.50700.210515 (5.7.0) 
 - tool-adafruit-nrfutil @ 1.503.0 (5.3) 
 - tool-sreccat @ 1.164.0 (1.64) 
 - toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 32 compatible libraries
Scanning dependencies...
Dependency Graph
|-- SparkFun LIS3DH Arduino Library @ 1.0.3
|-- Adafruit BME680 Library @ 2.0.4
|-- SparkFun u-blox GNSS Arduino Library @ 2.2.25
|-- SX126x-Arduino @ 2.0.24
|-- ArduinoJson @ 7.0.4
|-- CayenneLPP @ 1.1.0
|-- PackPayload
|-- RAK12500
|-- RAK15007
|-- RAK1904
|-- RAK1906
|-- RAK4631
|-- RAK5801
|-- Wire @ 1.0
Building in release mode
Compiling .pio\build\wiscore_rak4631\FrameworkArduino\freertos\Source\portable\MemMang\heap_4.c.o
Compiling .pio\build\wiscore_rak4631\FrameworkArduino\freertos\portable\MemMang\heap_4.c.o
Compiling .pio\build\wiscore_rak4631\FrameworkArduino\rtos.cpp.o
Compiling .pio\build\wiscore_rak4631\FrameworkArduino\sysview\Config\SEGGER_SYSVIEW_Config_FreeRTOS.c.o
Compiling .pio\build\wiscore_rak4631\FrameworkArduino\sysview\SEGGER_SYSVIEW_FreeRTOS.c.o
Compiling .pio\build\wiscore_rak4631\FrameworkArduino\utility\AdaCallback.c.o
C:\Users\Claudio Rosa\.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5\freertos\Source\portable\MemMang\heap_4.c:92:44: warning: character constant too long for its type
     PRIVILEGED_DATA static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
                                            ^~~~~~~~~~~~~~~~~~~~~
Compiling .pio\build\wiscore_rak4631\FrameworkArduino\utility\SoftwareTimer.cpp.o
C:\Users\Claudio Rosa\.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5\freertos\Source\portable\MemMang\heap_4.c: In function 'pvPortMalloc':
C:\Users\Claudio Rosa\.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5\freertos\Source\portable\MemMang\heap_4.c:275:13: warning: implicit declaration of function 'vApplicationMallocFailedHook' [-Wimplicit-function-declaration]
             vApplicationMallocFailedHook();
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\Claudio Rosa\.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5\freertos\Source\portable\MemMang\heap_4.c: In function 'prvHeapInit':       
C:\Users\Claudio Rosa\.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5\freertos\Source\portable\MemMang\heap_4.c:384:29: warning: character constant too long for its type
     size_t xTotalHeapSize = configTOTAL_HEAP_SIZE;
                             ^~~~~~~~~~~~~~~~~~~~~
C:\Users\Claudio Rosa\.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5\freertos\Source\portable\MemMang\heap_4.c: At top level:
C:\Users\Claudio Rosa\.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5\freertos\Source\portable\MemMang\heap_4.c:487:25: error: unknown type name 'HeapStats_t'; did you mean 'TaskStatus_t'?
 void vPortGetHeapStats( HeapStats_t * pxHeapStats )
                         ^~~~~~~~~~~
                         TaskStatus_t
Compiling .pio\build\wiscore_rak4631\FrameworkArduino\utility\adafruit_fifo.cpp.o
C:\Users\Claudio Rosa\.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5\freertos\portable\MemMang\heap_4.c:92:44: warning: character constant too long for its type
     PRIVILEGED_DATA static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
                                            ^~~~~~~~~~~~~~~~~~~~~
*** [.pio\build\wiscore_rak4631\FrameworkArduino\freertos\Source\portable\MemMang\heap_4.c.o] Error 1
C:\Users\Claudio Rosa\.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5\freertos\portable\MemMang\heap_4.c: In function 'pvPortMalloc':
C:\Users\Claudio Rosa\.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5\freertos\portable\MemMang\heap_4.c:275:13: warning: implicit declaration of function 'vApplicationMallocFailedHook' [-Wimplicit-function-declaration]
             vApplicationMallocFailedHook();
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\Claudio Rosa\.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5\freertos\portable\MemMang\heap_4.c: In function 'prvHeapInit':
C:\Users\Claudio Rosa\.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5\freertos\portable\MemMang\heap_4.c:384:29: warning: character constant too long for its type
     size_t xTotalHeapSize = configTOTAL_HEAP_SIZE;
                             ^~~~~~~~~~~~~~~~~~~~~
C:\Users\Claudio Rosa\.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5\freertos\portable\MemMang\heap_4.c: At top level:
C:\Users\Claudio Rosa\.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5\freertos\portable\MemMang\heap_4.c:487:25: error: unknown type name 'HeapStats_t'; did you mean 'TaskStatus_t'?
 void vPortGetHeapStats( HeapStats_t * pxHeapStats )
                         ^~~~~~~~~~~
                         TaskStatus_t
*** [.pio\build\wiscore_rak4631\FrameworkArduino\freertos\portable\MemMang\heap_4.c.o] Error 1

FreeRTOSConfig.h

#define configTICK_SOURCE                                                         FREERTOS_USE_RTC
#define configUSE_PREEMPTION                                                      1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION                                   0
#define configUSE_TICKLESS_IDLE                                                   0
#define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG                                      1 /* See into vPortSuppressTicksAndSleep source code for explanation */
#define configCPU_CLOCK_HZ                                                        ( SystemCoreClock )
#define configTICK_RATE_HZ                                                        100
#define configMAX_PRIORITIES                                                      ( 15 )
#define configMINIMAL_STACK_SIZE                                                  ( 600 )
#define configTOTAL_HEAP_SIZE                                                     'heap_4.c' /* valor original ( 175000 ) */
#define configMAX_TASK_NAME_LEN                                                   ( 15 )
#define configUSE_16_BIT_TICKS                                                    0
#define configIDLE_SHOULD_YIELD                                                   1
#define configUSE_MUTEXES                                                         1
#define configUSE_RECURSIVE_MUTEXES                                               1
#define configUSE_COUNTING_SEMAPHORES                                             1
#define configUSE_ALTERNATIVE_API                                                 0    /* Deprecated! */
#define configQUEUE_REGISTRY_SIZE                                                 2
#define configUSE_QUEUE_SETS                                                      0
#define configUSE_TIME_SLICING                                                    0
#define configUSE_NEWLIB_REENTRANT                                                0
#define configENABLE_BACKWARD_COMPATIBILITY                                       1

// Erro na compila��o #define configUSE_DAEMON_TASK_STARTUP_HOOK                       1
#define configSUPPORT_STATIC_ALLOCATION                          0
#define configUSE_APPLICATION_TASK_TAG                                            1
#define configUSE_POSIX_ERRNO                                                     1

#define configSUPPORT_DYNAMIC_ALLOCATION                         1

/* Hook function related definitions. */
#define configUSE_IDLE_HOOK                                      1
#define configUSE_TICK_HOOK                                      0
#define configCHECK_FOR_STACK_OVERFLOW                           1
#define configUSE_MALLOC_FAILED_HOOK                             1