@@ -145,7 +145,7 @@ Referring to Figure 3.1:
145145
146146* * *
147147![ ] ( media/image05.png )
148- * Figure 3.1 RAM being allocated from the heap\_ 1 array each time a task is created*
148+ *** Figure 3.1*** * RAM being allocated from the heap\_ 1 array each time a task is created*
149149* * *
150150
151151
@@ -189,7 +189,7 @@ subsequently freed blocks are always the same size.
189189
190190* * *
191191![ ] ( media/image06.png )
192- * Figure 3.2 RAM being allocated and freed from the heap\_ 2 array as tasks are created and deleted*
192+ *** Figure 3.2*** * RAM being allocated and freed from the heap\_ 2 array as tasks are created and deleted*
193193* * *
194194
195195Figure 3.2 demonstrates how the best-fit algorithm works when a task is
276276
277277* * *
278278![ ] ( media/image07.png )
279- * Figure 3.3 RAM being allocated and freed from the heap\_ 4 array*
279+ *** Figure 3.3*** * RAM being allocated and freed from the heap\_ 4 array*
280280* * *
281281
282282Figure 3.3 demonstrates how the heap\_ 4 first-fit algorithm with memory
@@ -350,12 +350,12 @@ the call to `vPortDefineHeapRegions()`.
350350
351351<a name =" list3.1 " title =" Listing 3.1 The vPortDefineHeapRegions() API function prototype " ></a >
352352
353- * * *
353+
354354``` c
355355void vPortDefineHeapRegions ( const HeapRegion_t * const pxHeapRegions );
356356```
357- *Listing 3.1 The vPortDefineHeapRegions() API function prototype*
358- * * *
357+ *** Listing 3.1*** * The vPortDefineHeapRegions() API function prototype*
358+
359359
360360`vPortDefineHeapRegions()` takes an array of `HeapRegion_t` structures as
361361its only parameter. Each structure defines the start address and size of
@@ -365,7 +365,7 @@ structures defines the entire heap space.
365365
366366<a name="list3.2" title="Listing 3.2 The HeapRegion\_t structure"></a>
367367
368- * * *
368+
369369```c
370370typedef struct HeapRegion
371371{
@@ -377,8 +377,8 @@ typedef struct HeapRegion
377377
378378} HeapRegion_t;
379379```
380- * Listing 3.2 The HeapRegion\_ t structure*
381- * * *
380+ *** Listing 3.2*** * The HeapRegion\_ t structure*
381+
382382
383383** Parameters:**
384384
@@ -407,7 +407,7 @@ which is not shown.
407407
408408* * *
409409![ ] ( media/image08.png )
410- * Figure 3.4 Memory Map*
410+ *** Figure 3.4*** * Memory Map*
411411* * *
412412
413413Listing 3.3 shows an array of ` HeapRegion_t ` structures that together
@@ -416,7 +416,7 @@ describe the three blocks of RAM in their entirety.
416416
417417<a name =" list3.3 " title =" Listing 3.3 An array of HeapRegion\_t structures that together describe the 3 regions of RAM in their entirety " ></a >
418418
419- * * *
419+
420420``` c
421421/* Define the start address and size of the three RAM regions. */
422422#define RAM1_START_ADDRESS ( ( uint8_t * ) 0x00010000 )
@@ -449,8 +449,8 @@ int main( void )
449449 /* Add application code here. */
450450}
451451```
452- *Listing 3.3 An array of HeapRegion\_t structures that together describe the 3 regions of RAM in their entirety*
453- * * *
452+ *** Listing 3.3*** * An array of HeapRegion\_t structures that together describe the 3 regions of RAM in their entirety*
453+
454454
455455Although Listing 3.3 correctly describes the RAM, it does not demonstrate a
456456usable example because it allocates all the RAM to the heap, leaving no
@@ -494,7 +494,6 @@ linker consumes all of RAM1, as shown in Figure 3.4 **C**.
494494
495495<a name="list3.4" title="Listing 3.4 An array of HeapRegion\_t structures that describe all of RAM2, all of RAM3, but only part of RAM1"></a>
496496
497- * * *
498497```c
499498/* Define the start address and size of the two RAM regions not used by
500499 the linker. */
@@ -524,8 +523,8 @@ const HeapRegion_t xHeapRegions[] =
524523 { NULL, 0 } /* Marks the end of the array. */
525524};
526525```
527- * Listing 3.4 An array of HeapRegion\_ t structures that describe all of RAM2, all of RAM3, but only part of RAM1*
528- * * *
526+ *** Listing 3.4*** * An array of HeapRegion\_ t structures that describe all of RAM2, all of RAM3, but only part of RAM1*
527+
529528
530529The advantages of the technique demonstrated in Listing 3.4 include:
531530
@@ -575,22 +574,22 @@ documentation. Examples for two compilers follow:
575574
576575<a name =" list3.5 " title =" Listing 3.5 Using GCC syntax to declare the array that will be used by heap\_4, and place the array in a memory section named .my\_heap " ></a >
577576
578- * * *
577+
579578``` c
580579uint8_t ucHeap[ configTOTAL_HEAP_SIZE ] __attribute__ ( ( section( " .my_heap" ) ) );
581580```
582- * Listing 3.5 Using GCC syntax to declare the array that will be used by heap\_ 4, and place the array in a memory section named .my\_ heap*
583- * * *
581+ *** Listing 3.5*** * Using GCC syntax to declare the array that will be used by heap\_ 4, and place the array in a memory section named .my\_ heap*
582+
584583
585584
586585<a name =" list3.6 " title =" Listing 3.6 Using IAR syntax to declare the array that will be used by heap\_4, and place the array at the absolute address 0x20000000 " ></a >
587586
588- * * *
587+
589588``` c
590589uint8_t ucHeap[ configTOTAL_HEAP_SIZE ] @ 0x20000000 ;
591590```
592- * Listing 3.6 Using IAR syntax to declare the array that will be used by heap\_ 4, and place the array at the absolute address 0x20000000*
593- * * *
591+ *** Listing 3.6*** * Using IAR syntax to declare the array that will be used by heap\_ 4, and place the array at the absolute address 0x20000000*
592+
594593
595594
596595### 3.3.2 The xPortGetFreeHeapSize() API Function
@@ -604,12 +603,12 @@ information on heap fragmentation.
604603
605604<a name =" list3.7 " title =" Listing 3.7 The xPortGetFreeHeapSize() API function prototype " ></a >
606605
607- * * *
606+
608607``` c
609608size_t xPortGetFreeHeapSize ( void );
610609```
611- *Listing 3.7 The xPortGetFreeHeapSize() API function prototype*
612- * * *
610+ *** Listing 3.7*** * The xPortGetFreeHeapSize() API function prototype*
611+
613612
614613**Return value:**
615614
@@ -639,12 +638,12 @@ after executing the code that you know has the highest heap usage,
639638
640639<a name="list3.8" title="Listing 3.8 The xPortGetMinimumEverFreeHeapSize() API function prototype"></a>
641640
642- * * *
641+
643642```c
644643size_t xPortGetMinimumEverFreeHeapSize( void );
645644```
646- * Listing 3.8 The xPortGetMinimumEverFreeHeapSize() API function prototype*
647- * * *
645+ *** Listing 3.8*** * The xPortGetMinimumEverFreeHeapSize() API function prototype*
646+
648647
649648** Return value:**
650649
@@ -663,17 +662,17 @@ shows the `HeapStats_t` structure members.
663662
664663<a name =" list3.9 " title =" Listing 3.9 The vPortGetHeapStatus() API function prototype " ></a >
665664
666- * * *
665+
667666``` c
668667void vPortGetHeapStats ( HeapStats_t * xHeapStats );
669668```
670- *Listing 3.9 The vPortGetHeapStatus() API function prototype*
671- * * *
669+ *** Listing 3.9*** * The vPortGetHeapStatus() API function prototype*
670+
672671
673672
674673<a name="list3.10" title="Listing 3.10 The HeapStatus\_t() structure"></a>
675674
676- * * *
675+
677676```c
678677/* Prototype of the vPortGetHeapStats() function. */
679678void vPortGetHeapStats( HeapStats_t *xHeapStats );
@@ -710,8 +709,8 @@ typedef struct xHeapStats
710709 size_t xNumberOfSuccessfulFrees;
711710} HeapStats_t;
712711```
713- * Listing 3.10 The HeapStatus\_ t() structure*
714- * * *
712+ *** Listing 3.10*** * The HeapStatus\_ t() structure*
713+
715714
716715
717716### 3.3.5 Collecting Per-task Heap Usage Statistics
@@ -751,12 +750,12 @@ which should gracefully recover from allocation failures.
751750
752751<a name =" list3.11 " title =" Listing 3.11 The malloc failed hook function name and prototype " ></a >
753752
754- * * *
753+
755754``` c
756755void vApplicationMallocFailedHook ( void );
757756```
758- *Listing 3.11 The malloc failed hook function name and prototype*
759- * * *
757+ *** Listing 3.11*** * The malloc failed hook function name and prototype*
758+
760759
761760
762761### 3.3.7 Placing Task Stacks in Fast Memory
@@ -774,7 +773,7 @@ macros to call application-provided functions as shown in Listing 3.12.
774773
775774<a name="list3.12" title="Listing 3.12 Mapping the pvPortMallocStack() and vPortFreeStack() macros to an application defined memory allcator"></a>
776775
777- * * *
776+
778777```c
779778/* Functions provided by the application writer than allocate and free
780779 memory from a fast area of RAM. */
@@ -790,8 +789,8 @@ void vPortFreeFastMemory( void *pvBlockToFree );
790789
791790#define vPortFreeStack( x ) vPortFreeFastMemory( x )
792791```
793- * Listing 3.12 Mapping the pvPortMallocStack() and vPortFreeStack() macros to an application defined memory allcator*
794- * * *
792+ *** Listing 3.12*** * Mapping the pvPortMallocStack() and vPortFreeStack() macros to an application defined memory allcator*
793+
795794
796795
797796## 3.4 Using Static Memory Allocation
@@ -850,7 +849,7 @@ also return the size of the timer task stack. A suggested implementation of the
850849
851850<a name =" list3.13 " title =" Listing 3.13 Typical implementation of vApplicationGetTimerTaskMemory " ></a >
852851
853- * * *
852+
854853``` c
855854void vApplicationGetTimerTaskMemory ( StaticTask_t ** ppxTimerTaskTCBBuffer,
856855 StackType_t ** ppxTimerTaskStackBuffer,
@@ -874,8 +873,8 @@ void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer,
874873 * pulTimerTaskStackSize = sizeof(uxTimerTaskStack) / sizeof(* uxTimerTaskStack);
875874}
876875```
877- *Listing 3.13 Typical implementation of vApplicationGetTimerTaskMemory*
878- * * *
876+ *** Listing 3.13*** * Typical implementation of vApplicationGetTimerTaskMemory*
877+
879878
880879Since there is only a single timer task in any system including SMP, a valid solution to the timer task memory problem
881880is to allocate static buffers in the `vApplicationGetTimeTaskMemory()` function and return the buffer pointers to the kernel.
@@ -894,7 +893,6 @@ variables to create the needed buffers.
894893
895894<a name="list3.14" title="Listing 3.14 Typical implementation of vApplicationGetIdleTaskMemory"></a>
896895
897- * * *
898896```c
899897void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer,
900898 StackType_t **ppxIdleTaskStackBuffer,
@@ -908,5 +906,5 @@ void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer,
908906 *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
909907}
910908```
911- * Listing 3.14 Typical implementation of vApplicationGetIdleTaskMemory*
912- * * *
909+ *** Listing 3.14*** * Typical implementation of vApplicationGetIdleTaskMemory*
910+
0 commit comments