mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-01-22 01:30:31 -05:00
Fix formatting in kernel demo application files (#1148)
* Fix formatting in kernel demo application files * Fix header check fail in the demo files * Add ignored patterns in core header check file * Fix formatting * Update vApplicationStackOverflowHook for AVR_ATMega4809_MPLAB.X/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Update vApplicationStackOverflowHook for AVR_ATMega4809_MPLAB.X/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Update vApplicationStackOverflowHook for AVR_Dx_IAR/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Update vApplicationStackOverflowHook for AVR_Dx_IAR/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Update vApplicationStackOverflowHook for AVR_Dx_MPLAB.X/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Update vApplicationMallocFailedHook for AVR_Dx_MPLAB.X/main.c Co-authored-by: Soren Ptak <ptaksoren@gmail.com> * Fix formatting AVR32_UC3 --------- Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
This commit is contained in:
parent
85ed21bcfb
commit
121fbe295b
169 changed files with 22211 additions and 21557 deletions
|
|
@ -72,18 +72,18 @@
|
|||
*/
|
||||
|
||||
/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,
|
||||
or 0 to run the more comprehensive test and demo application. */
|
||||
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1
|
||||
* or 0 to run the more comprehensive test and demo application. */
|
||||
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1
|
||||
|
||||
/*
|
||||
* main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.
|
||||
* main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.
|
||||
*/
|
||||
#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1
|
||||
extern void main_blinky( void );
|
||||
extern void main_blinky( void );
|
||||
#else
|
||||
#warning At the time of writing the QEMU MTIME behaviour is erratic, resulting in test failures.
|
||||
extern void main_full( void );
|
||||
#warning At the time of writing the QEMU MTIME behaviour is erratic, resulting in test failures.
|
||||
extern void main_full( void );
|
||||
#endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */
|
||||
|
||||
/*
|
||||
|
|
@ -92,7 +92,8 @@ or 0 to run the more comprehensive test and demo application. */
|
|||
*/
|
||||
void vApplicationMallocFailedHook( void );
|
||||
void vApplicationIdleHook( void );
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask,
|
||||
char * pcTaskName );
|
||||
void vApplicationTickHook( void );
|
||||
|
||||
/* Trap handler implemented in the portASM.S file. */
|
||||
|
|
@ -109,102 +110,112 @@ void vSendString( const char * pcString );
|
|||
|
||||
int main( void )
|
||||
{
|
||||
/* Program mtvec with the FreeRTOS trap handler. */
|
||||
__asm__ volatile( "csrw mtvec, %0" :: "r"( freertos_risc_v_trap_handler ) );
|
||||
/* Program mtvec with the FreeRTOS trap handler. */
|
||||
__asm__ volatile ( "csrw mtvec, %0" : : "r" ( freertos_risc_v_trap_handler ) );
|
||||
|
||||
vSendString( "Starting" );
|
||||
vSendString( "Starting" );
|
||||
|
||||
/* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top
|
||||
of this file. */
|
||||
#if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )
|
||||
{
|
||||
main_blinky();
|
||||
}
|
||||
#else
|
||||
{
|
||||
main_full();
|
||||
}
|
||||
#endif
|
||||
/* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top
|
||||
* of this file. */
|
||||
#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )
|
||||
{
|
||||
main_blinky();
|
||||
}
|
||||
#else
|
||||
{
|
||||
main_full();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationMallocFailedHook( void )
|
||||
{
|
||||
/* vApplicationMallocFailedHook() will only be called if
|
||||
configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
|
||||
function that will get called if a call to pvPortMalloc() fails.
|
||||
pvPortMalloc() is called internally by the kernel whenever a task, queue,
|
||||
timer or semaphore is created. It is also called by various parts of the
|
||||
demo application. If heap_1.c or heap_2.c are used, then the size of the
|
||||
heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in
|
||||
FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used
|
||||
to query the size of free heap space that remains (although it does not
|
||||
provide information on how the remaining heap might be fragmented). */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
for( ;; );
|
||||
/* vApplicationMallocFailedHook() will only be called if
|
||||
* configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
|
||||
* function that will get called if a call to pvPortMalloc() fails.
|
||||
* pvPortMalloc() is called internally by the kernel whenever a task, queue,
|
||||
* timer or semaphore is created. It is also called by various parts of the
|
||||
* demo application. If heap_1.c or heap_2.c are used, then the size of the
|
||||
* heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in
|
||||
* FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used
|
||||
* to query the size of free heap space that remains (although it does not
|
||||
* provide information on how the remaining heap might be fragmented). */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationIdleHook( void )
|
||||
{
|
||||
/* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
|
||||
to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
|
||||
task. It is essential that code added to this hook function never attempts
|
||||
to block in any way (for example, call xQueueReceive() with a block time
|
||||
specified, or call vTaskDelay()). If the application makes use of the
|
||||
vTaskDelete() API function (as this demo application does) then it is also
|
||||
important that vApplicationIdleHook() is permitted to return to its calling
|
||||
function, because it is the responsibility of the idle task to clean up
|
||||
memory allocated by the kernel to any task that has since been deleted. */
|
||||
/* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
|
||||
* to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
|
||||
* task. It is essential that code added to this hook function never attempts
|
||||
* to block in any way (for example, call xQueueReceive() with a block time
|
||||
* specified, or call vTaskDelay()). If the application makes use of the
|
||||
* vTaskDelete() API function (as this demo application does) then it is also
|
||||
* important that vApplicationIdleHook() is permitted to return to its calling
|
||||
* function, because it is the responsibility of the idle task to clean up
|
||||
* memory allocated by the kernel to any task that has since been deleted. */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask,
|
||||
char * pcTaskName )
|
||||
{
|
||||
( void ) pcTaskName;
|
||||
( void ) pxTask;
|
||||
( void ) pcTaskName;
|
||||
( void ) pxTask;
|
||||
|
||||
/* Run time stack overflow checking is performed if
|
||||
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
|
||||
function is called if a stack overflow is detected. */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
for( ;; );
|
||||
/* Run time stack overflow checking is performed if
|
||||
* configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
|
||||
* function is called if a stack overflow is detected. */
|
||||
taskDISABLE_INTERRUPTS();
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationTickHook( void )
|
||||
{
|
||||
/* The tests in the full demo expect some interaction with interrupts. */
|
||||
#if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 )
|
||||
{
|
||||
extern void vFullDemoTickHook( void );
|
||||
vFullDemoTickHook();
|
||||
}
|
||||
#endif
|
||||
/* The tests in the full demo expect some interaction with interrupts. */
|
||||
#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 )
|
||||
{
|
||||
extern void vFullDemoTickHook( void );
|
||||
vFullDemoTickHook();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vAssertCalled( void )
|
||||
{
|
||||
volatile uint32_t ulSetTo1ToExitFunction = 0;
|
||||
volatile uint32_t ulSetTo1ToExitFunction = 0;
|
||||
|
||||
taskDISABLE_INTERRUPTS();
|
||||
while( ulSetTo1ToExitFunction != 1 )
|
||||
{
|
||||
__asm volatile( "NOP" );
|
||||
}
|
||||
taskDISABLE_INTERRUPTS();
|
||||
|
||||
while( ulSetTo1ToExitFunction != 1 )
|
||||
{
|
||||
__asm volatile ( "NOP" );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vSendString( const char * pcString )
|
||||
{
|
||||
const uint32_t ulTxFifoFullBit = 0x80000000UL;
|
||||
const uint32_t ulTxFifoFullBit = 0x80000000UL;
|
||||
|
||||
while( *pcString != 0x00 )
|
||||
{
|
||||
while( ( UART0_REG( UART_REG_TXFIFO ) & ulTxFifoFullBit ) != 0UL );
|
||||
UART0_REG( UART_REG_TXFIFO ) = *pcString;
|
||||
pcString++;
|
||||
}
|
||||
while( *pcString != 0x00 )
|
||||
{
|
||||
while( ( UART0_REG( UART_REG_TXFIFO ) & ulTxFifoFullBit ) != 0UL )
|
||||
{
|
||||
}
|
||||
|
||||
UART0_REG( UART_REG_TXFIFO ) = *pcString;
|
||||
pcString++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue