FreeRTOS gets stuck at prvTaskExitError()

Hello all, I’m new to FreeRTOS. Im currently working with ST32F072RB Discovery board. I integrated the FreeRTOS with my test code. Im not using CubeMx, HAL library or Std Peripheral Lib. When running the code, it gets stuck at prvTaskExitError(). Here is my code ~~~ int main() { //Set priority of SYSTick NVICEnableIRQ(SysTickIRQn); NVICSetPriority(SysTickIRQn, 3); /* Clock checkin code **********************************************************************/ //Clock checking coreClock1 = SystemCoreClock; /* Store value of predefined SystemCoreClock */ SystemCoreClockUpdate(); /* Update SystemCoreClock according to register settings */ coreClock2 = SystemCoreClock; /* Store value of calculated SystemCoreClock / if (coreClock_2 != coreClock_1) {
/
Without changing the clock setting both core clock values should be the same / // Error Handling } //returnCode = SysTick_Config(SystemCoreClock / 1000); / Configure SysTick to generate an interrupt every millisecond */ /********************************************************************************************/
/* Initialization ***************************************************************************/
GPIO_Init();
UART1_Init();
UART_HandleInit(&huart);
ADC1_Init();

/* Debug purpose  */
if(DEBUG == 1)
{
    printf("UART1 test string rn");
    printf("This is sample ADC code rn");
    printf("ADC1 used            USART1 used        rn");

}
printf("INITILIZATION DONE rn");

RTOS();
while(1)
{

}
} void RTOS() { xTaskCreate(vTaskFunction1, “Task 1”, 128, NULL, 2, NULL);
vTaskStartScheduler();

while(1)
{
}
} /* Implementation of vTaskFunction—————————————-*/ void vTaskFunction1( void *pvParameters) { //Start the ADC conversion ADC1_Start();
    printf("ADC Value: %d rn",ADC_Value);
    //Get the conversion value
    onTime = ADC_Value;

    //PWM code
    offTime = 4096 - onTime;
    GPIOC->BSRR |= 0x0040;      //Set Red LED

    for(i = 0; i < onTime; i++)
    {
    __ASM("nop");
    }
    GPIOC->BRR |= 0x0040;      //Reset Red LED
    for(i = 0; i < offTime; i++)
    {
    __ASM("nop");
    }
} ~~~ Here is my FreeRTOSConfig.h ~~~ /* Ensure stdint is only used by the compiler, and not the assembler. */

ifdef __CC_ARM

#include <stdint.h>
extern uint32_t SystemCoreClock;

endif

define configUSE_PREEMPTION 1

define configUSEIDLEHOOK 0

define configUSETICKHOOK 0

define configCPUCLOCKHZ ( SystemCoreClock )

define configTICKRATEHZ ( ( TickType_t ) 1000 )

define configMAX_PRIORITIES ( 5 )

define configMINIMALSTACKSIZE ( ( unsigned short ) 60 )

define configTOTALHEAPSIZE ( ( size_t ) ( 6500 ) )

define configMAXTASKNAME_LEN ( 5 )

define configUSETRACEFACILITY 1

define configUSE16BIT_TICKS 0

define configIDLESHOULDYIELD 1

define configUSE_MUTEXES 1

define configQUEUEREGISTRYSIZE 8

//#define configCHECKFORSTACK_OVERFLOW 2

define configUSERECURSIVEMUTEXES 1

//#define configUSEMALLOCFAILED_HOOK 1

define configUSEAPPLICATIONTASK_TAG 0

define configUSECOUNTINGSEMAPHORES 1

define configGENERATERUNTIME_STATS 0

/* Co-routine definitions. */

define configUSECOROUTINES 0

define configMAXCOROUTINE_PRIORITIES ( 2 )

/* Software timer definitions. */ //#define configUSE_TIMERS 1 //#define configTIMER_TASK_PRIORITY ( 2 ) //#define configTIMER_QUEUE_LENGTH 5 //#define configTIMER_TASK_STACK_DEPTH ( 80 ) /* Set the following definitions to 1 to include the API function, or zero to exclude the API function. */

define INCLUDE_vTaskPrioritySet 1

define INCLUDE_uxTaskPriorityGet 1

define INCLUDE_vTaskDelete 1

define INCLUDE_vTaskCleanUpResources 1

define INCLUDE_vTaskSuspend 1

define INCLUDE_vTaskDelayUntil 1

define INCLUDE_vTaskDelay 1

/* Normal assert() semantics without relying on the provision of an assert.h header file. */

define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }

/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS standard names – or at least those used in the unmodified vector table. */

define vPortSVCHandler SVC_Handler

define xPortPendSVHandler PendSV_Handler

define xPortSysTickHandler SysTick_Handler

~~~ The code gets stuck here, in port.c (indicated by >>) ~~~ static void prvTaskExitError( void ) { /* A function that implements a task must not exit or attempt to return to its caller as there is nothing to return to. If a task wants to exit it should instead call vTaskDelete( NULL ).
Artificially force an assert() to be triggered if configASSERT() is
defined, then stop here so application writers can catch the error. */
>>configASSERT( uxCriticalNesting == ~0UL );
portDISABLE_INTERRUPTS();
for( ;; );
} ~~~ Im also using ADC1 and USART1 Interrupts. Both have priority 0. On Serial port im getting the output
UART1 test string This is sample ADC code ADC1 used USART1 used INITILIZATION DONE ADC Value: 0
The task is not running repeatedly.

FreeRTOS gets stuck at prvTaskExitError()

Unfortunately there is a lot wrong with this code. The first place to start would probably be the following link, so you can see how to structure a task:
http://www.freertos.org/implementing-a-FreeRTOS-task.html After that the following links might help:
http://www.freertos.org/FreeRTOS-quick-start-guide.html http://www.freertos.org/Creating-a-new-FreeRTOS-project.html