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>
pull/677/head^2
Gaurav-Aggarwal-AWS 4 years ago committed by GitHub
parent 008affa7bf
commit dfa1023504
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,6 @@
/*
* 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
* this software and associated documentation files (the "Software"), to deal in
@ -86,7 +86,7 @@
#endif
/* 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_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
@ -101,7 +101,7 @@ to exclude the API function. */
#define INCLUDE_xSemaphoreGetMutexHolder 1
/* Normal assert() semantics without relying on the provision of an assert.h
header file. */
* header file. */
void vAssertCalled( void );
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled()

@ -1,6 +1,6 @@
/*
* 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
* this software and associated documentation files (the "Software"), to deal in
@ -43,9 +43,9 @@
* The Queue Send Task:
* The queue send task is implemented by the prvQueueSendTask() function in
* 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
* 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 is implemented by the prvQueueReceiveTask() function
@ -57,8 +57,8 @@
* 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
* 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
* the Blocked state every 1000 milliseconds, and therefore toggles the LED
* writes to the queue every 3000 milliseconds, the queue receive task leaves
* the Blocked state every 3000 milliseconds, and therefore toggles the LED
* every 200 milliseconds.
*/
@ -73,30 +73,30 @@
#include "queue.h"
/* Priorities used by the tasks. */
#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
/* The rate at which data is sent to the queue. The 3000ms value is converted
to ticks using the pdMS_TO_TICKS() macro. */
#define mainQUEUE_SEND_FREQUENCY_MS pdMS_TO_TICKS( 3000 )
* to ticks using the pdMS_TO_TICKS() macro. */
#define mainQUEUE_SEND_FREQUENCY_MS pdMS_TO_TICKS( 3000 )
/* 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
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
it at any time, and even with a queue length of 1, the sending task will never
find the queue full. */
#define mainQUEUE_LENGTH ( 1 )
* 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
* 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
* find the queue full. */
#define mainQUEUE_LENGTH ( 1 )
/*-----------------------------------------------------------*/
/*
/**
* Called by main when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1 in
* main.c.
*/
void main_blinky( void );
/*
/**
* The tasks as described in the comments at the top of this file.
*/
static void prvQueueReceiveTask( void *pvParameters );
@ -111,33 +111,33 @@ static QueueHandle_t xQueue = NULL;
void main_blinky( void )
{
/* Create the queue. */
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );
if( xQueue != NULL )
{
/* Start the two tasks as described in the comments at the top of this
file. */
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. */
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
NULL, /* The parameter passed to the task - not used in this case. */
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
NULL ); /* The task handle is not required, so NULL is passed. */
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
/* Start the tasks and timer running. */
vTaskStartScheduler();
}
/* 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
there was insufficient FreeRTOS heap memory available for the Idle and/or
timer tasks to be created. See the memory management section on the
FreeRTOS web site for more details on the FreeRTOS heap
http://www.freertos.org/a00111.html. */
for( ;; );
/* Create the queue. */
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );
if( xQueue != NULL )
{
/* Start the two tasks as described in the comments at the top of this
* file. */
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. */
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
NULL, /* The parameter passed to the task - not used in this case. */
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
NULL ); /* The task handle is not required, so NULL is passed. */
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
/* Start the tasks and timer running. */
vTaskStartScheduler();
}
/* 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
* there was insufficient FreeRTOS heap memory available for the Idle and/or
* timer tasks to be created. See the memory management section on the
* FreeRTOS web site for more details on the FreeRTOS heap
* http://www.freertos.org/a00111.html. */
for( ;; );
}
/*-----------------------------------------------------------*/
@ -147,24 +147,24 @@ TickType_t xNextWakeTime;
const unsigned long ulValueToSend = 100UL;
BaseType_t xReturned;
/* Remove compiler warning about unused parameter. */
( void ) pvParameters;
/* Remove compiler warning about unused parameter. */
( void ) pvParameters;
/* Initialise xNextWakeTime - this only needs to be done once. */
xNextWakeTime = xTaskGetTickCount();
/* Initialise xNextWakeTime - this only needs to be done once. */
xNextWakeTime = xTaskGetTickCount();
for( ;; )
{
/* Place this task in the blocked state until it is time to run again. */
vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );
for( ;; )
{
/* Place this task in the blocked state until it is time to run again. */
vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );
/* 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
will not block - it shouldn't need to block as the queue should always
be empty at this point in the code. */
xReturned = xQueueSend( xQueue, &ulValueToSend, 0U );
configASSERT( xReturned == pdPASS );
}
/* 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
* will not block - it shouldn't need to block as the queue should always
* be empty at this point in the code. */
xReturned = xQueueSend( xQueue, &ulValueToSend, 0U );
configASSERT( xReturned == pdPASS );
}
}
/*-----------------------------------------------------------*/
@ -175,25 +175,24 @@ const unsigned long ulExpectedValue = 100UL;
extern void vToggleLED( void );
TickType_t tickCount;
/* Remove compiler warning about unused parameter. */
( void ) pvParameters;
for( ;; )
{
/* Wait until something arrives in the queue - this task will block
indefinitely provided INCLUDE_vTaskSuspend is set to 1 in
FreeRTOSConfig.h. */
xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
/* To get here something must have been received from the queue, but
is it the expected value? If it is, toggle the LED. */
if( ulReceivedValue == ulExpectedValue )
{
tickCount = xTaskGetTickCount();
vToggleLED();
ulReceivedValue = 0U;
}
}
/* Remove compiler warning about unused parameter. */
( void ) pvParameters;
for( ;; )
{
/* Wait until something arrives in the queue - this task will block
* indefinitely provided INCLUDE_vTaskSuspend is set to 1 in
* FreeRTOSConfig.h. */
xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
/* To get here something must have been received from the queue, but
* is it the expected value? If it is, toggle the LED. */
if( ulReceivedValue == ulExpectedValue )
{
tickCount = xTaskGetTickCount();
vToggleLED();
ulReceivedValue = 0U;
}
}
}
/*-----------------------------------------------------------*/

@ -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.

@ -1,6 +1,6 @@
/*
* 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
* this software and associated documentation files (the "Software"), to deal in
@ -72,8 +72,8 @@ vRegTest1Implementation:
reg1_loop:
/* Check each register still contains the expected known value.
vRegTest1Implementation uses x31 as the temporary, vRegTest2Implementation
uses x5 as the temporary. */
* vRegTest1Implementation uses x31 as the temporary, vRegTest2Implementation
* uses x5 as the temporary. */
li x31, 0x5
bne x31, x5, reg1_error_loop
li x31, 0x6
@ -144,7 +144,7 @@ reg1_loop:
reg1_error_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
jal reg1_error_loop
@ -187,8 +187,8 @@ vRegTest2Implementation:
Reg2_loop:
/* Check each register still contains the expected known value.
vRegTest2Implementation uses x5 as the temporary, vRegTest1Implementation
uses x31 as the temporary. */
* vRegTest2Implementation uses x5 as the temporary, vRegTest1Implementation
* uses x31 as the temporary. */
li x5, 0x61
bne x5, x6, reg2_error_loop
li x5, 0x71
@ -256,7 +256,7 @@ Reg2_loop:
reg2_error_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
jal reg2_error_loop

@ -1,6 +1,6 @@
/*
* FreeRTOS V202104.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* FreeRTOS V202107.00
* 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
* this software and associated documentation files (the "Software"), to deal in
@ -45,11 +45,11 @@ extern void vRegTest1Implementation( void );
extern void vRegTest2Implementation( void );
/* 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;
/* 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 ulRegisterTest2Counter = 0;
/*-----------------------------------------------------------*/

@ -1,6 +1,6 @@
/*
* FreeRTOS V202104.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* FreeRTOS V202107.00
* 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
* this software and associated documentation files (the "Software"), to deal in

@ -1,6 +1,6 @@
/*
* FreeRTOS V202104.00
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* FreeRTOS V202107.00
* 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
* this software and associated documentation files (the "Software"), to deal in
@ -80,8 +80,9 @@
#define mainREGISTER_TEST_PRIORITY ( tskIDLE_PRIORITY )
/* 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
been found, mainERROR_CHECK_TASK_PERIOD is used if an error has been found. */
* pdMS_TO_TICKS() macro. mainNO_ERROR_CHECK_TASK_PERIOD is used if no errors
* 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 mainERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 500UL )
@ -276,9 +277,9 @@ BaseType_t xResult;
#if( configSTART_DELETE_SELF_TESTS == 1 )
{
/* The suicide tasks must be created last as they need to know how many
* tasks were running prior to their creation. This then allows them to
* ascertain whether or not the correct/expected number of tasks are
* running at any given time. */
* tasks were running prior to their creation. This then allows them to
* ascertain whether or not the correct/expected number of tasks are
* running at any given time. */
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
}
#endif /* configSTART_DELETE_SELF_TESTS */
@ -291,7 +292,7 @@ BaseType_t xResult;
void vFullDemoTickHook( void )
{
/* 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 )
{

Loading…
Cancel
Save