From 12924ac48ee70f8dc3a74fa67164faea67488eb5 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Fri, 3 Jun 2011 09:01:21 +0000 Subject: [PATCH] Continue work on MicroBlaze port - still very much a work in progress. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1443 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../RTOSDemoSource/FreeRTOSConfig.h | 2 +- .../portable/GCC/MicroBlaze/port.c | 14 ++-- .../portable/GCC/MicroBlaze/portasm.s | 67 +++++++++++++++++-- .../SDKProjects/RTOSDemoSource/main-blinky.c | 2 +- 4 files changed, 69 insertions(+), 16 deletions(-) diff --git a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h index b1d3b6718..3475e05a3 100644 --- a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h +++ b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h @@ -80,7 +80,7 @@ #define configUSE_PREEMPTION 1 #define configUSE_IDLE_HOOK 1 #define configUSE_TICK_HOOK 0 -#define configCPU_CLOCK_HZ ( 100000000UL ) +#define configCPU_CLOCK_HZ ( XPAR_MICROBLAZE_CORE_CLOCK_FREQ_HZ ) #define configTICK_RATE_HZ ( ( portTickType ) 1000 ) #define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 10 * 1024 ) ) diff --git a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/port.c b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/port.c index ed39d1d2c..e2731f8d1 100644 --- a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/port.c +++ b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/port.c @@ -229,7 +229,6 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_; portBASE_TYPE xPortStartScheduler( void ) { extern void ( vStartFirstTask )( void ); -int iStatus; /* Setup the hardware to generate the tick. Interrupts are disabled when this function is called. */ @@ -245,14 +244,8 @@ int iStatus; memset( pulISRStack, portISR_STACK_FILL_VALUE, configMINIMAL_STACK_SIZE * sizeof( portSTACK_TYPE ) ); pulISRStack += ( configMINIMAL_STACK_SIZE - 1 ); - /* Enable exceptions. */ - microblaze_enable_interrupts(); - - if( iStatus == XST_SUCCESS ) - { - /* Kick off the first task. */ - vStartFirstTask(); - } + /* From here on, the created tasks will be executing. */ + vStartFirstTask(); } /* Should not get here as the tasks are now running! */ @@ -383,6 +376,7 @@ void vTickISR( void *pvUnused ) static portBASE_TYPE prvInitialiseInterruptController( void ) { portBASE_TYPE xStatus; +extern Xil_ExceptionHandler vPortFreeRTOSInterruptHandler; xStatus = XIntc_Initialize( &xInterruptControllerInstance, configINTERRUPT_CONTROLLER_TO_USE ); @@ -393,7 +387,7 @@ portBASE_TYPE xStatus; /* Register the interrupt controller handle that uses the exception table. */ - Xil_ExceptionRegisterHandler( XIL_EXCEPTION_ID_INT, ( Xil_ExceptionHandler ) XIntc_DeviceInterruptHandler, NULL ); + Xil_ExceptionRegisterHandler( XIL_EXCEPTION_ID_INT, vPortFreeRTOSInterruptHandler, NULL ); /* Service all pending interrupts each time the handler is entered. */ XIntc_SetIntrSvcOption( xInterruptControllerInstance.BaseAddress, XIN_SVC_ALL_ISRS_OPTION ); diff --git a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portasm.s b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portasm.s index ac8545a2a..ea597dca2 100644 --- a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portasm.s +++ b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portasm.s @@ -1,10 +1,69 @@ +/* + FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd. + + + FreeRTOS supports many tools and architectures. V7.0.0 is sponsored by: + Atollic AB - Atollic provides professional embedded systems development + tools for C/C++ development, code analysis and test automation. + See http://www.atollic.com + + + *************************************************************************** + * * + * 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 it + can be viewed here: http://www.freertos.org/a00114.html and also obtained + by writing to Richard Barry, contact details for whom are available on the + FreeRTOS WEB site. + + 1 tab == 4 spaces! + + http://www.FreeRTOS.org - Documentation, latest information, license and + contact details. + + http://www.SafeRTOS.com - A version that is certified for use in safety + critical systems. + + http://www.OpenRTOS.com - Commercial support, development, porting, + licensing and training services. +*/ + .extern pxCurrentTCB - .extern vTaskISRHandler + .extern XIntc_DeviceInterruptHandler .extern vTaskSwitchContext .extern uxCriticalNesting .extern pulISRStack - .global _interrupt_handler + .global vPortFreeRTOSInterruptHandler .global VPortYieldASM .global vStartFirstTask @@ -129,7 +188,7 @@ .align 2 -_interrupt_handler: +vPortFreeRTOSInterruptHandler: portSAVE_CONTEXT /* Entered via an interrupt so interrupts must be enabled in msr. */ ori r31, r31, 2 @@ -141,7 +200,7 @@ _interrupt_handler: /* Now switch to use the ISR stack. */ lwi r3, r0, pulISRStack add r1, r3, r0 - bralid r15, vTaskISRHandler + bralid r15, XIntc_DeviceInterruptHandler or r0, r0, r0 portRESTORE_CONTEXT diff --git a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/main-blinky.c b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/main-blinky.c index 2401a10ad..649754b2f 100644 --- a/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/main-blinky.c +++ b/Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/main-blinky.c @@ -380,7 +380,7 @@ void vApplicationSetupTimerInterrupt( void ) { portBASE_TYPE xStatus; const unsigned char ucTimerCounterNumber = ( unsigned char ) 0U; -const unsigned long ulCounterValue = ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) + 1UL ); +const unsigned long ulCounterValue = ( ( XPAR_AXI_TIMER_0_CLOCK_FREQ_HZ / configTICK_RATE_HZ ) - 1UL ); extern void vTickISR( void *pvUnused ); /* Initialise the timer/counter. */ -- 2.39.5