mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-23 23:11:58 -04:00
Add main_full.c to Zynq demo. Still a work in progress.
This commit is contained in:
parent
b352be2e23
commit
888733ef79
|
@ -126,7 +126,7 @@
|
||||||
#define configQUEUE_REGISTRY_SIZE 8
|
#define configQUEUE_REGISTRY_SIZE 8
|
||||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||||
#define configUSE_RECURSIVE_MUTEXES 1
|
#define configUSE_RECURSIVE_MUTEXES 1
|
||||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
#define configUSE_MALLOC_FAILED_HOOK 1
|
||||||
#define configUSE_APPLICATION_TASK_TAG 0
|
#define configUSE_APPLICATION_TASK_TAG 0
|
||||||
#define configUSE_COUNTING_SEMAPHORES 1
|
#define configUSE_COUNTING_SEMAPHORES 1
|
||||||
#define configUSE_QUEUE_SETS 1
|
#define configUSE_QUEUE_SETS 1
|
||||||
|
@ -201,5 +201,8 @@ void vConfigureTickInterrupt( void );
|
||||||
|
|
||||||
#define configINSTALL_FREERTOS_VECTOR_TABLE 1
|
#define configINSTALL_FREERTOS_VECTOR_TABLE 1
|
||||||
|
|
||||||
|
void vClearTickInterrupt( void );
|
||||||
|
#define configCLEAR_TICK_INTERRUPT() vClearTickInterrupt()
|
||||||
|
|
||||||
#endif /* FREERTOS_CONFIG_H */
|
#endif /* FREERTOS_CONFIG_H */
|
||||||
|
|
||||||
|
|
|
@ -68,21 +68,16 @@
|
||||||
.org 0
|
.org 0
|
||||||
.text
|
.text
|
||||||
|
|
||||||
.globl _boot
|
.global _boot
|
||||||
.globl _freertos_vector_table
|
.global _freertos_vector_table
|
||||||
|
|
||||||
.globl FIQInterrupt
|
.global FIQInterrupt
|
||||||
//.globl IRQInterrupt
|
|
||||||
//.global SWInterrupt
|
|
||||||
.global DataAbortInterrupt
|
.global DataAbortInterrupt
|
||||||
.global PrefetchAbortInterrupt
|
.global PrefetchAbortInterrupt
|
||||||
|
|
||||||
.extern FreeRTOS_IRQ_Handler
|
.extern FreeRTOS_IRQ_Handler
|
||||||
.extern FreeRTOS_SWI_Handler
|
.extern FreeRTOS_SWI_Handler
|
||||||
|
|
||||||
//.globl IRQHandler
|
|
||||||
//.globl prof_pc
|
|
||||||
|
|
||||||
.section .freertos_vectors
|
.section .freertos_vectors
|
||||||
_freertos_vector_table:
|
_freertos_vector_table:
|
||||||
B _boot
|
B _boot
|
||||||
|
|
|
@ -73,6 +73,8 @@
|
||||||
|
|
||||||
#define XSCUTIMER_CLOCK_HZ ( XPAR_CPU_CORTEXA9_0_CPU_CLK_FREQ_HZ / 2UL )
|
#define XSCUTIMER_CLOCK_HZ ( XPAR_CPU_CORTEXA9_0_CPU_CLK_FREQ_HZ / 2UL )
|
||||||
|
|
||||||
|
static XScuTimer xTimer;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The application must provide a function that configures a peripheral to
|
* The application must provide a function that configures a peripheral to
|
||||||
* create the FreeRTOS tick interrupt, then define configSETUP_TICK_INTERRUPT()
|
* create the FreeRTOS tick interrupt, then define configSETUP_TICK_INTERRUPT()
|
||||||
|
@ -86,7 +88,6 @@ BaseType_t xStatus;
|
||||||
extern void FreeRTOS_Tick_Handler( void );
|
extern void FreeRTOS_Tick_Handler( void );
|
||||||
XScuTimer_Config *pxTimerConfig;
|
XScuTimer_Config *pxTimerConfig;
|
||||||
XScuGic_Config *pxGICConfig;
|
XScuGic_Config *pxGICConfig;
|
||||||
XScuTimer xTimer;
|
|
||||||
|
|
||||||
/* This function is called with the IRQ interrupt disabled, and the IRQ
|
/* This function is called with the IRQ interrupt disabled, and the IRQ
|
||||||
interrupt should be left disabled. It is enabled automatically when the
|
interrupt should be left disabled. It is enabled automatically when the
|
||||||
|
@ -121,6 +122,7 @@ XScuTimer xTimer;
|
||||||
XScuGic_Enable( &xInterruptController, XPAR_SCUTIMER_INTR );
|
XScuGic_Enable( &xInterruptController, XPAR_SCUTIMER_INTR );
|
||||||
|
|
||||||
/* Enable the interrupt in the xTimer itself. */
|
/* Enable the interrupt in the xTimer itself. */
|
||||||
|
vClearTickInterrupt();
|
||||||
XScuTimer_EnableInterrupt( &xTimer );
|
XScuTimer_EnableInterrupt( &xTimer );
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -140,6 +142,12 @@ void vInitialiseRunTimeStats( void )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vClearTickInterrupt( void )
|
||||||
|
{
|
||||||
|
XScuTimer_ClearInterruptStatus( &xTimer );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vApplicationIRQHandler( uint32_t ulICCIAR )
|
void vApplicationIRQHandler( uint32_t ulICCIAR )
|
||||||
{
|
{
|
||||||
extern const XScuGic_Config XScuGic_ConfigTable[];
|
extern const XScuGic_Config XScuGic_ConfigTable[];
|
||||||
|
|
|
@ -102,7 +102,7 @@
|
||||||
|
|
||||||
/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,
|
/* 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. */
|
or 0 to run the more comprehensive test and demo application. */
|
||||||
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1
|
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -220,32 +220,6 @@ volatile size_t xFreeHeapSpace;
|
||||||
|
|
||||||
/* Remove compiler warning about xFreeHeapSpace being set but never used. */
|
/* Remove compiler warning about xFreeHeapSpace being set but never used. */
|
||||||
( void ) xFreeHeapSpace;
|
( void ) xFreeHeapSpace;
|
||||||
|
|
||||||
#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1
|
|
||||||
{
|
|
||||||
/* If the file system is only going to be accessed from one task then
|
|
||||||
F_FS_THREAD_AWARE can be set to 0 and the set of example files is
|
|
||||||
created before the RTOS scheduler is started. If the file system is
|
|
||||||
going to be access from more than one task then F_FS_THREAD_AWARE must
|
|
||||||
be set to 1 and the set of sample files are created from the idle task
|
|
||||||
hook function. */
|
|
||||||
#if F_FS_THREAD_AWARE == 1
|
|
||||||
{
|
|
||||||
static portBASE_TYPE xCreatedSampleFiles = pdFALSE;
|
|
||||||
|
|
||||||
/* Initialise the drive and file system, then create a few example
|
|
||||||
files. The output from this function just goes to the stdout window,
|
|
||||||
allowing the output to be viewed when the UDP command console is not
|
|
||||||
connected. */
|
|
||||||
if( xCreatedSampleFiles == pdFALSE )
|
|
||||||
{
|
|
||||||
vCreateAndVerifySampleFiles();
|
|
||||||
xCreatedSampleFiles = pdTRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -271,7 +245,7 @@ volatile unsigned long ul = 0;
|
||||||
|
|
||||||
void vApplicationTickHook( void )
|
void vApplicationTickHook( void )
|
||||||
{
|
{
|
||||||
#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0
|
#if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )
|
||||||
{
|
{
|
||||||
/* The full demo includes a software timer demo/test that requires
|
/* The full demo includes a software timer demo/test that requires
|
||||||
prodding periodically from the tick interrupt. */
|
prodding periodically from the tick interrupt. */
|
||||||
|
|
459
FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main_full.c
Normal file
459
FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main_full.c
Normal file
|
@ -0,0 +1,459 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V8.0.0:rc1 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||||
|
All rights reserved
|
||||||
|
|
||||||
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS provides completely free yet professionally developed, *
|
||||||
|
* robust, strictly quality controlled, supported, and cross *
|
||||||
|
* platform software that has become a de facto standard. *
|
||||||
|
* *
|
||||||
|
* Help yourself get started quickly and support the FreeRTOS *
|
||||||
|
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||||
|
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||||
|
* *
|
||||||
|
* Thank you! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>! NOTE: The modification to the GPL is included to allow you to distribute
|
||||||
|
>>! a combined work that includes FreeRTOS without being obliged to provide
|
||||||
|
>>! the source code for proprietary components outside of the FreeRTOS
|
||||||
|
>>! kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||||
|
link: http://www.freertos.org/a00114.html
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||||
|
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||||
|
licenses offer ticketed support, indemnification and middleware.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
*/
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* NOTE 1: This project provides two demo applications. A simple blinky style
|
||||||
|
* project, and a more comprehensive test and demo application. The
|
||||||
|
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select
|
||||||
|
* between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
|
||||||
|
* in main.c. This file implements the comprehensive test and demo version.
|
||||||
|
*
|
||||||
|
* NOTE 2: This file only contains the source code that is specific to the
|
||||||
|
* full demo. Generic functions, such FreeRTOS hook functions, and functions
|
||||||
|
* required to configure the hardware, are defined in main.c.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* main_full() creates all the demo application tasks and software timers, then
|
||||||
|
* starts the scheduler. The web documentation provides more details of the
|
||||||
|
* standard demo application tasks, which provide no particular functionality,
|
||||||
|
* but do provide a good example of how to use the FreeRTOS API.
|
||||||
|
*
|
||||||
|
* In addition to the standard demo tasks, the following tasks and tests are
|
||||||
|
* defined and/or created within this file:
|
||||||
|
*
|
||||||
|
* FreeRTOS+CLI command console. The command console is access through UART2
|
||||||
|
* using 115200 baud if mainINCLUDE_FAT_SL_DEMO is set to 1. For reasons of
|
||||||
|
* robustness testing the UART driver is deliberately written to be inefficient
|
||||||
|
* and should not be used as a template for a production driver. Type "help" to
|
||||||
|
* see a list of registered commands. The FreeRTOS+CLI license is different to
|
||||||
|
* the FreeRTOS license, see http://www.FreeRTOS.org/cli for license and usage
|
||||||
|
* details.
|
||||||
|
*
|
||||||
|
* FreeRTOS+FAT SL. FreeRTOS+FAT SL is demonstrated using a RAM disk if
|
||||||
|
* mainINCLUDE_FAT_SL_DEMO is set to 1. [At the time of writing] The
|
||||||
|
* functionality of the file system demo is identical to the functionality of
|
||||||
|
* the FreeRTOS Win32 simulator file system demo, with the command console being
|
||||||
|
* accessed via the UART (as described above) instead of a network terminal.
|
||||||
|
* The FreeRTOS+FAT SL license is different to the FreeRTOS license, see
|
||||||
|
* http://www.FreeRTOS.org/fat_sl for license and usage details, and a
|
||||||
|
* description of the file system demo functionality.
|
||||||
|
*
|
||||||
|
* "Reg test" tasks - These fill both the core and floating point registers with
|
||||||
|
* known values, then check that each register maintains its expected value for
|
||||||
|
* the lifetime of the task. Each task uses a different set of values. The reg
|
||||||
|
* test tasks execute with a very low priority, so get preempted very
|
||||||
|
* frequently. A register containing an unexpected value is indicative of an
|
||||||
|
* error in the context switching mechanism.
|
||||||
|
*
|
||||||
|
* "Check" task - The check task period is initially set to three seconds. The
|
||||||
|
* task checks that all the standard demo tasks, and the register check tasks,
|
||||||
|
* are not only still executing, but are executing without reporting any errors.
|
||||||
|
* If the check task discovers that a task has either stalled, or reported an
|
||||||
|
* error, then it changes its own execution period from the initial three
|
||||||
|
* seconds, to just 200ms. The check task also toggles an LED each time it is
|
||||||
|
* called. This provides a visual indication of the system status: If the LED
|
||||||
|
* toggles every three seconds, then no issues have been discovered. If the LED
|
||||||
|
* toggles every 200ms, then an issue has been discovered with at least one
|
||||||
|
* task.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Standard includes. */
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/* Kernel includes. */
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "timers.h"
|
||||||
|
#include "semphr.h"
|
||||||
|
|
||||||
|
/* Standard demo application includes. */
|
||||||
|
#include "flop.h"
|
||||||
|
#include "semtest.h"
|
||||||
|
#include "dynamic.h"
|
||||||
|
#include "BlockQ.h"
|
||||||
|
#include "blocktim.h"
|
||||||
|
#include "countsem.h"
|
||||||
|
#include "GenQTest.h"
|
||||||
|
#include "recmutex.h"
|
||||||
|
#include "death.h"
|
||||||
|
#include "partest.h"
|
||||||
|
#include "comtest2.h"
|
||||||
|
#include "serial.h"
|
||||||
|
#include "TimerDemo.h"
|
||||||
|
#include "QueueOverwrite.h"
|
||||||
|
|
||||||
|
/* FreeRTOS+CLI and FreeRTOS+FAT SL includes. */
|
||||||
|
//#include "UARTCommandConsole.h"
|
||||||
|
|
||||||
|
/* Priorities for the demo application tasks. */
|
||||||
|
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL )
|
||||||
|
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2UL )
|
||||||
|
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3UL )
|
||||||
|
#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
|
||||||
|
#define mainUART_COMMAND_CONSOLE_STACK_SIZE ( configMINIMAL_STACK_SIZE * 3UL )
|
||||||
|
#define mainCOM_TEST_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||||
|
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
|
||||||
|
#define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY )
|
||||||
|
|
||||||
|
/* The priority used by the UART command console task. */
|
||||||
|
#define mainUART_COMMAND_CONSOLE_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
|
||||||
|
|
||||||
|
/* The LED used by the check timer. */
|
||||||
|
#define mainCHECK_LED ( 0 )
|
||||||
|
|
||||||
|
/* A block time of zero simply means "don't block". */
|
||||||
|
#define mainDONT_BLOCK ( 0UL )
|
||||||
|
|
||||||
|
/* In this example the baud rate is hard coded and there is no LED for use by
|
||||||
|
the COM test tasks, so just set both to invalid values. */
|
||||||
|
#define mainCOM_TEST_LED ( 100 )
|
||||||
|
#define mainBAUD_RATE ( 0 )
|
||||||
|
|
||||||
|
/* The period after which the check timer will expire, in ms, provided no errors
|
||||||
|
have been reported by any of the standard demo tasks. ms are converted to the
|
||||||
|
equivalent in ticks using the portTICK_RATE_MS constant. */
|
||||||
|
#define mainNO_ERROR_CHECK_TASK_PERIOD ( 3000UL / portTICK_RATE_MS )
|
||||||
|
|
||||||
|
/* The period at which the check timer will expire, in ms, if an error has been
|
||||||
|
reported in one of the standard demo tasks. ms are converted to the equivalent
|
||||||
|
in ticks using the portTICK_RATE_MS constant. */
|
||||||
|
#define mainERROR_CHECK_TASK_PERIOD ( 200UL / portTICK_RATE_MS )
|
||||||
|
|
||||||
|
/* Parameters that are passed into the register check tasks solely for the
|
||||||
|
purpose of ensuring parameters are passed into tasks correctly. */
|
||||||
|
#define mainREG_TEST_TASK_1_PARAMETER ( ( void * ) 0x12345678 )
|
||||||
|
#define mainREG_TEST_TASK_2_PARAMETER ( ( void * ) 0x87654321 )
|
||||||
|
|
||||||
|
/* The base period used by the timer test tasks. */
|
||||||
|
#define mainTIMER_TEST_PERIOD ( 50 )
|
||||||
|
|
||||||
|
/* The length of queues used to pass characters into and out of the UART
|
||||||
|
interrupt. Note the comments above about the UART driver being implemented in
|
||||||
|
this way to test the kernel robustness rather than to provide a template for an
|
||||||
|
efficient production driver. */
|
||||||
|
#define mainUART_QUEUE_LENGTHS 10
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called by main() to run the full demo (as opposed to the blinky demo) when
|
||||||
|
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.
|
||||||
|
*/
|
||||||
|
void main_full( void );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The check task, as described at the top of this file.
|
||||||
|
*/
|
||||||
|
static void prvCheckTask( void *pvParameters );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Register check tasks, and the tasks used to write over and check the contents
|
||||||
|
* of the FPU registers, as described at the top of this file. The nature of
|
||||||
|
* these files necessitates that they are written in an assembly file, but the
|
||||||
|
* entry points are kept in the C file for the convenience of checking the task
|
||||||
|
* parameter.
|
||||||
|
*/
|
||||||
|
static void prvRegTestTaskEntry1( void *pvParameters );
|
||||||
|
extern void vRegTest1Implementation( void );
|
||||||
|
static void prvRegTestTaskEntry2( void *pvParameters );
|
||||||
|
extern void vRegTest2Implementation( void );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Register commands that can be used with FreeRTOS+CLI. The commands are
|
||||||
|
* defined in CLI-Commands.c and File-Related-CLI-Command.c respectively.
|
||||||
|
*/
|
||||||
|
extern void vRegisterSampleCLICommands( void );
|
||||||
|
extern void vRegisterFileSystemCLICommands( void );
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* The following two variables are used to communicate the status of the
|
||||||
|
register check tasks to the check software timer. If the variables keep
|
||||||
|
incrementing, then the register check tasks has not discovered any errors. If
|
||||||
|
a variable stops incrementing, then an error has been found. */
|
||||||
|
volatile unsigned long ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void main_full( void )
|
||||||
|
{
|
||||||
|
/* The baud rate setting here has no effect, hence it is set to 0 to
|
||||||
|
make that obvious. */
|
||||||
|
// xSerialPortInitMinimal( 0, mainUART_QUEUE_LENGTHS );
|
||||||
|
|
||||||
|
/* Start all the other standard demo/test tasks. The have not particular
|
||||||
|
functionality, but do demonstrate how to use the FreeRTOS API and test the
|
||||||
|
kernel port. */
|
||||||
|
vStartDynamicPriorityTasks();
|
||||||
|
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
|
||||||
|
vCreateBlockTimeTasks();
|
||||||
|
vStartCountingSemaphoreTasks();
|
||||||
|
vStartGenericQueueTasks( tskIDLE_PRIORITY );
|
||||||
|
vStartRecursiveMutexTasks();
|
||||||
|
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
|
||||||
|
vStartMathTasks( mainFLOP_TASK_PRIORITY );
|
||||||
|
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
|
||||||
|
vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );
|
||||||
|
|
||||||
|
/* Start the tasks that implements the command console on the UART, as
|
||||||
|
described above. */
|
||||||
|
// vUARTCommandConsoleStart( mainUART_COMMAND_CONSOLE_STACK_SIZE, mainUART_COMMAND_CONSOLE_TASK_PRIORITY );
|
||||||
|
|
||||||
|
/* Register the standard CLI commands. */
|
||||||
|
// vRegisterSampleCLICommands();
|
||||||
|
|
||||||
|
|
||||||
|
/* Create the register check tasks, as described at the top of this
|
||||||
|
file */
|
||||||
|
xTaskCreate( prvRegTestTaskEntry1, "Reg1", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_1_PARAMETER, tskIDLE_PRIORITY, NULL );
|
||||||
|
xTaskCreate( prvRegTestTaskEntry2, "Reg2", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
|
/* Create the task that performs the 'check' functionality, as described at
|
||||||
|
the top of this file. */
|
||||||
|
xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
|
||||||
|
|
||||||
|
/* The set of tasks created by the following function call have to be
|
||||||
|
created last as they keep account of the number of tasks they expect to see
|
||||||
|
running. */
|
||||||
|
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
|
||||||
|
|
||||||
|
/* Start the scheduler. */
|
||||||
|
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 either insufficient FreeRTOS heap memory available for the idle
|
||||||
|
and/or timer tasks to be created, or vTaskStartScheduler() was called from
|
||||||
|
User mode. See the memory management section on the FreeRTOS web site for
|
||||||
|
more details on the FreeRTOS heap http://www.freertos.org/a00111.html. The
|
||||||
|
mode from which main() is called is set in the C start up code and must be
|
||||||
|
a privileged mode (not user mode). */
|
||||||
|
for( ;; );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
#error Fails when the tick hook is used
|
||||||
|
static void prvCheckTask( void *pvParameters )
|
||||||
|
{
|
||||||
|
portTickType xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD;
|
||||||
|
portTickType xLastExecutionTime;
|
||||||
|
static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0;
|
||||||
|
unsigned long ulErrorFound = pdFALSE;
|
||||||
|
|
||||||
|
/* Just to stop compiler warnings. */
|
||||||
|
( void ) pvParameters;
|
||||||
|
|
||||||
|
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
|
||||||
|
works correctly. */
|
||||||
|
xLastExecutionTime = xTaskGetTickCount();
|
||||||
|
|
||||||
|
/* Cycle for ever, delaying then checking all the other tasks are still
|
||||||
|
operating without error. The onboard LED is toggled on each iteration.
|
||||||
|
If an error is detected then the delay period is decreased from
|
||||||
|
mainNO_ERROR_CHECK_TASK_PERIOD to mainERROR_CHECK_TASK_PERIOD. This has the
|
||||||
|
effect of increasing the rate at which the onboard LED toggles, and in so
|
||||||
|
doing gives visual feedback of the system status. */
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
/* Delay until it is time to execute again. */
|
||||||
|
vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );
|
||||||
|
|
||||||
|
/* Check all the demo tasks (other than the flash tasks) to ensure
|
||||||
|
that they are all still running, and that none have detected an error. */
|
||||||
|
if( xAreMathsTaskStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulErrorFound = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulErrorFound = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xAreBlockingQueuesStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulErrorFound = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulErrorFound = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( xAreGenericQueueTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulErrorFound = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulErrorFound = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xIsCreateTaskStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulErrorFound = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulErrorFound = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xAreTimerDemoTasksStillRunning( ( portTickType ) mainNO_ERROR_CHECK_TASK_PERIOD ) != pdPASS )
|
||||||
|
{
|
||||||
|
ulErrorFound = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
ulErrorFound = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xIsQueueOverwriteTaskStillRunning() != pdPASS )
|
||||||
|
{
|
||||||
|
ulErrorFound = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check that the register test 1 task is still running. */
|
||||||
|
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
|
||||||
|
{
|
||||||
|
ulErrorFound = pdTRUE;
|
||||||
|
}
|
||||||
|
ulLastRegTest1Value = ulRegTest1LoopCounter;
|
||||||
|
|
||||||
|
/* Check that the register test 2 task is still running. */
|
||||||
|
if( ulLastRegTest2Value == ulRegTest2LoopCounter )
|
||||||
|
{
|
||||||
|
ulErrorFound = pdTRUE;
|
||||||
|
}
|
||||||
|
ulLastRegTest2Value = ulRegTest2LoopCounter;
|
||||||
|
|
||||||
|
/* Toggle the check LED to give an indication of the system status. If
|
||||||
|
the LED toggles every mainNO_ERROR_CHECK_TASK_PERIOD milliseconds then
|
||||||
|
everything is ok. A faster toggle indicates an error. */
|
||||||
|
vParTestToggleLED( mainCHECK_LED );
|
||||||
|
|
||||||
|
if( ulErrorFound != pdFALSE )
|
||||||
|
{
|
||||||
|
/* An error has been detected in one of the tasks - flash the LED
|
||||||
|
at a higher frequency to give visible feedback that something has
|
||||||
|
gone wrong (it might just be that the loop back connector required
|
||||||
|
by the comtest tasks has not been fitted). */
|
||||||
|
xDelayPeriod = mainERROR_CHECK_TASK_PERIOD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvRegTestTaskEntry1( void *pvParameters )
|
||||||
|
{
|
||||||
|
/* Although the regtest task is written in assembler, its entry point is
|
||||||
|
written in C for convenience of checking the task parameter is being passed
|
||||||
|
in correctly. */
|
||||||
|
if( pvParameters == mainREG_TEST_TASK_1_PARAMETER )
|
||||||
|
{
|
||||||
|
/* The reg test task also tests the floating point registers. Tasks
|
||||||
|
that use the floating point unit must call vPortTaskUsesFPU() before
|
||||||
|
any floating point instructions are executed. */
|
||||||
|
vPortTaskUsesFPU();
|
||||||
|
|
||||||
|
/* Start the part of the test that is written in assembler. */
|
||||||
|
vRegTest1Implementation();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The following line will only execute if the task parameter is found to
|
||||||
|
be incorrect. The check timer will detect that the regtest loop counter is
|
||||||
|
not being incremented and flag an error. */
|
||||||
|
vTaskDelete( NULL );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvRegTestTaskEntry2( void *pvParameters )
|
||||||
|
{
|
||||||
|
/* Although the regtest task is written in assembler, its entry point is
|
||||||
|
written in C for convenience of checking the task parameter is being passed
|
||||||
|
in correctly. */
|
||||||
|
if( pvParameters == mainREG_TEST_TASK_2_PARAMETER )
|
||||||
|
{
|
||||||
|
/* The reg test task also tests the floating point registers. Tasks
|
||||||
|
that use the floating point unit must call vPortTaskUsesFPU() before
|
||||||
|
any floating point instructions are executed. */
|
||||||
|
vPortTaskUsesFPU();
|
||||||
|
|
||||||
|
/* Start the part of the test that is written in assembler. */
|
||||||
|
vRegTest2Implementation();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The following line will only execute if the task parameter is found to
|
||||||
|
be incorrect. The check timer will detect that the regtest loop counter is
|
||||||
|
not being incremented and flag an error. */
|
||||||
|
vTaskDelete( NULL );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
656
FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/reg_test.S
Normal file
656
FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/reg_test.S
Normal file
|
@ -0,0 +1,656 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V8.0.0:rc1 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.global vRegTest1Implementation
|
||||||
|
.global vRegTest2Implementation
|
||||||
|
.extern ulRegTest1LoopCounter
|
||||||
|
.extern ulRegTest2LoopCounter
|
||||||
|
|
||||||
|
.text
|
||||||
|
.arm
|
||||||
|
|
||||||
|
/* This function is explained in the comments at the top of main-full.c. */
|
||||||
|
vRegTest1Implementation:
|
||||||
|
|
||||||
|
/* Fill each general purpose register with a known value. */
|
||||||
|
mov r0, #0xFF
|
||||||
|
mov r1, #0x11
|
||||||
|
mov r2, #0x22
|
||||||
|
mov r3, #0x33
|
||||||
|
mov r4, #0x44
|
||||||
|
mov r5, #0x55
|
||||||
|
mov r6, #0x66
|
||||||
|
mov r7, #0x77
|
||||||
|
mov r8, #0x88
|
||||||
|
mov r9, #0x99
|
||||||
|
mov r10, #0xAA
|
||||||
|
mov r11, #0xBB
|
||||||
|
mov r12, #0xCC
|
||||||
|
mov r14, #0xEE
|
||||||
|
|
||||||
|
/* Fill each FPU register with a known value. */
|
||||||
|
vmov d0, r0, r1
|
||||||
|
vmov d1, r2, r3
|
||||||
|
vmov d2, r4, r5
|
||||||
|
vmov d3, r6, r7
|
||||||
|
vmov d4, r8, r9
|
||||||
|
vmov d5, r10, r11
|
||||||
|
vmov d6, r0, r1
|
||||||
|
vmov d7, r2, r3
|
||||||
|
vmov d8, r4, r5
|
||||||
|
vmov d9, r6, r7
|
||||||
|
vmov d10, r8, r9
|
||||||
|
vmov d11, r10, r11
|
||||||
|
vmov d12, r0, r1
|
||||||
|
vmov d13, r2, r3
|
||||||
|
vmov d14, r4, r5
|
||||||
|
vmov d15, r6, r7
|
||||||
|
|
||||||
|
vmov d16, r0, r1
|
||||||
|
vmov d17, r2, r3
|
||||||
|
vmov d18, r4, r5
|
||||||
|
vmov d19, r6, r7
|
||||||
|
vmov d20, r8, r9
|
||||||
|
vmov d21, r10, r11
|
||||||
|
vmov d22, r0, r1
|
||||||
|
vmov d23, r2, r3
|
||||||
|
vmov d24, r4, r5
|
||||||
|
vmov d25, r6, r7
|
||||||
|
vmov d26, r8, r9
|
||||||
|
vmov d27, r10, r11
|
||||||
|
vmov d28, r0, r1
|
||||||
|
vmov d29, r2, r3
|
||||||
|
vmov d30, r4, r5
|
||||||
|
vmov d31, r6, r7
|
||||||
|
|
||||||
|
/* Loop, checking each itteration that each register still contains the
|
||||||
|
expected value. */
|
||||||
|
reg1_loop:
|
||||||
|
/* Yield to increase test coverage */
|
||||||
|
svc 0
|
||||||
|
|
||||||
|
/* Check all the VFP registers still contain the values set above.
|
||||||
|
First save registers that are clobbered by the test. */
|
||||||
|
push { r0-r1 }
|
||||||
|
|
||||||
|
vmov r0, r1, d0
|
||||||
|
cmp r0, #0xFF
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x11
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d1
|
||||||
|
cmp r0, #0x22
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x33
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d2
|
||||||
|
cmp r0, #0x44
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x55
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d3
|
||||||
|
cmp r0, #0x66
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x77
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d4
|
||||||
|
cmp r0, #0x88
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x99
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d5
|
||||||
|
cmp r0, #0xAA
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0xBB
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d6
|
||||||
|
cmp r0, #0xFF
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x11
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d7
|
||||||
|
cmp r0, #0x22
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x33
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d8
|
||||||
|
cmp r0, #0x44
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x55
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d9
|
||||||
|
cmp r0, #0x66
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x77
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d10
|
||||||
|
cmp r0, #0x88
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x99
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d11
|
||||||
|
cmp r0, #0xAA
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0xBB
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d12
|
||||||
|
cmp r0, #0xFF
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x11
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d13
|
||||||
|
cmp r0, #0x22
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x33
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d14
|
||||||
|
cmp r0, #0x44
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x55
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d15
|
||||||
|
cmp r0, #0x66
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x77
|
||||||
|
bne reg1_error_loopf
|
||||||
|
|
||||||
|
vmov r0, r1, d16
|
||||||
|
cmp r0, #0xFF
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x11
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d17
|
||||||
|
cmp r0, #0x22
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x33
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d18
|
||||||
|
cmp r0, #0x44
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x55
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d19
|
||||||
|
cmp r0, #0x66
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x77
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d20
|
||||||
|
cmp r0, #0x88
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x99
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d21
|
||||||
|
cmp r0, #0xAA
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0xBB
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d22
|
||||||
|
cmp r0, #0xFF
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x11
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d23
|
||||||
|
cmp r0, #0x22
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x33
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d24
|
||||||
|
cmp r0, #0x44
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x55
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d25
|
||||||
|
cmp r0, #0x66
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x77
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d26
|
||||||
|
cmp r0, #0x88
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x99
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d27
|
||||||
|
cmp r0, #0xAA
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0xBB
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d28
|
||||||
|
cmp r0, #0xFF
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x11
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d29
|
||||||
|
cmp r0, #0x22
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x33
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d30
|
||||||
|
cmp r0, #0x44
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x55
|
||||||
|
bne reg1_error_loopf
|
||||||
|
vmov r0, r1, d31
|
||||||
|
cmp r0, #0x66
|
||||||
|
bne reg1_error_loopf
|
||||||
|
cmp r1, #0x77
|
||||||
|
bne reg1_error_loopf
|
||||||
|
|
||||||
|
/* Restore the registers that were clobbered by the test. */
|
||||||
|
pop {r0-r1}
|
||||||
|
|
||||||
|
/* VFP register test passed. Jump to the core register test. */
|
||||||
|
b reg1_loopf_pass
|
||||||
|
|
||||||
|
reg1_error_loopf:
|
||||||
|
/* If this line is hit then a VFP register value was found to be
|
||||||
|
incorrect. */
|
||||||
|
b reg1_error_loopf
|
||||||
|
|
||||||
|
reg1_loopf_pass:
|
||||||
|
|
||||||
|
/* Test each general purpose register to check that it still contains the
|
||||||
|
expected known value, jumping to reg1_error_loop if any register contains
|
||||||
|
an unexpected value. */
|
||||||
|
cmp r0, #0xFF
|
||||||
|
bne reg1_error_loop
|
||||||
|
cmp r1, #0x11
|
||||||
|
bne reg1_error_loop
|
||||||
|
cmp r2, #0x22
|
||||||
|
bne reg1_error_loop
|
||||||
|
cmp r3, #0x33
|
||||||
|
bne reg1_error_loop
|
||||||
|
cmp r4, #0x44
|
||||||
|
bne reg1_error_loop
|
||||||
|
cmp r5, #0x55
|
||||||
|
bne reg1_error_loop
|
||||||
|
cmp r6, #0x66
|
||||||
|
bne reg1_error_loop
|
||||||
|
cmp r7, #0x77
|
||||||
|
bne reg1_error_loop
|
||||||
|
cmp r8, #0x88
|
||||||
|
bne reg1_error_loop
|
||||||
|
cmp r9, #0x99
|
||||||
|
bne reg1_error_loop
|
||||||
|
cmp r10, #0xAA
|
||||||
|
bne reg1_error_loop
|
||||||
|
cmp r11, #0xBB
|
||||||
|
bne reg1_error_loop
|
||||||
|
cmp r12, #0xCC
|
||||||
|
bne reg1_error_loop
|
||||||
|
cmp r14, #0xEE
|
||||||
|
bne reg1_error_loop
|
||||||
|
|
||||||
|
/* Everything passed, increment the loop counter. */
|
||||||
|
push { r0-r1 }
|
||||||
|
ldr r0, =ulRegTest1LoopCounter
|
||||||
|
ldr r1, [r0]
|
||||||
|
adds r1, r1, #1
|
||||||
|
str r1, [r0]
|
||||||
|
pop { r0-r1 }
|
||||||
|
|
||||||
|
/* Start again. */
|
||||||
|
b reg1_loop
|
||||||
|
|
||||||
|
reg1_error_loop:
|
||||||
|
/* If this line is hit then there was an error in a core register value.
|
||||||
|
The loop ensures the loop counter stops incrementing. */
|
||||||
|
b reg1_error_loop
|
||||||
|
nop
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
vRegTest2Implementation:
|
||||||
|
|
||||||
|
/* Put a known value in each register. */
|
||||||
|
mov r0, #0xFF000000
|
||||||
|
mov r1, #0x11000000
|
||||||
|
mov r2, #0x22000000
|
||||||
|
mov r3, #0x33000000
|
||||||
|
mov r4, #0x44000000
|
||||||
|
mov r5, #0x55000000
|
||||||
|
mov r6, #0x66000000
|
||||||
|
mov r7, #0x77000000
|
||||||
|
mov r8, #0x88000000
|
||||||
|
mov r9, #0x99000000
|
||||||
|
mov r10, #0xAA000000
|
||||||
|
mov r11, #0xBB000000
|
||||||
|
mov r12, #0xCC000000
|
||||||
|
mov r14, #0xEE000000
|
||||||
|
|
||||||
|
/* Likewise the floating point registers */
|
||||||
|
vmov d0, r0, r1
|
||||||
|
vmov d1, r2, r3
|
||||||
|
vmov d2, r4, r5
|
||||||
|
vmov d3, r6, r7
|
||||||
|
vmov d4, r8, r9
|
||||||
|
vmov d5, r10, r11
|
||||||
|
vmov d6, r0, r1
|
||||||
|
vmov d7, r2, r3
|
||||||
|
vmov d8, r4, r5
|
||||||
|
vmov d9, r6, r7
|
||||||
|
vmov d10, r8, r9
|
||||||
|
vmov d11, r10, r11
|
||||||
|
vmov d12, r0, r1
|
||||||
|
vmov d13, r2, r3
|
||||||
|
vmov d14, r4, r5
|
||||||
|
vmov d15, r6, r7
|
||||||
|
|
||||||
|
vmov d16, r0, r1
|
||||||
|
vmov d17, r2, r3
|
||||||
|
vmov d18, r4, r5
|
||||||
|
vmov d19, r6, r7
|
||||||
|
vmov d20, r8, r9
|
||||||
|
vmov d21, r10, r11
|
||||||
|
vmov d22, r0, r1
|
||||||
|
vmov d23, r2, r3
|
||||||
|
vmov d24, r4, r5
|
||||||
|
vmov d25, r6, r7
|
||||||
|
vmov d26, r8, r9
|
||||||
|
vmov d27, r10, r11
|
||||||
|
vmov d28, r0, r1
|
||||||
|
vmov d29, r2, r3
|
||||||
|
vmov d30, r4, r5
|
||||||
|
vmov d31, r6, r7
|
||||||
|
|
||||||
|
/* Loop, checking each itteration that each register still contains the
|
||||||
|
expected value. */
|
||||||
|
reg2_loop:
|
||||||
|
/* Check all the VFP registers still contain the values set above.
|
||||||
|
First save registers that are clobbered by the test. */
|
||||||
|
push { r0-r1 }
|
||||||
|
|
||||||
|
vmov r0, r1, d0
|
||||||
|
cmp r0, #0xFF000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x11000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d1
|
||||||
|
cmp r0, #0x22000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x33000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d2
|
||||||
|
cmp r0, #0x44000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x55000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d3
|
||||||
|
cmp r0, #0x66000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x77000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d4
|
||||||
|
cmp r0, #0x88000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x99000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d5
|
||||||
|
cmp r0, #0xAA000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0xBB000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d6
|
||||||
|
cmp r0, #0xFF000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x11000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d7
|
||||||
|
cmp r0, #0x22000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x33000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d8
|
||||||
|
cmp r0, #0x44000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x55000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d9
|
||||||
|
cmp r0, #0x66000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x77000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d10
|
||||||
|
cmp r0, #0x88000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x99000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d11
|
||||||
|
cmp r0, #0xAA000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0xBB000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d12
|
||||||
|
cmp r0, #0xFF000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x11000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d13
|
||||||
|
cmp r0, #0x22000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x33000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d14
|
||||||
|
cmp r0, #0x44000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x55000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d15
|
||||||
|
cmp r0, #0x66000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x77000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
|
||||||
|
vmov r0, r1, d16
|
||||||
|
cmp r0, #0xFF000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x11000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d17
|
||||||
|
cmp r0, #0x22000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x33000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d18
|
||||||
|
cmp r0, #0x44000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x55000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d19
|
||||||
|
cmp r0, #0x66000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x77000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d20
|
||||||
|
cmp r0, #0x88000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x99000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d21
|
||||||
|
cmp r0, #0xAA000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0xBB000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d22
|
||||||
|
cmp r0, #0xFF000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x11000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d23
|
||||||
|
cmp r0, #0x22000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x33000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d24
|
||||||
|
cmp r0, #0x44000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x55000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d25
|
||||||
|
cmp r0, #0x66000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x77000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d26
|
||||||
|
cmp r0, #0x88000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x99000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d27
|
||||||
|
cmp r0, #0xAA000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0xBB000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d28
|
||||||
|
cmp r0, #0xFF000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x11000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d29
|
||||||
|
cmp r0, #0x22000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x33000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d30
|
||||||
|
cmp r0, #0x44000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x55000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
vmov r0, r1, d31
|
||||||
|
cmp r0, #0x66000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
cmp r1, #0x77000000
|
||||||
|
bne reg2_error_loopf
|
||||||
|
|
||||||
|
/* Restore the registers that were clobbered by the test. */
|
||||||
|
pop {r0-r1}
|
||||||
|
|
||||||
|
/* VFP register test passed. Jump to the core register test. */
|
||||||
|
b reg2_loopf_pass
|
||||||
|
|
||||||
|
reg2_error_loopf:
|
||||||
|
/* If this line is hit then a VFP register value was found to be
|
||||||
|
incorrect. */
|
||||||
|
b reg2_error_loopf
|
||||||
|
|
||||||
|
reg2_loopf_pass:
|
||||||
|
|
||||||
|
cmp r0, #0xFF000000
|
||||||
|
bne reg2_error_loop
|
||||||
|
cmp r1, #0x11000000
|
||||||
|
bne reg2_error_loop
|
||||||
|
cmp r2, #0x22000000
|
||||||
|
bne reg2_error_loop
|
||||||
|
cmp r3, #0x33000000
|
||||||
|
bne reg2_error_loop
|
||||||
|
cmp r4, #0x44000000
|
||||||
|
bne reg2_error_loop
|
||||||
|
cmp r5, #0x55000000
|
||||||
|
bne reg2_error_loop
|
||||||
|
cmp r6, #0x66000000
|
||||||
|
bne reg2_error_loop
|
||||||
|
cmp r7, #0x77000000
|
||||||
|
bne reg2_error_loop
|
||||||
|
cmp r8, #0x88000000
|
||||||
|
bne reg2_error_loop
|
||||||
|
cmp r9, #0x99000000
|
||||||
|
bne reg2_error_loop
|
||||||
|
cmp r10, #0xAA000000
|
||||||
|
bne reg2_error_loop
|
||||||
|
cmp r11, #0xBB000000
|
||||||
|
bne reg2_error_loop
|
||||||
|
cmp r12, #0xCC000000
|
||||||
|
bne reg2_error_loop
|
||||||
|
cmp r14, #0xEE000000
|
||||||
|
bne reg2_error_loop
|
||||||
|
|
||||||
|
/* Everything passed, increment the loop counter. */
|
||||||
|
push { r0-r1 }
|
||||||
|
ldr r0, =ulRegTest2LoopCounter
|
||||||
|
ldr r1, [r0]
|
||||||
|
adds r1, r1, #1
|
||||||
|
str r1, [r0]
|
||||||
|
pop { r0-r1 }
|
||||||
|
|
||||||
|
/* Start again. */
|
||||||
|
b reg2_loop
|
||||||
|
|
||||||
|
reg2_error_loop:
|
||||||
|
/* If this line is hit then there was an error in a core register value.
|
||||||
|
The loop ensures the loop counter stops incrementing. */
|
||||||
|
b reg2_error_loop
|
||||||
|
nop
|
||||||
|
|
||||||
|
|
||||||
|
.end
|
||||||
|
|
Loading…
Reference in a new issue