Fix the license year in source files (#681)

This commit also fixes some other formatting issues including, tabs and
comments.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
Gaurav-Aggarwal-AWS 2021-09-02 16:01:57 -07:00 committed by GitHub
parent 008affa7bf
commit dfa1023504
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 97 additions and 274 deletions

View file

@ -1,6 +1,6 @@
/* /*
* FreeRTOS V202107.00 * FreeRTOS V202107.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
@ -86,7 +86,7 @@
#endif #endif
/* Set the following definitions to 1 to include the API function, or zero /* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */ * to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1 #define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1 #define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1 #define INCLUDE_vTaskDelete 1
@ -101,7 +101,7 @@ to exclude the API function. */
#define INCLUDE_xSemaphoreGetMutexHolder 1 #define INCLUDE_xSemaphoreGetMutexHolder 1
/* Normal assert() semantics without relying on the provision of an assert.h /* Normal assert() semantics without relying on the provision of an assert.h
header file. */ * header file. */
void vAssertCalled( void ); void vAssertCalled( void );
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled() #define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled()

View file

@ -1,6 +1,6 @@
/* /*
* FreeRTOS V202107.00 * FreeRTOS V202107.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
@ -43,9 +43,9 @@
* The Queue Send Task: * The Queue Send Task:
* The queue send task is implemented by the prvQueueSendTask() function in * The queue send task is implemented by the prvQueueSendTask() function in
* this file. prvQueueSendTask() sits in a loop that causes it to repeatedly * this file. prvQueueSendTask() sits in a loop that causes it to repeatedly
* block for 1000 milliseconds, before sending the value 100 to the queue that * block for 3000 milliseconds, before sending the value 100 to the queue that
* was created within main_blinky(). Once the value is sent, the task loops * was created within main_blinky(). Once the value is sent, the task loops
* back around to block for another 1000 milliseconds...and so on. * back around to block for another 3000 milliseconds...and so on.
* *
* The Queue Receive Task: * The Queue Receive Task:
* The queue receive task is implemented by the prvQueueReceiveTask() function * The queue receive task is implemented by the prvQueueReceiveTask() function
@ -57,8 +57,8 @@
* should be held in the Blocked state indefinitely to wait for data to be * should be held in the Blocked state indefinitely to wait for data to be
* available on the queue. The queue receive task will only leave the Blocked * available on the queue. The queue receive task will only leave the Blocked
* state when the queue send task writes to the queue. As the queue send task * state when the queue send task writes to the queue. As the queue send task
* writes to the queue every 1000 milliseconds, the queue receive task leaves * writes to the queue every 3000 milliseconds, the queue receive task leaves
* the Blocked state every 1000 milliseconds, and therefore toggles the LED * the Blocked state every 3000 milliseconds, and therefore toggles the LED
* every 200 milliseconds. * every 200 milliseconds.
*/ */
@ -77,26 +77,26 @@
#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) #define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
/* The rate at which data is sent to the queue. The 3000ms value is converted /* The rate at which data is sent to the queue. The 3000ms value is converted
to ticks using the pdMS_TO_TICKS() macro. */ * to ticks using the pdMS_TO_TICKS() macro. */
#define mainQUEUE_SEND_FREQUENCY_MS pdMS_TO_TICKS( 3000 ) #define mainQUEUE_SEND_FREQUENCY_MS pdMS_TO_TICKS( 3000 )
/* The maximum number items the queue can hold. The priority of the receiving /* The maximum number items the queue can hold. The priority of the receiving
task is above the priority of the sending task, so the receiving task will * task is above the priority of the sending task, so the receiving task will
preempt the sending task and remove the queue items each time the sending task * preempt the sending task and remove the queue items each time the sending task
writes to the queue. Therefore the queue will never have more than one item in * writes to the queue. Therefore the queue will never have more than one item in
it at any time, and even with a queue length of 1, the sending task will never * it at any time, and even with a queue length of 1, the sending task will never
find the queue full. */ * find the queue full. */
#define mainQUEUE_LENGTH ( 1 ) #define mainQUEUE_LENGTH ( 1 )
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* /**
* Called by main when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1 in * Called by main when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1 in
* main.c. * main.c.
*/ */
void main_blinky( void ); void main_blinky( void );
/* /**
* The tasks as described in the comments at the top of this file. * The tasks as described in the comments at the top of this file.
*/ */
static void prvQueueReceiveTask( void *pvParameters ); static void prvQueueReceiveTask( void *pvParameters );
@ -117,7 +117,7 @@ void main_blinky( void )
if( xQueue != NULL ) if( xQueue != NULL )
{ {
/* Start the two tasks as described in the comments at the top of this /* Start the two tasks as described in the comments at the top of this
file. */ * file. */
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */ xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */ "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */ configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
@ -132,11 +132,11 @@ void main_blinky( void )
} }
/* If all is well, the scheduler will now be running, and the following /* If all is well, the scheduler will now be running, and the following
line will never be reached. If the following line does execute, then * line will never be reached. If the following line does execute, then
there was insufficient FreeRTOS heap memory available for the Idle and/or * there was insufficient FreeRTOS heap memory available for the Idle and/or
timer tasks to be created. See the memory management section on the * timer tasks to be created. See the memory management section on the
FreeRTOS web site for more details on the FreeRTOS heap * FreeRTOS web site for more details on the FreeRTOS heap
http://www.freertos.org/a00111.html. */ * http://www.freertos.org/a00111.html. */
for( ;; ); for( ;; );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -159,9 +159,9 @@ BaseType_t xReturned;
vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );
/* Send to the queue - causing the queue receive task to unblock and /* Send to the queue - causing the queue receive task to unblock and
toggle the LED. 0 is used as the block time so the sending operation * toggle the LED. 0 is used as the block time so the sending operation
will not block - it shouldn't need to block as the queue should always * will not block - it shouldn't need to block as the queue should always
be empty at this point in the code. */ * be empty at this point in the code. */
xReturned = xQueueSend( xQueue, &ulValueToSend, 0U ); xReturned = xQueueSend( xQueue, &ulValueToSend, 0U );
configASSERT( xReturned == pdPASS ); configASSERT( xReturned == pdPASS );
} }
@ -181,12 +181,12 @@ TickType_t tickCount;
for( ;; ) for( ;; )
{ {
/* Wait until something arrives in the queue - this task will block /* Wait until something arrives in the queue - this task will block
indefinitely provided INCLUDE_vTaskSuspend is set to 1 in * indefinitely provided INCLUDE_vTaskSuspend is set to 1 in
FreeRTOSConfig.h. */ * FreeRTOSConfig.h. */
xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
/* To get here something must have been received from the queue, but /* To get here something must have been received from the queue, but
is it the expected value? If it is, toggle the LED. */ * is it the expected value? If it is, toggle the LED. */
if( ulReceivedValue == ulExpectedValue ) if( ulReceivedValue == ulExpectedValue )
{ {
tickCount = xTaskGetTickCount(); tickCount = xTaskGetTickCount();
@ -196,4 +196,3 @@ TickType_t tickCount;
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -1,177 +0,0 @@
# Create a Test Project
## Initial Setup
1. Create a new directory in the [FreeRTOS Partner Supported Demos Repository](https://github.com/FreeRTOS/FreeRTOS-Partner-Supported-Demos/tree/main)
or [FreeRTOS Community Supported Demos Repository](https://github.com/FreeRTOS/FreeRTOS-Community-Supported-Demos/tree/main).
The suggested name for the directory is `<hardware_name>_<compiler_name>`.
2. Create a project for your hardware and tool-chain in this directory.
3. Copy all the files in the [FreeRTOS/Demo/ThirdParty/Template](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS/Demo/ThirdParty/Template)
directory to your project directory:
* `IntQueueTimer.h`
* `IntQueueTimer.c`
* `TestRunner.h`
* `TestRunner.c`
* `RegTests.h`
* `RegTests.c`
## Project Configuration
1. Compile the following additional files in your project:
* All files in the [FreeRTOS/Demo/Common/Minimal](https://github.com/FreeRTOS/FreeRTOS/tree/main/FreeRTOS/Demo/Common/Minimal) directory except
`comtest_strings.c`, `crhook.c` , `comtest.c` ,`crflash.c`,`flash.c`, `flash_timer.c` and `sp_flop.c`.
2. Add the following paths to your include search path:
* `FreeRTOS/Demo/Common/include`.
3. Call the `void vStartTests( void )` function from your `main` function after
doing all the hardware initialization. Note that this function starts the
scheduler and therefore, never returns.
```c
#include "TestRunner.h"
void main( void )
{
/* Startup and Hardware initialization. */
/* Start tests. */
vStartTests();
/* Should never reach here. */
for( ; ; );
}
```
## Set up FreeRTOSConfig.h
1. Enable tick hook by adding the following line in your `FreeRTOSConfig.h`:
```c
#define configUSE_TICK_HOOK 1
```
2. Set the task notification array size to 3 by adding the following line in
your `FreeRTOSConfig.h`:
```c
#define configTASK_NOTIFICATION_ARRAY_ENTRIES 3
```
3. Enable printing by mapping `configPRINTF` to your print function. Note that
`configPRINTF` calls are wrapped in double parentheses to support C89. If you
have a thread-safe `printf` function, the following is what should be added
in your `FreeRTOSConfig.h`:
```c
#define configPRINTF( X ) printf X
```
4. Add the following defines in your `FreeRTOSConfig.h`:
```c
#define configSTART_TASK_NOTIFY_TESTS 0
#define configSTART_TASK_NOTIFY_ARRAY_TESTS 0
#define configSTART_BLOCKING_QUEUE_TESTS 0
#define configSTART_SEMAPHORE_TESTS 0
#define configSTART_POLLED_QUEUE_TESTS 0
#define configSTART_INTEGER_MATH_TESTS 0
#define configSTART_GENERIC_QUEUE_TESTS 0
#define configSTART_PEEK_QUEUE_TESTS 0
#define configSTART_MATH_TESTS 0
#define configSTART_RECURSIVE_MUTEX_TESTS 0
#define configSTART_COUNTING_SEMAPHORE_TESTS 0
#define configSTART_QUEUE_SET_TESTS 0
#define configSTART_QUEUE_OVERWRITE_TESTS 0
#define configSTART_EVENT_GROUP_TESTS 0
#define configSTART_INTERRUPT_SEMAPHORE_TESTS 0
#define configSTART_QUEUE_SET_POLLING_TESTS 0
#define configSTART_BLOCK_TIME_TESTS 0
#define configSTART_ABORT_DELAY_TESTS 0
#define configSTART_MESSAGE_BUFFER_TESTS 0
#define configSTART_STREAM_BUFFER_TESTS 0
#define configSTART_STREAM_BUFFER_INTERRUPT_TESTS 0
#define configSTART_TIMER_TESTS 0
#define configSTART_INTERRUPT_QUEUE_TESTS 0
#define configSTART_REGISTER_TESTS 0
#define configSTART_DELETE_SELF_TESTS 0
```
## Create and Run Register Tests
1. Fill the definitions of the following functions in the `RegTests.c` file
copied in the [Initial Setup](#Initial-Setup) step:
* `prvRegisterTest1Task`
* `prvRegisterTest2Task`
* `prvRegisterTest3Task`
* `prvRegisterTest4Task`
2. Define `configSTART_REGISTER_TESTS` to `1` in your `FreeRTOSConfig.h`:
```c
#define configSTART_REGISTER_TESTS 1
```
3. Build and run the register tests. The output should look like the following:
```
No errors
No errors
No errors
No errors
```
## Setup and Run Interrupt Nesting Tests
1. If your hardware **does not** support interrupt nesting, skip this section.
2. Fill the `void vInitialiseTimerForIntQueueTest( void )` function in the
`IntQueueTimer.c` file copied in the [Initial Setup](#Initial-Setup) step to
initialize and start a hardware timer. Make sure that the timer interrupt
runs at a logical priority less than or equal to `configMAX_SYSCALL_INTERRUPT_PRIORITY`.
The following is an example for ARM MPS2 which starts TIM0 timer:
```c
void vInitialiseTimerForIntQueueTest( void )
{
/* Clear interrupt. */
CMSDK_TIMER0->INTCLEAR = ( 1ul << 0 );
/* Reload value is slightly offset from the other timer. */
CMSDK_TIMER0->RELOAD = ( configCPU_CLOCK_HZ / tmrTIMER_0_FREQUENCY ) + 1UL;
CMSDK_TIMER0->CTRL = ( ( 1ul << 3 ) | ( 1ul << 0 ) );
NVIC_SetPriority( TIMER0_IRQn, configMAX_SYSCALL_INTERRUPT_PRIORITY );
NVIC_EnableIRQ( TIMER0_IRQn );
}
```
3. Either install `void IntQueueTestTimerHandler( void )` function as the timer
interrupt handler or call it from the timer interrupt handler of the above
timer. The following is an example for ARM MPS2 which calls
`IntQueueTestTimerHandler` from the TIM0 handler:
```c
void TIMER0_Handler( void )
{
/* Clear interrupt. */
CMSDK_TIMER0->INTCLEAR = ( 1ul << 0 );
IntQueueTestTimerHandler();
}
```
4. Define `configSTART_INTERRUPT_QUEUE_TESTS` to `1` in your `FreeRTOSConfig.h`:
```c
#define configSTART_INTERRUPT_QUEUE_TESTS 1
```
5. Build and run the tests. The output should look like the following:
```
No errors
No errors
No errors
No errors
```
## Running All Tests
1. Define all the `configSTART_<Test_Name>_TESTS` macros to `1` in your
`FreeRTOSConfig.h`.
2. Build and run the tests. The output should look like the following:
```
No errors
No errors
No errors
No errors
```
3. If you cannot fit all the tests in one binary because of Flash or RAM space,
you can run tests one by one or in groups by defining
`configSTART_<Test_Name>_TESTS` macros to `0` or `1` as needed.
## Add README
Add a `README.md` file in the project directory with the following information:
* Link to the hardware page.
* How to setup tool-chain.
* How to build and run the project.
* Any other relevant information.

View file

@ -1,6 +1,6 @@
/* /*
* FreeRTOS V202107.00 * FreeRTOS V202107.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
@ -72,8 +72,8 @@ vRegTest1Implementation:
reg1_loop: reg1_loop:
/* Check each register still contains the expected known value. /* Check each register still contains the expected known value.
vRegTest1Implementation uses x31 as the temporary, vRegTest2Implementation * vRegTest1Implementation uses x31 as the temporary, vRegTest2Implementation
uses x5 as the temporary. */ * uses x5 as the temporary. */
li x31, 0x5 li x31, 0x5
bne x31, x5, reg1_error_loop bne x31, x5, reg1_error_loop
li x31, 0x6 li x31, 0x6
@ -144,7 +144,7 @@ reg1_loop:
reg1_error_loop: reg1_error_loop:
/* Jump here if a register contains an uxpected value. This stops the loop /* Jump here if a register contains an uxpected value. This stops the loop
counter being incremented so the check task knows an error was found. */ * counter being incremented so the check task knows an error was found. */
ebreak ebreak
jal reg1_error_loop jal reg1_error_loop
@ -187,8 +187,8 @@ vRegTest2Implementation:
Reg2_loop: Reg2_loop:
/* Check each register still contains the expected known value. /* Check each register still contains the expected known value.
vRegTest2Implementation uses x5 as the temporary, vRegTest1Implementation * vRegTest2Implementation uses x5 as the temporary, vRegTest1Implementation
uses x31 as the temporary. */ * uses x31 as the temporary. */
li x5, 0x61 li x5, 0x61
bne x5, x6, reg2_error_loop bne x5, x6, reg2_error_loop
li x5, 0x71 li x5, 0x71
@ -256,7 +256,7 @@ Reg2_loop:
reg2_error_loop: reg2_error_loop:
/* Jump here if a register contains an uxpected value. This stops the loop /* Jump here if a register contains an uxpected value. This stops the loop
counter being incremented so the check task knows an error was found. */ * counter being incremented so the check task knows an error was found. */
ebreak ebreak
jal reg2_error_loop jal reg2_error_loop

View file

@ -1,6 +1,6 @@
/* /*
* FreeRTOS V202104.00 * FreeRTOS V202107.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
@ -45,11 +45,11 @@ extern void vRegTest1Implementation( void );
extern void vRegTest2Implementation( void ); extern void vRegTest2Implementation( void );
/* Flag that will be latched to pdTRUE should any unexpected behaviour be /* Flag that will be latched to pdTRUE should any unexpected behaviour be
detected in any of the tasks. */ * detected in any of the tasks. */
static volatile BaseType_t xErrorDetected = pdFALSE; static volatile BaseType_t xErrorDetected = pdFALSE;
/* Counters that are incremented on each cycle of a test. This is used to /* Counters that are incremented on each cycle of a test. This is used to
detect a stalled task - a test that is no longer running. */ * detect a stalled task - a test that is no longer running. */
volatile uint32_t ulRegisterTest1Counter = 0; volatile uint32_t ulRegisterTest1Counter = 0;
volatile uint32_t ulRegisterTest2Counter = 0; volatile uint32_t ulRegisterTest2Counter = 0;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -1,6 +1,6 @@
/* /*
* FreeRTOS V202104.00 * FreeRTOS V202107.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in

View file

@ -1,6 +1,6 @@
/* /*
* FreeRTOS V202104.00 * FreeRTOS V202107.00
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
@ -80,8 +80,9 @@
#define mainREGISTER_TEST_PRIORITY ( tskIDLE_PRIORITY ) #define mainREGISTER_TEST_PRIORITY ( tskIDLE_PRIORITY )
/* The period of the check task, in ms, converted to ticks using the /* The period of the check task, in ms, converted to ticks using the
pdMS_TO_TICKS() macro. mainNO_ERROR_CHECK_TASK_PERIOD is used if no errors have * pdMS_TO_TICKS() macro. mainNO_ERROR_CHECK_TASK_PERIOD is used if no errors
been found, mainERROR_CHECK_TASK_PERIOD is used if an error has been found. */ * have been found, mainERROR_CHECK_TASK_PERIOD is used if an error has been
* found. */
#define mainNO_ERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 3000UL ) #define mainNO_ERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 3000UL )
#define mainERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 500UL ) #define mainERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 500UL )
@ -291,7 +292,7 @@ BaseType_t xResult;
void vFullDemoTickHook( void ) void vFullDemoTickHook( void )
{ {
/* Called from vApplicationTickHook() when the project is configured to /* Called from vApplicationTickHook() when the project is configured to
build the full test/demo applications. */ * build the full test/demo applications. */
#if( configSTART_TASK_NOTIFY_TESTS == 1 ) #if( configSTART_TASK_NOTIFY_TESTS == 1 )
{ {