]> git.sur5r.net Git - freertos/commitdiff
New MicroBlaze port: Added a FreeRTOS exception handler, and installed it in each...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 24 Jun 2011 18:50:45 +0000 (18:50 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 24 Jun 2011 18:50:45 +0000 (18:50 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1470 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/.cproject
Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOSConfig.h
Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/port.c
Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/FreeRTOS_Source/portable/GCC/MicroBlaze/portmacro.h
Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/main-full.c

index 5aace26d577e81bc679b5ac8abd870f83199eac1..38a1989252ae91ff1b8218208c417c3cd7ef39eb 100644 (file)
@@ -74,7 +74,7 @@
                                                                        <listOptionValue builtIn="false" value="../../RTOSDemoBSP/microblaze_0/lib"/>\r
                                                                </option>\r
                                                                <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"/>\r
-                                                               <option id="xilinx.gnu.c.link.option.ldflags.1590675094" superClass="xilinx.gnu.c.link.option.ldflags" value="" valueType="string"/>\r
+                                                               <option id="xilinx.gnu.c.link.option.ldflags.1590675094" name="Linker Flags" superClass="xilinx.gnu.c.link.option.ldflags" value="" valueType="string"/>\r
                                                                <inputType id="xilinx.gnu.linker.input.384537517" superClass="xilinx.gnu.linker.input">\r
                                                                        <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>\r
                                                                        <additionalInput kind="additionalinput" paths="$(LIBS)"/>\r
@@ -93,7 +93,7 @@
                                                                        <listOptionValue builtIn="false" value="../../RTOSDemoBSP/microblaze_0/lib"/>\r
                                                                </option>\r
                                                                <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"/>\r
-                                                               <option id="xilinx.gnu.c.link.option.ldflags.1516959028" superClass="xilinx.gnu.c.link.option.ldflags" value="" valueType="string"/>\r
+                                                               <option id="xilinx.gnu.c.link.option.ldflags.1516959028" name="Linker Flags" superClass="xilinx.gnu.c.link.option.ldflags" value="" valueType="string"/>\r
                                                        </tool>\r
                                                        <tool id="xilinx.gnu.mb.size.debug.778946449" name="MicroBlaze Print Size" superClass="xilinx.gnu.mb.size.debug"/>\r
                                                        <tool id="xilinx.elfcheck.mb.debug.225695907" name="Xilinx ELF Check" superClass="xilinx.elfcheck.mb.debug">\r
                                                                        <listOptionValue builtIn="false" value="../../RTOSDemoBSP/microblaze_0/lib"/>\r
                                                                </option>\r
                                                                <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"/>\r
-                                                               <option id="xilinx.gnu.c.link.option.ldflags.548655668" superClass="xilinx.gnu.c.link.option.ldflags" value="" valueType="string"/>\r
+                                                               <option id="xilinx.gnu.c.link.option.ldflags.548655668" name="Linker Flags" superClass="xilinx.gnu.c.link.option.ldflags" value="" valueType="string"/>\r
                                                        </tool>\r
                                                        <tool id="xilinx.gnu.mb.size.debug.536351174" name="MicroBlaze Print Size" superClass="xilinx.gnu.mb.size.debug"/>\r
                                                        <tool id="xilinx.elfcheck.mb.debug.1281142255" name="Xilinx ELF Check" superClass="xilinx.elfcheck.mb.debug">\r
index 81e8b79de425b420c141e30aa3536d5f1ad88f38..a0bdbb438f7b1a0f0776e4f51950fd7662ded15a 100644 (file)
@@ -63,8 +63,6 @@
 #ifndef FREERTOS_CONFIG_H\r
 #define FREERTOS_CONFIG_H\r
 \r
-#include <xparameters.h>\r
-\r
 /*-----------------------------------------------------------\r
  * Application specific definitions.\r
  *\r
index b93bcc2fa69853df4c01fb3c8b1ee6c4d21f3e87..f5cdccf46d59c5a1c07a7a54d2f6eeade3f3edbb 100644 (file)
 #include <string.h>\r
 \r
 /* Hardware includes. */\r
-#include <xparameters.h>\r
-#include <xintc.h>\r
 #include <xintc_i.h>\r
-#include <xtmrctr.h>\r
 #include <xil_exception.h>\r
-#include <mb_interface.h>\r
+#include <microblaze_exceptions_i.h>\r
+#include <microblaze_exceptions_g.h>\r
 \r
 /* Tasks are started with a critical section nesting of 0 - however prior\r
 to the scheduler being commenced we don't want the critical nesting level\r
@@ -87,6 +85,8 @@ to reach zero, so it is initialised to a high value. */
  */\r
 static portBASE_TYPE prvInitialiseInterruptController( void );\r
 \r
+static void prvExceptionHandler( void *pvExceptionID );\r
+\r
 /*\r
  * Call an application provided callback to set up the periodic interrupt used\r
  * for the RTOS tick.  Using an application callback allows the application\r
@@ -344,6 +344,20 @@ extern void vApplicationClearTimerInterrupt( void );
 }\r
 /*-----------------------------------------------------------*/\r
 \r
+static void prvExceptionHandler( void *pvExceptionID )\r
+{\r
+volatile unsigned long ulExceptionID;\r
+\r
+       ulExceptionID = ( unsigned long ) pvExceptionID;\r
+       for( ;; )\r
+       {\r
+               portNOP();\r
+       }\r
+\r
+       ( void ) ulExceptionID;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
 static portBASE_TYPE prvInitialiseInterruptController( void )\r
 {\r
 portBASE_TYPE xStatus;\r
@@ -358,6 +372,47 @@ portBASE_TYPE xStatus;
            /* Service all pending interrupts each time the handler is entered. */\r
            XIntc_SetIntrSvcOption( xInterruptControllerInstance.BaseAddress, XIN_SVC_ALL_ISRS_OPTION );\r
 \r
+           /* Install exception handlers. */\r
+               #if MICROBLAZE_EXCEPTIONS_ENABLED == 1\r
+\r
+                       #if XPAR_MICROBLAZE_0_UNALIGNED_EXCEPTIONS == 1\r
+                       microblaze_register_exception_handler( XEXC_ID_UNALIGNED_ACCESS, prvExceptionHandler, ( void * ) XEXC_ID_UNALIGNED_ACCESS );\r
+                       #endif /* XPAR_MICROBLAZE_0_UNALIGNED_EXCEPTIONS*/\r
+\r
+                       #if XPAR_MICROBLAZE_0_ILL_OPCODE_EXCEPTION == 1\r
+                       microblaze_register_exception_handler( XEXC_ID_ILLEGAL_OPCODE, prvExceptionHandler, ( void * ) XEXC_ID_ILLEGAL_OPCODE );\r
+                       #endif /* XPAR_MICROBLAZE_0_ILL_OPCODE_EXCEPTION*/\r
+\r
+                       #if XPAR_MICROBLAZE_0_M_AXI_I_BUS_EXCEPTION == 1\r
+                       microblaze_register_exception_handler( XEXC_ID_M_AXI_I_EXCEPTION, prvExceptionHandler, ( void * ) XEXC_ID_M_AXI_I_EXCEPTION );\r
+                       #endif /* XPAR_MICROBLAZE_0_M_AXI_I_BUS_EXCEPTION*/\r
+\r
+                       #if XPAR_MICROBLAZE_0_M_AXI_D_BUS_EXCEPTION == 1\r
+                       microblaze_register_exception_handler( XEXC_ID_M_AXI_D_EXCEPTION, prvExceptionHandler, ( void * ) XEXC_ID_M_AXI_D_EXCEPTION );\r
+                       #endif /* XPAR_MICROBLAZE_0_M_AXI_D_BUS_EXCEPTION*/\r
+\r
+                       #if XPAR_MICROBLAZE_0_IPLB_BUS_EXCEPTION == 1\r
+                       microblaze_register_exception_handler( XEXC_ID_IPLB_EXCEPTION, prvExceptionHandler, ( void * ) XEXC_ID_IPLB_EXCEPTION );\r
+                       #endif /* XPAR_MICROBLAZE_0_IPLB_BUS_EXCEPTION*/\r
+\r
+                       #if XPAR_MICROBLAZE_0_DPLB_BUS_EXCEPTION == 1\r
+                       microblaze_register_exception_handler( XEXC_ID_DPLB_EXCEPTION, prvExceptionHandler, ( void * ) XEXC_ID_DPLB_EXCEPTION );\r
+                       #endif /* XPAR_MICROBLAZE_0_DPLB_BUS_EXCEPTION*/\r
+\r
+                       #if XPAR_MICROBLAZE_0_DIV_ZERO_EXCEPTION == 1\r
+                       microblaze_register_exception_handler( XEXC_ID_DIV_BY_ZERO, prvExceptionHandler, ( void * ) XEXC_ID_DIV_BY_ZERO );\r
+                       #endif /* XPAR_MICROBLAZE_0_DIV_ZERO_EXCEPTION*/\r
+\r
+                       #if XPAR_MICROBLAZE_0_FPU_EXCEPTION == 1\r
+                       microblaze_register_exception_handler( XEXC_ID_FPU, prvExceptionHandler, ( void * ) XEXC_ID_FPU );\r
+                       #endif /* XPAR_MICROBLAZE_0_FPU_EXCEPTION*/\r
+\r
+                       #if XPAR_MICROBLAZE_0_FSL_EXCEPTION == 1\r
+                       microblaze_register_exception_handler( XEXC_ID_FSL, prvExceptionHandler, ( void * ) XEXC_ID_FSL );\r
+                       #endif /* XPAR_MICROBLAZE_0_FSL_EXCEPTION*/\r
+\r
+               #endif /* MICROBLAZE_EXCEPTIONS_ENABLED */\r
+\r
                /* Start the interrupt controller.  Interrupts are enabled when the\r
                scheduler starts. */\r
                xStatus = XIntc_Start( &xInterruptControllerInstance, XIN_REAL_MODE );\r
@@ -369,9 +424,15 @@ portBASE_TYPE xStatus;
 \r
        configASSERT( ( xStatus == ( portBASE_TYPE ) XST_SUCCESS ) )\r
 \r
+/*_RB_ Exception test code.\r
+__asm volatile (\r
+                                       "bralid r15, 1234 \n"\r
+                                       "or r0, r0, r0 \n"\r
+                               );\r
+*/\r
+\r
        return xStatus;\r
 }\r
-\r
-\r
+/*-----------------------------------------------------------*/\r
 \r
 \r
index 40f05e4ea0115b0f49c30cbda333bd0ccd84d32c..cba69c7ce22b47e1e9ded907d05dee59dfec9444 100644 (file)
@@ -59,7 +59,8 @@ extern "C" {
 #endif\r
 \r
 /* BSP includes. */\r
-#include "xbasic_types.h"\r
+#include <mb_interface.h>\r
+#include <xparameters.h>\r
 \r
 /*-----------------------------------------------------------\r
  * Port specific definitions.  \r
index ed0792e809af6fdf4c9cdb317e25bc45150bfa86..301197736c8d3994fb3c5b600864725fb7a82e09 100644 (file)
@@ -533,16 +533,16 @@ static void prvSetupHardware( void )
        taskDISABLE_INTERRUPTS();\r
        vParTestInitialise();\r
 \r
-       #ifdef MICROBLAZE_EXCEPTIONS_ENABLED\r
+       #if MICROBLAZE_EXCEPTIONS_ENABLED == 1\r
                microblaze_enable_exceptions();\r
        #endif\r
 \r
-       #ifdef XPAR_MICROBLAZE_USE_ICACHE\r
+       #if XPAR_MICROBLAZE_USE_ICACHE == 1\r
                microblaze_invalidate_icache();\r
                microblaze_enable_icache();\r
        #endif\r
 \r
-       #ifdef XPAR_MICROBLAZE_USE_DCACHE\r
+       #if XPAR_MICROBLAZE_USE_DCACHE == 1\r
                microblaze_invalidate_dcache();\r
                microblaze_enable_dcache();\r
        #endif\r