mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-15 01:07:47 -04:00
Create Cortex-M3 QEMU project for testing with the IAR compiler (#503)
* Initial version of the CORTEX_MPS2_QEMU_IAR - needs tidying up and so far only contains the comprehensive demo. * Update the comment block at the top of the source files to match the latest official release. * Split out the main_full() demo from main(). Still need to add in the main_blinky() demo. * Add the blinky demo option. * Tidy up the QEMU/IAR project. * Configure the QEMU IAR project to only create the blinky demo. * Delete readme.txt which was in the wrong directory. * Fix errors in the comments at the top of the file as highlighted by the auto checks. Co-authored-by: alfred gedeon <28123637+alfred2g@users.noreply.github.com>
This commit is contained in:
parent
006c6dd5fd
commit
2e4485a0d6
20 changed files with 10306 additions and 0 deletions
94
FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR/IntQueueTimer.c
Normal file
94
FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR/IntQueueTimer.c
Normal file
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* FreeRTOS V202012.00
|
||||
* Copyright (C) 2020 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
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
*/
|
||||
|
||||
/* Scheduler includes. */
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
/* Demo includes. */
|
||||
#include "IntQueueTimer.h"
|
||||
#include "IntQueue.h"
|
||||
|
||||
/* Library includes. */
|
||||
#include "SMM_MPS2.h"
|
||||
|
||||
/* Timer frequencies are slightly offset so they nest. */
|
||||
#define tmrTIMER_0_FREQUENCY ( 2000UL )
|
||||
#define tmrTIMER_1_FREQUENCY ( 2001UL )
|
||||
|
||||
volatile uint32_t ulNest, ulNestCount;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void TIMER0_Handler( void )
|
||||
{
|
||||
/* Clear interrupt. */
|
||||
CMSDK_TIMER0->INTCLEAR = ( 1ul << 0 );
|
||||
if( ulNest > 0 )
|
||||
{
|
||||
/* This interrupt occurred in between the nesting count being incremented
|
||||
and decremented in the TIMER1_Handler. Keep a count of the number of
|
||||
times this happens as its printed out by the check task in main_full.c.*/
|
||||
ulNestCount++;
|
||||
}
|
||||
portEND_SWITCHING_ISR( xSecondTimerHandler() );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void TIMER1_Handler( void )
|
||||
{
|
||||
/* Increment the nest count while inside this ISR as a crude way of the
|
||||
higher priority timer interrupt knowing if it interrupted the execution of
|
||||
this ISR. */
|
||||
ulNest++;
|
||||
/* Clear interrupt. */
|
||||
CMSDK_TIMER1->INTCLEAR = ( 1ul << 0 );
|
||||
portEND_SWITCHING_ISR( xFirstTimerHandler() );
|
||||
ulNest--;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
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 ) | /* Enable Timer interrupt. */
|
||||
( 1ul << 0 ) ); /* Enable Timer. */
|
||||
|
||||
CMSDK_TIMER1->INTCLEAR = ( 1ul << 0 );
|
||||
CMSDK_TIMER1->RELOAD = ( configCPU_CLOCK_HZ / tmrTIMER_1_FREQUENCY ) + 1UL;
|
||||
CMSDK_TIMER1->CTRL = ( ( 1ul << 3 ) |
|
||||
( 1ul << 0 ) );
|
||||
|
||||
NVIC_SetPriority( TIMER0_IRQn, configMAX_SYSCALL_INTERRUPT_PRIORITY );
|
||||
NVIC_SetPriority( TIMER1_IRQn, configMAX_SYSCALL_INTERRUPT_PRIORITY + 1 );
|
||||
NVIC_EnableIRQ( TIMER0_IRQn );
|
||||
NVIC_EnableIRQ( TIMER1_IRQn );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue