mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-20 10:08:33 -04:00
Notes:
+ The MPU port is not supported in this revision number. + The documentation for the static allocation functions in the header files has not yet been updated for this revision. Kernel updates: + Simplify the static allocation of objects implementation. + Introduce configSUPPORT_DYNAMIC_ALLOCATION in addition to the existing configSUPPORT_STATIC_ALLOCATION so FreeRTOS can be built without providing a heap at all. Demo application updates: + Update the demos to take into account the new configSUPPORT_DYNAMIC_ALLOCATION constant. + Add an MSVC demo that only uses static allocation, and does not include a FreeRTOS heap. + Update the MSVC project to use both configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION. + Update the MingW project to use only configSUPPORT_DYNAMIC_ALLOCATION.
This commit is contained in:
parent
283bc18d23
commit
6568ba6eb0
50 changed files with 2350 additions and 3914 deletions
|
@ -70,7 +70,7 @@
|
|||
/*
|
||||
Changes from V3.2.1
|
||||
+ CallReturn Depth increased from 8 to 10 levels to accomodate wizC/fedC V12.
|
||||
|
||||
|
||||
Changes from V3.2.0
|
||||
+ TBLPTRU is now initialised to zero during the initial stack creation of a new task. This solves
|
||||
an error on devices with more than 64kB ROM.
|
||||
|
@ -134,7 +134,7 @@ uint16_t usCalcMinStackSize = 0;
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* We initialise ucCriticalNesting to the middle value an
|
||||
* We initialise ucCriticalNesting to the middle value an
|
||||
* uint8_t can contain. This way portENTER_CRITICAL()
|
||||
* and portEXIT_CRITICAL() can be called without interrupts
|
||||
* being enabled before the scheduler starts.
|
||||
|
@ -143,9 +143,9 @@ register uint8_t ucCriticalNesting = 0x7F;
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* Initialise the stack of a new task.
|
||||
* See portSAVE_CONTEXT macro for description.
|
||||
* See portSAVE_CONTEXT macro for description.
|
||||
*/
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
|
||||
{
|
||||
|
@ -161,7 +161,7 @@ uint8_t ucScratch;
|
|||
ucScratch = PRODL;
|
||||
|
||||
/*
|
||||
* Place a few bytes of known values on the bottom of the stack.
|
||||
* Place a few bytes of known values on the bottom of the stack.
|
||||
* This is just useful for debugging.
|
||||
*/
|
||||
// *pxTopOfStack-- = 0x11;
|
||||
|
@ -210,10 +210,10 @@ uint8_t ucScratch;
|
|||
{
|
||||
*pxTopOfStack-- = ( StackType_t ) 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The only function return address so far is the address of the task entry.
|
||||
* The order is TOSU/TOSH/TOSL. For devices > 64kB, TOSU is put on the
|
||||
* The order is TOSU/TOSH/TOSL. For devices > 64kB, TOSU is put on the
|
||||
* stack, too. TOSU is always written as zero here because wizC does not allow
|
||||
* functionpointers to point above 64kB in ROM.
|
||||
*/
|
||||
|
@ -231,12 +231,12 @@ uint8_t ucScratch;
|
|||
|
||||
/*
|
||||
* The code generated by wizC does not maintain separate
|
||||
* stack and frame pointers. Therefore the portENTER_CRITICAL macro cannot
|
||||
* stack and frame pointers. Therefore the portENTER_CRITICAL macro cannot
|
||||
* use the stack as per other ports. Instead a variable is used to keep
|
||||
* track of the critical section nesting. This variable has to be stored
|
||||
* as part of the task context and is initially set to zero.
|
||||
*/
|
||||
*pxTopOfStack-- = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING;
|
||||
*pxTopOfStack-- = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING;
|
||||
|
||||
return pxTopOfStack;
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ BaseType_t xPortStartScheduler( void )
|
|||
/*
|
||||
* Setup a timer for the tick ISR for the preemptive scheduler.
|
||||
*/
|
||||
portSetupTick();
|
||||
portSetupTick();
|
||||
|
||||
/*
|
||||
* Restore the context of the first task to run.
|
||||
|
@ -321,30 +321,39 @@ void vPortYield( void )
|
|||
*/
|
||||
portRESTORE_CONTEXT();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
|
||||
void *pvPortMalloc( uint16_t usWantedSize )
|
||||
{
|
||||
void *pvReturn;
|
||||
|
||||
vTaskSuspendAll();
|
||||
{
|
||||
pvReturn = malloc( ( malloc_t ) usWantedSize );
|
||||
}
|
||||
xTaskResumeAll();
|
||||
|
||||
return pvReturn;
|
||||
}
|
||||
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void *pvPortMalloc( uint16_t usWantedSize )
|
||||
{
|
||||
void *pvReturn;
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
|
||||
vTaskSuspendAll();
|
||||
void vPortFree( void *pv )
|
||||
{
|
||||
pvReturn = malloc( ( malloc_t ) usWantedSize );
|
||||
}
|
||||
xTaskResumeAll();
|
||||
|
||||
return pvReturn;
|
||||
}
|
||||
|
||||
void vPortFree( void *pv )
|
||||
{
|
||||
if( pv )
|
||||
{
|
||||
vTaskSuspendAll();
|
||||
if( pv )
|
||||
{
|
||||
free( pv );
|
||||
vTaskSuspendAll();
|
||||
{
|
||||
free( pv );
|
||||
}
|
||||
xTaskResumeAll();
|
||||
}
|
||||
xTaskResumeAll();
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
Loading…
Add table
Add a link
Reference in a new issue