Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

MikroC Compiler Interrupt issue vPortValidateInterruptPriority STM32F407

Posted by pcat271264 on June 13, 2017

Hi, my first few days with freeRTOS I have been using the MikroC latest release ARM compiler and all was well,,, until I created tasks to handle UART interrupt.

My code based on examples:-

// Serial interrupt void UARTRx() iv IVTINTUSART1 ics ICSAUTO { BaseType_t xHigherPriorityTaskWoken = pdFALSE;

 xSemaphoreGiveFromISR( xBinarySemaphore, &xHigherPriorityTaskWoken );
 portYIELD_FROM_ISR( xHigherPriorityTaskWoken );

} // and sends reads byte and send to display task void UARTRXTask( void *pvParameters ) { while (1) { if (xSemaphoreTake(xBinarySemaphore, portMAXDELAY) == pdPASS) { msgBuffer.msgData[0] = UART1Read(); // read the received data; msgBuffer.msgType = MSG_UARTA;

     //UART1_Write(rxmsgBuffer.msgData[0]);    // Used for testing interrupt
     xQueueSend(displayQueueHandle, &msgBuffer, 0xFFFFFFFFU); // Post Byte to Display task
  }
}

}

I get the following error after compile :- 0 360 Unresolved extern 'vPortValidateInterruptPriority' queue.c

I have searched and this snippet of port.c file (please ignore the quote before the hash) :-

'#if (configASSERTDEFINED == 1) // Limitations in the MikroC inline asm means ulCurrentInterrupt has to be // global - which makes vPortValidateInterruptPriority() non re-entrant. // However that should not matter as an interrupt can only itself be // interrupted by a higher priority interrupt. That means if // ulCurrentInterrupt, so ulCurrentInterrupt getting corrupted cannot lead // to an invalid interrupt priority being missed. void vPortValidateInterruptPriority( void ) { uint32t ulCurrentInterrupt; uint8_t ucCurrentPriority;

config_ASSERT is defined in freeRTOS.h, is this a possible bug or do I need to change interrupt priorities ? as I have read in some of the docs.

Any assistance would be great.

Thanks

Paul


MikroC Compiler Interrupt issue vPortValidateInterruptPriority STM32F407

Posted by rtel on June 15, 2017

I'm not sure how you can get to a point where that error occurs. Are you using the FreeRTOS port from the FreeRTOS download? The defnition of configASSERT() in FreeRTOS.h is the default value - which will only be used if configASSERT() is not defined in FreeRTOSConfig.h. http://www.freertos.org/a00110.html#configASSERT

Do you have configASSERT() defined in FreeRTOSConifg.h? If so then configASSERTDEFINED should be 1 and the function will be available. If configASSERT() is not defined then configASSERTDEFINED will be 0 and the function should never be called.


MikroC Compiler Interrupt issue vPortValidateInterruptPriority STM32F407

Posted by pcat271264 on June 15, 2017

Hi thanks for the reply, Im using the port supplied with the MikroC demo prog and below is a copy and paste from the end of my freeRTOSConfig.h file.

// This is the raw value as per the Cortex-M3 NVIC. // Values can be 255 (lowest) to 0 (1?) (highest). '#define configKERNELINTERRUPTPRIORITY 255 // !!!! configMAXSYSCALLINTERRUPTPRIORITY must not be set to zero !!!! // See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. // Equivalent to 0xb0, or priority 11. '#define configMAXSYSCALLINTERRUPTPRIORITY 191

// Normal assert() mechanics without relying on assert.h header file. '#define configASSERT(x) if ((x) == 0) { taskDISABLE_INTERRUPTS(); while (1); }

'#endif // FREERTOSCONFIGH


MikroC Compiler Interrupt issue vPortValidateInterruptPriority STM32F407

Posted by rtel on June 15, 2017

So you have configASSERT() defined. That means configASSERT_DEFINED should also be 1, which comes from the following lines in FreeRTOSConfig.h:

#ifndef configASSERT
     #define configASSERT( x )
     #define configASSERT_DEFINED 0
#else
     #define configASSERT_DEFINED 1
#endif

Which then follows that vPortValidateInterruptPriority() should also be available to you, which can be seen from your original post.

This would get messed up if the include files were in the wrong order, but as this is presumably coming from queue.c, which is a file we provide, the include files should be in the correct order. For reference you need to #include FreeRTOS.h, then #include the header files that contains the API function you want to use (tasks.h, queue.h, etc.). Never include FreeRTOSConfig.h or portmacro.h directly.


MikroC Compiler Interrupt issue vPortValidateInterruptPriority STM32F407

Posted by pcat271264 on June 16, 2017

Hi ,the freeRTOS.h file supplied with their demo had the whole definition of the configASSERT commented out. // Since putting it back in there are different errors as it now configASSERT_DEFINED == 1 :-

0 1004 interrupt handler (vPortSVCHandler at 0x000B) port.c 296 324 Undeclared identifier 'portNVICIPREGISTERSOFFSET16' in expression port.c 296 324 Undeclared identifier 'portFIRSTUSERINTERRUPTNUMBER' in expression port.c 0 1004 interrupt handler (xPortPendSVHandler at 0x000E) port.c 479 348 Assembler instruction 'BL' was not found. port.c 0 1004 interrupt handler (xPortSysTickHandler at 0x000F) port.c 725 317 Operator '' is not applicable to these operands '' port.c 783 324 Undeclared identifier 'portFIRSTUSERINTERRUPTNUMBER' in expression port.c 787 324 Undeclared identifier 'portNVICIPREGISTERSOFFSET16' in expression port.c 828 324 Undeclared identifier 'portAIRCR_REG' in expression port.c

I checked in the port.c of their example and the defines do not exist but they are in the example from you web FreeRTOSv9.0.0FreeRTOSSourceportableMikroCARM_CM4Fport.c the files are very different though, I copied the defines across and the above errors but then other errors.


MikroC Compiler Interrupt issue vPortValidateInterruptPriority STM32F407

Posted by pcat271264 on June 21, 2017

Just for your information MikroE have updated the Port on their Libstock page and it now compiles.

Thank you for your assistance


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS