mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-16 01:37:45 -04:00
* Remove co-routine centric CORTEX_LM3S102_Rowley demos. Remove CORTEX_LM3S102_Rowley Demo2 and Demo3. Update Demo1 to no longer use coroutines. * Remove co-routines from MB91460_Softune demo * FreeRTOS_96348hs_SK16FX100PMC: Remove co-routine usage. Remove co-routine usage from FreeRTOS_96348hs_SK16FX100PMC demo. * MB96350_Softune_Dice_Kit: Remove co-routine usage Remove co-routines usage from MB96350_Softune_Dice_Kit demo * AVR_Dx_IAR: Remove co-routine usage * AVR_Dx_Atmel_Studio: Remove co-routine usage * PIC24_MPLAB: Remove autogenerated files and add to .gitignore * PIC24_MPLAB: Remove co-routine usage from demo * AVR_ATMega323_IAR: Remove co-routine usage * ColdFire_MCF52221_CodeWarrior: Remove coroutine usage * AVR_ATMega4809_MPLAB.X: Remove co-routine usage * AVR_ATMega4809_IAR: Remove co-routine usage * AVR_ATMega4809_Atmel_Studio: Remove coroutine usage * AVR_ATMega323_WinAVR: Remove coroutine usage * AVR_Dx_MPLAB.X: Remove coroutine usage * dsPIC_MPLAB: Remove coroutine usage * CORTEX_LM3S102_GCC: Remove coroutines and coroutine centric demos * CORTEX_LM3S102_GCC: Update makefile to discard unused symbols Allows fitting in the limited ram/flash for this part. * CORTEX_LM3S316_IAR: Remove coroutines * Demos: Remove references to crflash.c, crhook.c, crflash.h, crhook.h * Remove coroutine options from FreeRTOSConfig.h files * Xilinx: Remove backup file generated by revup utility * Demos: Remove Coroutine related config items and references * Format CBMC FreeRTOSConfig.h * Update URL from aws.amazon.com/freertos to github.com/FreeRTOS * Fix copyright year and license text * Fix license text in demo files * Update header check excluded path list * Add configBENCHMARK to lexicon
6.3 KiB
6.3 KiB
Create a Test Project
Initial Setup
- Create a new directory in the FreeRTOS Partner Supported Demos Repository
or FreeRTOS Community Supported Demos Repository.
The suggested name for the directory is
<hardware_name>_<compiler_name>
. - Create a project for your hardware and tool-chain in this directory.
- Copy all the files in the FreeRTOS/Demo/ThirdParty/Template
directory to your project directory:
IntQueueTimer.h
IntQueueTimer.c
TestRunner.h
TestRunner.c
RegTests.h
RegTests.c
Project Configuration
- Compile the following additional files in your project:
- All files in the FreeRTOS/Demo/Common/Minimal directory except
comtest_strings.c
,comtest.c
,flash.c
,flash_timer.c
andsp_flop.c
.
- All files in the FreeRTOS/Demo/Common/Minimal directory except
- Add the following paths to your include search path:
FreeRTOS/Demo/Common/include
.
- Call the
void vStartTests( void )
function from yourmain
function after doing all the hardware initialization. Note that this function starts the scheduler and therefore, never returns.
#include "TestRunner.h"
void main( void )
{
/* Startup and Hardware initialization. */
/* Start tests. */
vStartTests();
/* Should never reach here. */
for( ; ; );
}
Set up FreeRTOSConfig.h
- Enable tick hook by adding the following line in your
FreeRTOSConfig.h
:
#define configUSE_TICK_HOOK 1
- Set the task notification array size to 3 by adding the following line in
your
FreeRTOSConfig.h
:
#define configTASK_NOTIFICATION_ARRAY_ENTRIES 3
- Enable printing by mapping
configPRINTF
to your print function. Note thatconfigPRINTF
calls are wrapped in double parentheses to support C89. If you have a thread-safeprintf
function, the following is what should be added in yourFreeRTOSConfig.h
:
#define configPRINTF( X ) printf X
- Add the following defines in your
FreeRTOSConfig.h
:
#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
- Fill the definitions of the following functions in the
RegTests.c
file copied in the Initial Setup step:prvRegisterTest1Task
prvRegisterTest2Task
prvRegisterTest3Task
prvRegisterTest4Task
- Define
configSTART_REGISTER_TESTS
to1
in yourFreeRTOSConfig.h
:
#define configSTART_REGISTER_TESTS 1
- 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
- If your hardware does not support interrupt nesting, skip this section.
- Fill the
void vInitialiseTimerForIntQueueTest( void )
function in theIntQueueTimer.c
file copied in the 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 toconfigMAX_SYSCALL_INTERRUPT_PRIORITY
. The following is an example for ARM MPS2 which starts TIM0 timer:
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 );
}
- 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 callsIntQueueTestTimerHandler
from the TIM0 handler:
void TIMER0_Handler( void )
{
/* Clear interrupt. */
CMSDK_TIMER0->INTCLEAR = ( 1ul << 0 );
IntQueueTestTimerHandler();
}
- Define
configSTART_INTERRUPT_QUEUE_TESTS
to1
in yourFreeRTOSConfig.h
:
#define configSTART_INTERRUPT_QUEUE_TESTS 1
- Build and run the tests. The output should look like the following:
No errors
No errors
No errors
No errors
Running All Tests
- Define all the
configSTART_<Test_Name>_TESTS
macros to1
in yourFreeRTOSConfig.h
. - Build and run the tests. The output should look like the following:
No errors
No errors
No errors
No errors
- 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 to0
or1
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.