I think the documentation of vTaskDelete() (http://docs.aws.amazon.com/freertos-kernel/latest/ref/reference10.html) should be updated to clarify the following thing: Calling this function when using heap_1.c will result in a fatal RTOS error. Heap1 calls "assert( 0 )" when calling it's (not-implemented) "vPortFree()" function.
The documentation says that "Only memory that is allocated to a task by the kernel itself is automatically freed when a task is deleted", from which one may deduce that you have to use a heap which implements "free()", but maybe you could put a more explicit note there. A sentence like "Take care that if you choose a FreeRTOS provided heap implementation, that you must a heap scheme which implements the free() operations. Using heap_1 will result in a crash when calling this function. " It cost me quite some time to figure out why firmware immediately crashes when call vTaskDelete().
That is not just the case for deleting tasks though. Nothing can be
deleted, so the same is true for queues, semaphores, stream buffers,
event groups, etc. The page describing the memory schemes does say
heap1 can only be used if your application doesn't delete anything:
https://www.freertos.org/a00111.html#heap1 and having the assert there
will hopefully alert people to the cause right away (stopping the
debugger you should find yourself in the line that says there is no
free() and objects cannot be deleted).
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.