New MicroBlaze port: Added a FreeRTOS exception handler, and installed it in each position in the exception table. The handler itself does not do much yet.

pull/4/head
Richard Barry 14 years ago
parent 4108061316
commit 8b0ccf1444

@ -74,7 +74,7 @@
<listOptionValue builtIn="false" value="../../RTOSDemoBSP/microblaze_0/lib"/> <listOptionValue builtIn="false" value="../../RTOSDemoBSP/microblaze_0/lib"/>
</option> </option>
<option id="xilinx.gnu.c.linker.option.lscript.176750025" name="Linker Script" superClass="xilinx.gnu.c.linker.option.lscript" value="../src/lscript.ld" valueType="string"/> <option id="xilinx.gnu.c.linker.option.lscript.176750025" name="Linker Script" superClass="xilinx.gnu.c.linker.option.lscript" value="../src/lscript.ld" valueType="string"/>
<option id="xilinx.gnu.c.link.option.ldflags.1590675094" superClass="xilinx.gnu.c.link.option.ldflags" value="" valueType="string"/> <option id="xilinx.gnu.c.link.option.ldflags.1590675094" name="Linker Flags" superClass="xilinx.gnu.c.link.option.ldflags" value="" valueType="string"/>
<inputType id="xilinx.gnu.linker.input.384537517" superClass="xilinx.gnu.linker.input"> <inputType id="xilinx.gnu.linker.input.384537517" superClass="xilinx.gnu.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/> <additionalInput kind="additionalinput" paths="$(LIBS)"/>
@ -93,7 +93,7 @@
<listOptionValue builtIn="false" value="../../RTOSDemoBSP/microblaze_0/lib"/> <listOptionValue builtIn="false" value="../../RTOSDemoBSP/microblaze_0/lib"/>
</option> </option>
<option id="xilinx.gnu.c.linker.option.lscript.664782973" name="Linker Script" superClass="xilinx.gnu.c.linker.option.lscript" value="../src/lscript.ld" valueType="string"/> <option id="xilinx.gnu.c.linker.option.lscript.664782973" name="Linker Script" superClass="xilinx.gnu.c.linker.option.lscript" value="../src/lscript.ld" valueType="string"/>
<option id="xilinx.gnu.c.link.option.ldflags.1516959028" superClass="xilinx.gnu.c.link.option.ldflags" value="" valueType="string"/> <option id="xilinx.gnu.c.link.option.ldflags.1516959028" name="Linker Flags" superClass="xilinx.gnu.c.link.option.ldflags" value="" valueType="string"/>
</tool> </tool>
<tool id="xilinx.gnu.mb.size.debug.778946449" name="MicroBlaze Print Size" superClass="xilinx.gnu.mb.size.debug"/> <tool id="xilinx.gnu.mb.size.debug.778946449" name="MicroBlaze Print Size" superClass="xilinx.gnu.mb.size.debug"/>
<tool id="xilinx.elfcheck.mb.debug.225695907" name="Xilinx ELF Check" superClass="xilinx.elfcheck.mb.debug"> <tool id="xilinx.elfcheck.mb.debug.225695907" name="Xilinx ELF Check" superClass="xilinx.elfcheck.mb.debug">
@ -1066,7 +1066,7 @@
<listOptionValue builtIn="false" value="../../RTOSDemoBSP/microblaze_0/lib"/> <listOptionValue builtIn="false" value="../../RTOSDemoBSP/microblaze_0/lib"/>
</option> </option>
<option id="xilinx.gnu.c.linker.option.lscript.480905448" name="Linker Script" superClass="xilinx.gnu.c.linker.option.lscript" value="../src/lscript.ld" valueType="string"/> <option id="xilinx.gnu.c.linker.option.lscript.480905448" name="Linker Script" superClass="xilinx.gnu.c.linker.option.lscript" value="../src/lscript.ld" valueType="string"/>
<option id="xilinx.gnu.c.link.option.ldflags.548655668" superClass="xilinx.gnu.c.link.option.ldflags" value="" valueType="string"/> <option id="xilinx.gnu.c.link.option.ldflags.548655668" name="Linker Flags" superClass="xilinx.gnu.c.link.option.ldflags" value="" valueType="string"/>
</tool> </tool>
<tool id="xilinx.gnu.mb.size.debug.536351174" name="MicroBlaze Print Size" superClass="xilinx.gnu.mb.size.debug"/> <tool id="xilinx.gnu.mb.size.debug.536351174" name="MicroBlaze Print Size" superClass="xilinx.gnu.mb.size.debug"/>
<tool id="xilinx.elfcheck.mb.debug.1281142255" name="Xilinx ELF Check" superClass="xilinx.elfcheck.mb.debug"> <tool id="xilinx.elfcheck.mb.debug.1281142255" name="Xilinx ELF Check" superClass="xilinx.elfcheck.mb.debug">

@ -63,8 +63,6 @@
#ifndef FREERTOS_CONFIG_H #ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H #define FREERTOS_CONFIG_H
#include <xparameters.h>
/*----------------------------------------------------------- /*-----------------------------------------------------------
* Application specific definitions. * Application specific definitions.
* *

@ -64,12 +64,10 @@
#include <string.h> #include <string.h>
/* Hardware includes. */ /* Hardware includes. */
#include <xparameters.h>
#include <xintc.h>
#include <xintc_i.h> #include <xintc_i.h>
#include <xtmrctr.h>
#include <xil_exception.h> #include <xil_exception.h>
#include <mb_interface.h> #include <microblaze_exceptions_i.h>
#include <microblaze_exceptions_g.h>
/* Tasks are started with a critical section nesting of 0 - however prior /* Tasks are started with a critical section nesting of 0 - however prior
to the scheduler being commenced we don't want the critical nesting level to the scheduler being commenced we don't want the critical nesting level
@ -87,6 +85,8 @@ to reach zero, so it is initialised to a high value. */
*/ */
static portBASE_TYPE prvInitialiseInterruptController( void ); static portBASE_TYPE prvInitialiseInterruptController( void );
static void prvExceptionHandler( void *pvExceptionID );
/* /*
* Call an application provided callback to set up the periodic interrupt used * Call an application provided callback to set up the periodic interrupt used
* for the RTOS tick. Using an application callback allows the application * for the RTOS tick. Using an application callback allows the application
@ -344,6 +344,20 @@ extern void vApplicationClearTimerInterrupt( void );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvExceptionHandler( void *pvExceptionID )
{
volatile unsigned long ulExceptionID;
ulExceptionID = ( unsigned long ) pvExceptionID;
for( ;; )
{
portNOP();
}
( void ) ulExceptionID;
}
/*-----------------------------------------------------------*/
static portBASE_TYPE prvInitialiseInterruptController( void ) static portBASE_TYPE prvInitialiseInterruptController( void )
{ {
portBASE_TYPE xStatus; portBASE_TYPE xStatus;
@ -358,6 +372,47 @@ portBASE_TYPE xStatus;
/* Service all pending interrupts each time the handler is entered. */ /* Service all pending interrupts each time the handler is entered. */
XIntc_SetIntrSvcOption( xInterruptControllerInstance.BaseAddress, XIN_SVC_ALL_ISRS_OPTION ); XIntc_SetIntrSvcOption( xInterruptControllerInstance.BaseAddress, XIN_SVC_ALL_ISRS_OPTION );
/* Install exception handlers. */
#if MICROBLAZE_EXCEPTIONS_ENABLED == 1
#if XPAR_MICROBLAZE_0_UNALIGNED_EXCEPTIONS == 1
microblaze_register_exception_handler( XEXC_ID_UNALIGNED_ACCESS, prvExceptionHandler, ( void * ) XEXC_ID_UNALIGNED_ACCESS );
#endif /* XPAR_MICROBLAZE_0_UNALIGNED_EXCEPTIONS*/
#if XPAR_MICROBLAZE_0_ILL_OPCODE_EXCEPTION == 1
microblaze_register_exception_handler( XEXC_ID_ILLEGAL_OPCODE, prvExceptionHandler, ( void * ) XEXC_ID_ILLEGAL_OPCODE );
#endif /* XPAR_MICROBLAZE_0_ILL_OPCODE_EXCEPTION*/
#if XPAR_MICROBLAZE_0_M_AXI_I_BUS_EXCEPTION == 1
microblaze_register_exception_handler( XEXC_ID_M_AXI_I_EXCEPTION, prvExceptionHandler, ( void * ) XEXC_ID_M_AXI_I_EXCEPTION );
#endif /* XPAR_MICROBLAZE_0_M_AXI_I_BUS_EXCEPTION*/
#if XPAR_MICROBLAZE_0_M_AXI_D_BUS_EXCEPTION == 1
microblaze_register_exception_handler( XEXC_ID_M_AXI_D_EXCEPTION, prvExceptionHandler, ( void * ) XEXC_ID_M_AXI_D_EXCEPTION );
#endif /* XPAR_MICROBLAZE_0_M_AXI_D_BUS_EXCEPTION*/
#if XPAR_MICROBLAZE_0_IPLB_BUS_EXCEPTION == 1
microblaze_register_exception_handler( XEXC_ID_IPLB_EXCEPTION, prvExceptionHandler, ( void * ) XEXC_ID_IPLB_EXCEPTION );
#endif /* XPAR_MICROBLAZE_0_IPLB_BUS_EXCEPTION*/
#if XPAR_MICROBLAZE_0_DPLB_BUS_EXCEPTION == 1
microblaze_register_exception_handler( XEXC_ID_DPLB_EXCEPTION, prvExceptionHandler, ( void * ) XEXC_ID_DPLB_EXCEPTION );
#endif /* XPAR_MICROBLAZE_0_DPLB_BUS_EXCEPTION*/
#if XPAR_MICROBLAZE_0_DIV_ZERO_EXCEPTION == 1
microblaze_register_exception_handler( XEXC_ID_DIV_BY_ZERO, prvExceptionHandler, ( void * ) XEXC_ID_DIV_BY_ZERO );
#endif /* XPAR_MICROBLAZE_0_DIV_ZERO_EXCEPTION*/
#if XPAR_MICROBLAZE_0_FPU_EXCEPTION == 1
microblaze_register_exception_handler( XEXC_ID_FPU, prvExceptionHandler, ( void * ) XEXC_ID_FPU );
#endif /* XPAR_MICROBLAZE_0_FPU_EXCEPTION*/
#if XPAR_MICROBLAZE_0_FSL_EXCEPTION == 1
microblaze_register_exception_handler( XEXC_ID_FSL, prvExceptionHandler, ( void * ) XEXC_ID_FSL );
#endif /* XPAR_MICROBLAZE_0_FSL_EXCEPTION*/
#endif /* MICROBLAZE_EXCEPTIONS_ENABLED */
/* Start the interrupt controller. Interrupts are enabled when the /* Start the interrupt controller. Interrupts are enabled when the
scheduler starts. */ scheduler starts. */
xStatus = XIntc_Start( &xInterruptControllerInstance, XIN_REAL_MODE ); xStatus = XIntc_Start( &xInterruptControllerInstance, XIN_REAL_MODE );
@ -369,9 +424,15 @@ portBASE_TYPE xStatus;
configASSERT( ( xStatus == ( portBASE_TYPE ) XST_SUCCESS ) ) configASSERT( ( xStatus == ( portBASE_TYPE ) XST_SUCCESS ) )
/*_RB_ Exception test code.
__asm volatile (
"bralid r15, 1234 \n"
"or r0, r0, r0 \n"
);
*/
return xStatus; return xStatus;
} }
/*-----------------------------------------------------------*/

@ -59,7 +59,8 @@ extern "C" {
#endif #endif
/* BSP includes. */ /* BSP includes. */
#include "xbasic_types.h" #include <mb_interface.h>
#include <xparameters.h>
/*----------------------------------------------------------- /*-----------------------------------------------------------
* Port specific definitions. * Port specific definitions.

@ -533,16 +533,16 @@ static void prvSetupHardware( void )
taskDISABLE_INTERRUPTS(); taskDISABLE_INTERRUPTS();
vParTestInitialise(); vParTestInitialise();
#ifdef MICROBLAZE_EXCEPTIONS_ENABLED #if MICROBLAZE_EXCEPTIONS_ENABLED == 1
microblaze_enable_exceptions(); microblaze_enable_exceptions();
#endif #endif
#ifdef XPAR_MICROBLAZE_USE_ICACHE #if XPAR_MICROBLAZE_USE_ICACHE == 1
microblaze_invalidate_icache(); microblaze_invalidate_icache();
microblaze_enable_icache(); microblaze_enable_icache();
#endif #endif
#ifdef XPAR_MICROBLAZE_USE_DCACHE #if XPAR_MICROBLAZE_USE_DCACHE == 1
microblaze_invalidate_dcache(); microblaze_invalidate_dcache();
microblaze_enable_dcache(); microblaze_enable_dcache();
#endif #endif

Loading…
Cancel
Save