X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=FreeRTOS%2FSource%2Fportable%2FGCC%2FMicroBlazeV8%2Fport_exceptions.c;h=ccbe24895544a78073632302375dcc0d8169d7f3;hb=508cd75ea3983fdb04d7760ee0c8f9f8daf484e0;hp=b644caeb3338e9489c6a114a54f1ae78da847566;hpb=a97a430d525b824853f6528cb60d160468690963;p=freertos diff --git a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port_exceptions.c b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port_exceptions.c index b644caeb3..ccbe24895 100644 --- a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port_exceptions.c +++ b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port_exceptions.c @@ -1,75 +1,70 @@ /* - FreeRTOS V7.4.2 - Copyright (C) 2013 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! * - * * - *************************************************************************** + FreeRTOS V9.0.0rc1 - Copyright (C) 2016 Real Time Engineers Ltd. + All rights reserved + VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. 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. + 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. + *************************************************************************** + >>! 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 Real Time Engineers Ltd., contact details for whom are available - on the FreeRTOS WEB site. - - 1 tab == 4 spaces! + FOR A PARTICULAR PURPOSE. Full license text is available on the following + link: http://www.freertos.org/a00114.html *************************************************************************** * * - * Having a problem? Start by reading the FAQ "My application does * - * not run, what could be wrong?" * + * FreeRTOS provides completely free yet professionally developed, * + * robust, strictly quality controlled, supported, and cross * + * platform software that is more than just the market leader, it * + * is the industry's de facto standard. * * * - * http://www.FreeRTOS.org/FAQHelp.html * + * Help yourself get started quickly while simultaneously helping * + * to support the FreeRTOS project by purchasing a FreeRTOS * + * tutorial book, reference manual, or both: * + * http://www.FreeRTOS.org/Documentation * * * *************************************************************************** + http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading + the FAQ page "My application does not run, what could be wrong?". Have you + defined configASSERT()? + + http://www.FreeRTOS.org/support - In return for receiving this top quality + embedded software for free we request you assist our global community by + participating in the support forum. - http://www.FreeRTOS.org - Documentation, books, training, latest versions, - license and Real Time Engineers Ltd. contact details. + http://www.FreeRTOS.org/training - Investing in training allows your team to + be as productive as possible as early as possible. Now you can receive + FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers + Ltd, and the world's leading authority on the world's leading RTOS. 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 + including FreeRTOS+Trace - an indispensable productivity tool, a DOS + compatible FAT file system, and our tiny thread aware UDP/IP stack. + + http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate. + Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS. + + http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High + Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS + licenses offer ticketed support, indemnification and commercial 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! */ /* Scheduler includes. */ @@ -113,7 +108,7 @@ configINSTALL_EXCEPTION_HANDLERS is not set to 1. */ /* This variable is set in the exception entry code, before vPortExceptionHandler is called. */ -unsigned long *pulStackPointerOnFunctionEntry = NULL; +uint32_t *pulStackPointerOnFunctionEntry = NULL; /* This is the structure that is filled with the MicroBlaze context as it existed immediately prior to the exception occurrence. A pointer to this @@ -129,10 +124,10 @@ extern void vPortExceptionHandlerEntry( void *pvExceptionID ); /*-----------------------------------------------------------*/ -/* vApplicationExceptionRegisterDump() is a callback function that the +/* vApplicationExceptionRegisterDump() is a callback function that the application can optionally define to receive a populated xPortRegisterDump -structure. If the application chooses not to define a version of -vApplicationExceptionRegisterDump() then this weekly defined default +structure. If the application chooses not to define a version of +vApplicationExceptionRegisterDump() then this weekly defined default implementation will be called instead. */ extern void vApplicationExceptionRegisterDump( xPortRegisterDump *xRegisterDump ) __attribute__((weak)); void vApplicationExceptionRegisterDump( xPortRegisterDump *xRegisterDump ) @@ -152,11 +147,11 @@ extern void *pxCurrentTCB; /* Fill an xPortRegisterDump structure with the MicroBlaze context as it was immediately before the exception occurrence. */ - - /* First fill in the name and handle of the task that was in the Running + + /* First fill in the name and handle of the task that was in the Running state when the exception occurred. */ xRegisterDump.xCurrentTaskHandle = pxCurrentTCB; - xRegisterDump.pcCurrentTaskName = pcTaskGetTaskName( NULL ); + xRegisterDump.pcCurrentTaskName = pcTaskGetName( NULL ); configASSERT( pulStackPointerOnFunctionEntry ); @@ -176,7 +171,7 @@ extern void *pxCurrentTCB; xRegisterDump.ulR18 = pulStackPointerOnFunctionEntry[ portexR18_STACK_OFFSET ]; xRegisterDump.ulR19 = pulStackPointerOnFunctionEntry[ portexR19_STACK_OFFSET ]; xRegisterDump.ulMSR = pulStackPointerOnFunctionEntry[ portexMSR_STACK_OFFSET ]; - + /* Obtain the value of all other registers. */ xRegisterDump.ulR2_small_data_area = mfgpr( R2 ); xRegisterDump.ulR13_read_write_small_data_area = mfgpr( R13 ); @@ -195,17 +190,17 @@ extern void *pxCurrentTCB; xRegisterDump.ulR29 = mfgpr( R29 ); xRegisterDump.ulR30 = mfgpr( R30 ); xRegisterDump.ulR31 = mfgpr( R31 ); - xRegisterDump.ulR1_SP = ( ( unsigned long ) pulStackPointerOnFunctionEntry ) + portexASM_HANDLER_STACK_FRAME_SIZE; + xRegisterDump.ulR1_SP = ( ( uint32_t ) pulStackPointerOnFunctionEntry ) + portexASM_HANDLER_STACK_FRAME_SIZE; xRegisterDump.ulEAR = mfear(); xRegisterDump.ulESR = mfesr(); xRegisterDump.ulEDR = mfedr(); - + /* Move the saved program counter back to the instruction that was executed when the exception occurred. This is only valid for certain types of exception. */ xRegisterDump.ulPC = xRegisterDump.ulR17_return_address_from_exceptions - portexINSTRUCTION_SIZE; - #if XPAR_MICROBLAZE_0_USE_FPU == 1 + #if( XPAR_MICROBLAZE_USE_FPU != 0 ) { xRegisterDump.ulFSR = mffsr(); } @@ -218,49 +213,49 @@ extern void *pxCurrentTCB; /* Also fill in a string that describes what type of exception this is. The string uses the same ID names as defined in the MicroBlaze standard library exception header files. */ - switch( ( unsigned long ) pvExceptionID ) + switch( ( uint32_t ) pvExceptionID ) { case XEXC_ID_FSL : - xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_FSL"; + xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_FSL"; break; case XEXC_ID_UNALIGNED_ACCESS : - xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_UNALIGNED_ACCESS"; + xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_UNALIGNED_ACCESS"; break; case XEXC_ID_ILLEGAL_OPCODE : - xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_ILLEGAL_OPCODE"; + xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_ILLEGAL_OPCODE"; break; case XEXC_ID_M_AXI_I_EXCEPTION : - xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_M_AXI_I_EXCEPTION or XEXC_ID_IPLB_EXCEPTION"; + xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_M_AXI_I_EXCEPTION or XEXC_ID_IPLB_EXCEPTION"; break; case XEXC_ID_M_AXI_D_EXCEPTION : - xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_M_AXI_D_EXCEPTION or XEXC_ID_DPLB_EXCEPTION"; + xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_M_AXI_D_EXCEPTION or XEXC_ID_DPLB_EXCEPTION"; break; case XEXC_ID_DIV_BY_ZERO : - xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_DIV_BY_ZERO"; + xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_DIV_BY_ZERO"; break; case XEXC_ID_STACK_VIOLATION : - xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_STACK_VIOLATION or XEXC_ID_MMU"; + xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_STACK_VIOLATION or XEXC_ID_MMU"; break; - #if XPAR_MICROBLAZE_0_USE_FPU == 1 + #if( XPAR_MICROBLAZE_USE_FPU != 0 ) case XEXC_ID_FPU : - xRegisterDump.pcExceptionCause = ( signed char * const ) "XEXC_ID_FPU see ulFSR value"; + xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_FPU see ulFSR value"; break; - #endif /* XPAR_MICROBLAZE_0_USE_FPU */ + #endif /* XPAR_MICROBLAZE_USE_FPU */ } - /* vApplicationExceptionRegisterDump() is a callback function that the + /* vApplicationExceptionRegisterDump() is a callback function that the application can optionally define to receive the populated xPortRegisterDump - structure. If the application chooses not to define a version of - vApplicationExceptionRegisterDump() then the weekly defined default + structure. If the application chooses not to define a version of + vApplicationExceptionRegisterDump() then the weekly defined default implementation within this file will be called instead. */ vApplicationExceptionRegisterDump( &xRegisterDump ); @@ -274,52 +269,54 @@ extern void *pxCurrentTCB; void vPortExceptionsInstallHandlers( void ) { -static unsigned long ulHandlersAlreadyInstalled = pdFALSE; +static uint32_t ulHandlersAlreadyInstalled = pdFALSE; if( ulHandlersAlreadyInstalled == pdFALSE ) { ulHandlersAlreadyInstalled = pdTRUE; - #if XPAR_MICROBLAZE_0_UNALIGNED_EXCEPTIONS == 1 + #if XPAR_MICROBLAZE_UNALIGNED_EXCEPTIONS == 1 microblaze_register_exception_handler( XEXC_ID_UNALIGNED_ACCESS, vPortExceptionHandlerEntry, ( void * ) XEXC_ID_UNALIGNED_ACCESS ); - #endif /* XPAR_MICROBLAZE_0_UNALIGNED_EXCEPTIONS*/ + #endif /* XPAR_MICROBLAZE_UNALIGNED_EXCEPTIONS*/ - #if XPAR_MICROBLAZE_0_ILL_OPCODE_EXCEPTION == 1 + #if XPAR_MICROBLAZE_ILL_OPCODE_EXCEPTION == 1 microblaze_register_exception_handler( XEXC_ID_ILLEGAL_OPCODE, vPortExceptionHandlerEntry, ( void * ) XEXC_ID_ILLEGAL_OPCODE ); - #endif /* XPAR_MICROBLAZE_0_ILL_OPCODE_EXCEPTION*/ + #endif /* XPAR_MICROBLAZE_ILL_OPCODE_EXCEPTION */ - #if XPAR_MICROBLAZE_0_M_AXI_I_BUS_EXCEPTION == 1 + #if XPAR_MICROBLAZE_M_AXI_I_BUS_EXCEPTION == 1 microblaze_register_exception_handler( XEXC_ID_M_AXI_I_EXCEPTION, vPortExceptionHandlerEntry, ( void * ) XEXC_ID_M_AXI_I_EXCEPTION ); - #endif /* XPAR_MICROBLAZE_0_M_AXI_I_BUS_EXCEPTION*/ + #endif /* XPAR_MICROBLAZE_M_AXI_I_BUS_EXCEPTION */ - #if XPAR_MICROBLAZE_0_M_AXI_D_BUS_EXCEPTION == 1 + #if XPAR_MICROBLAZE_M_AXI_D_BUS_EXCEPTION == 1 microblaze_register_exception_handler( XEXC_ID_M_AXI_D_EXCEPTION, vPortExceptionHandlerEntry, ( void * ) XEXC_ID_M_AXI_D_EXCEPTION ); - #endif /* XPAR_MICROBLAZE_0_M_AXI_D_BUS_EXCEPTION*/ + #endif /* XPAR_MICROBLAZE_M_AXI_D_BUS_EXCEPTION */ - #if XPAR_MICROBLAZE_0_IPLB_BUS_EXCEPTION == 1 + #if XPAR_MICROBLAZE_IPLB_BUS_EXCEPTION == 1 microblaze_register_exception_handler( XEXC_ID_IPLB_EXCEPTION, vPortExceptionHandlerEntry, ( void * ) XEXC_ID_IPLB_EXCEPTION ); - #endif /* XPAR_MICROBLAZE_0_IPLB_BUS_EXCEPTION*/ + #endif /* XPAR_MICROBLAZE_IPLB_BUS_EXCEPTION */ - #if XPAR_MICROBLAZE_0_DPLB_BUS_EXCEPTION == 1 + #if XPAR_MICROBLAZE_DPLB_BUS_EXCEPTION == 1 microblaze_register_exception_handler( XEXC_ID_DPLB_EXCEPTION, vPortExceptionHandlerEntry, ( void * ) XEXC_ID_DPLB_EXCEPTION ); - #endif /* XPAR_MICROBLAZE_0_DPLB_BUS_EXCEPTION*/ + #endif /* XPAR_MICROBLAZE_DPLB_BUS_EXCEPTION */ - #if XPAR_MICROBLAZE_0_DIV_ZERO_EXCEPTION == 1 + #if XPAR_MICROBLAZE_DIV_ZERO_EXCEPTION == 1 microblaze_register_exception_handler( XEXC_ID_DIV_BY_ZERO, vPortExceptionHandlerEntry, ( void * ) XEXC_ID_DIV_BY_ZERO ); - #endif /* XPAR_MICROBLAZE_0_DIV_ZERO_EXCEPTION*/ + #endif /* XPAR_MICROBLAZE_DIV_ZERO_EXCEPTION */ - #if XPAR_MICROBLAZE_0_FPU_EXCEPTION == 1 + #if XPAR_MICROBLAZE_FPU_EXCEPTION == 1 microblaze_register_exception_handler( XEXC_ID_FPU, vPortExceptionHandlerEntry, ( void * ) XEXC_ID_FPU ); - #endif /* XPAR_MICROBLAZE_0_FPU_EXCEPTION*/ + #endif /* XPAR_MICROBLAZE_FPU_EXCEPTION */ - #if XPAR_MICROBLAZE_0_FSL_EXCEPTION == 1 + #if XPAR_MICROBLAZE_FSL_EXCEPTION == 1 microblaze_register_exception_handler( XEXC_ID_FSL, vPortExceptionHandlerEntry, ( void * ) XEXC_ID_FSL ); - #endif /* XPAR_MICROBLAZE_0_FSL_EXCEPTION*/ + #endif /* XPAR_MICROBLAZE_FSL_EXCEPTION */ + + microblaze_enable_exceptions(); } } /* Exclude the entire file if the MicroBlaze is not configured to handle -exceptions, or the application defined configuration item +exceptions, or the application defined configuration item configINSTALL_EXCEPTION_HANDLERS is not set to 1. */ #endif /* ( MICROBLAZE_EXCEPTIONS_ENABLED == 1 ) && ( configINSTALL_EXCEPTION_HANDLERS == 1 ) */