0
0
FreeRTOSprogramming~10 mins

Choosing the right heap scheme in FreeRTOS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to select the heap scheme that uses a simple first-fit algorithm.

FreeRTOS
void vPortDefineHeap() {
    #define configFRTOS_MEMORY_SCHEME [1]
}
Drag options to blanks, or click blank then click option'
Aheap_1
Bheap_2
Cheap_3
Dheap_4
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing heap_3 which is more complex and supports coalescing.
2fill in blank
medium

Complete the code to select the heap scheme that supports memory freeing and coalescing.

FreeRTOS
void vPortDefineHeap() {
    #define configFRTOS_MEMORY_SCHEME [1]
}
Drag options to blanks, or click blank then click option'
Aheap_3
Bheap_2
Cheap_5
Dheap_1
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing heap_2 which supports freeing but not coalescing.
3fill in blank
hard

Fix the error in the code by choosing the correct heap scheme that uses multiple memory regions.

FreeRTOS
void vPortDefineHeap() {
    #define configFRTOS_MEMORY_SCHEME [1]
}
Drag options to blanks, or click blank then click option'
Aheap_1
Bheap_2
Cheap_4
Dheap_3
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing heap_3 which supports coalescing but not multiple regions.
4fill in blank
hard

Fill both blanks to define a heap scheme that supports memory freeing and uses a first-fit algorithm.

FreeRTOS
void vPortDefineHeap() {
    #define configFRTOS_MEMORY_SCHEME [1]
    void *heapMemory = pvPortMalloc([2]);
}
Drag options to blanks, or click blank then click option'
Aheap_2
Bheap_1
C1024
D2048
Attempts:
3 left
💡 Hint
Common Mistakes
Using heap_1 which does not support freeing.
Choosing 2048 which is larger than needed here.
5fill in blank
hard

Fill all three blanks to define a heap scheme that supports multiple regions, freeing, and coalescing with a heap size of 4096 bytes.

FreeRTOS
void vPortDefineHeap() {
    #define configFRTOS_MEMORY_SCHEME [1]
    static uint8_t ucHeap[[2]];
    HeapRegion_t xHeapRegions[] = {
        { ucHeap, [3] },
        { NULL, 0 }
    };
    vPortDefineHeapRegions(xHeapRegions);
}
Drag options to blanks, or click blank then click option'
Aheap_4
B4096
D2048
Attempts:
3 left
💡 Hint
Common Mistakes
Using heap_3 which does not support multiple regions.
Mismatching heap sizes in array and region.