FreeRTOS TC397

Hi,
I am trying to run freeRTOS based led blinking on aurix TC397. There are two tasks when scheduled either one of the two tasks then it is working but when both the tasks are scheduled then the scheduler is coming out and no tasking is running. Can someone suggest how to fix this.

config file:

#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H

#define configUSE_PREEMPTION                       1
#define configUSE_IDLE_HOOK                        1

#define configCPU_CLOCK_HZ                         ( ( unsigned long ) 300000000UL )
#define configTICK_RATE_HZ                         ( ( TickType_t ) 1000UL )

#define configMAX_PRIORITIES                       ( 10 )
//#define configMINIMAL_STACK_SIZE                   ( ( unsigned short ) 256 )
#define configMINIMAL_STACK_SIZE                   ( ( unsigned short ) 256 )
#define configTOTAL_HEAP_SIZE                      ( ( size_t ) ( 32U * 1024U ) )

#define configMAX_TASK_NAME_LEN                    ( 16 )

#define configENABLE_BACKWARD_COMPATIBILITY        0
#define configUSE_TRACE_FACILITY                   0
#define configUSE_16_BIT_TICKS                     0
#define configIDLE_SHOULD_YIELD                    0
#define configUSE_MALLOC_FAILED_HOOK               0
#define configCHECK_FOR_STACK_OVERFLOW             1
#define configUSE_TICK_HOOK                        0
#define configUSE_COUNTING_SEMAPHORES              1
#define configUSE_RECURSIVE_MUTEXES                1
#define configUSE_MUTEXES                          1
#define configRECORD_STACK_HIGH_ADDRESS            1

#define configNUM_THREAD_LOCAL_STORAGE_POINTERS    5
#define configCHECK_FOR_STACK_OVERFLOW              2
#define configMax_SYSCALL_INTERRUP_PRIORITY         5 // This is added to fix the two tasks issue remove if not working
/* Software timer configuration. */
//#define configUSE_TIMERS                           ( 1 )
#define configUSE_TIMERS                           ( 1 )
#define configTIMER_TASK_PRIORITY                  ( 9 )
#define configTIMER_QUEUE_LENGTH                   ( 5 )
#define configTIMER_TASK_STACK_DEPTH               configMINIMAL_STACK_SIZE

/* 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

/* Interrupt above priority 31 are not effected by critical sections, but cannot call interrupt safe FreeRTOS functions. */
#define configMAX_API_CALL_INTERRUPT_PRIORITY      31

/* Default definition of configASSERT(). */
#ifdef DEBUG
#ifdef __TASKING__
#define configASSERT( x )    if( ( x ) == 0 ) { __disable(); __debug(); }
#endif
#ifdef __clang__
#define configASSERT( x )    if( ( x ) == 0 ) { __builtin_tricore_disable(); __builtin_tricore_debug(); }
#endif
#else
#define configASSERT( x ) ((void)(x)) /* Empty macro to remove compiler warning(s) about unused variables */
#endif

/* AURIX TCxxx definitions */
#define configCONTEXT_INTERRUPT_PRIORITY    1 
#define configTIMER_INTERRUPT_PRIORITY      2 /* This value must not be bigger then context priority */
#define configCPU_NR                        0
#define configPROVIDE_SYSCALL_TRAP          0
#define configSYSCALL_CALL_DEPTH            2
#define configSTM                           ( ( uint32_t * ) (0xF0001000 + configCPU_NR*0x100 ) )
#define configSTM_SRC                       ( ( uint32_t * ) (0xF0038300 + configCPU_NR*0x8) )
#define configSTM_CLOCK_HZ                  ( 100000000 )
#define configSTM_DEBUG                     ( 1 )
#define configCONTEXT_SRC                   ( ( uint32_t * ) 0xF0038990 )

#endif /* FREERTOS_CONFIG_H */

main.c

/**********************************************************************************************************************
 * \file Cpu0_Main.c
 * \copyright Copyright (C) Infineon Technologies AG 2019
 * 
 * Use of this file is subject to the terms of use agreed between (i) you or the company in which ordinary course of 
 * business you are acting and (ii) Infineon Technologies AG or its licensees. If and as long as no such terms of use
 * are agreed, use of this file is subject to following:
 * 
 * Boost Software License - Version 1.0 - August 17th, 2003
 * 
 * Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and 
 * accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute,
 * and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the
 * Software is furnished to do so, all subject to the following:
 * 
 * The copyright notices in the Software and this entire statement, including the above license grant, this restriction
 * and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all 
 * derivative works of the Software, unless such copies or derivative works are solely in the form of 
 * machine-executable object code generated by a source language processor.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE 
 * COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN 
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 
 * IN THE SOFTWARE.
 *********************************************************************************************************************/
 /*\title iLLD_TC397_TRIBOARD_ADS_PMIC_SLEEP_MODE
 * \abstract This code example send a request to put the Power Management IC (PMIC) TLF35584 in Sleep mode or Normal mode.
 * \description This code example uses the Queued Synchronous Peripheral Interface (QSPI) and the Asynchronous/Synchronous Interface (ASCLIN) module to communicate with the on board PMIC and put the board in sleep mode. The CPU communicates with the PMIC via QSPI, an ASCLIN interrupt triggers the PMIC state transition to sleep or normal mode.
 * \name iLLD_TC397_TRIBOARD_ADS_PMIC_SLEEP_MODE
 * \version V1.0.0
 * \board TRIBOARD KIT TC3X7, KIT_A2G_TC397_5V_TRB_S, TC39xXX_B-Step
 * \keywords PMIC, QSPI, ASCLIN, SLEEP, LOW POWER
 * \documents README.MD
 * \lastUpdated 2024-05-18
/*********************************************************************************************************************/
/*-----------------------------------------------------Includes------------------------------------------------------*/
/*********************************************************************************************************************/
#include "Ifx_Types.h"
#include "IfxCpu.h"
#include "IfxScuWdt.h"
#include <serialio.h>
#include <TLF35584.h>
#include <Sleep_Conf.h>
#include <SPI_Init.h>
#include "Blinky_LED.h"
#include "FreeRTOS.h"
#include "task.h"

#define LED1_BLINKY_PERIOD_MS (250)
#define LED2_BLINKY_PERIOD_MS (250)
/*********************************************************************************************************************/
/*-------------------------------------------------Global variables--------------------------------------------------*/
/*********************************************************************************************************************/
IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0;
tlf35584 g_tlfDevice;
int g_mode;
int g_powerMode;
//SemaphoreHandle_t xLedMutex;
/*********************************************************************************************************************/
/*----------------------------------------------Function Implementations---------------------------------------------*/
/*********************************************************************************************************************/
void task_app_led1(void *arg)
{

initLED1();
    while (1)
    {

        /* Toggle LED1 state */
blinkLED();

        vTaskDelay(pdMS_TO_TICKS(LED2_BLINKY_PERIOD_MS));
//        }
    }
}


void task_app_led2(void *arg)
{
    initLED2();

    while (1)
    {
//               {
               /* Toggle LED1 state */
       blinkLED2();

        /* Delay 250ms */
        vTaskDelay(pdMS_TO_TICKS(LED1_BLINKY_PERIOD_MS));
    }
}
void core0_main(void)
{
    IfxCpu_enableInterrupts();
    
    /* !!WATCHDOG0 AND SAFETY WATCHDOG ARE DISABLED HERE!!
     * Enable the watchdogs and service them periodically if it is required
     */
    IfxScuWdt_disableCpuWatchdog(IfxScuWdt_getCpuWatchdogPassword());
    IfxScuWdt_disableSafetyWatchdog(IfxScuWdt_getSafetyWatchdogPassword());
    
    /* Wait for CPU sync event */
    IfxCpu_emitEvent(&g_cpuSyncEvent);
    IfxCpu_waitEvent(&g_cpuSyncEvent, 1);
    

    /* Create LED1 app task */
    volatile BaseType_t retval1=  xTaskCreate(task_app_led1, "APP LED2", configMINIMAL_STACK_SIZE, NULL, 0, NULL);
    volatile BaseType_t retval2=  xTaskCreate(task_app_led2, "APP LED1", configMINIMAL_STACK_SIZE, NULL, 0, NULL);
    vTaskStartScheduler();
    while(1)
    {
        /* main function */
//        blinkLED(); /* Make the LED blink           */
        //coreConf();
    }
}

void vApplicationStackOverflowHook(TaskHandle_t xTask, char *pcTaskName)
{
    while (1)
    {
        printf("Stack overflow in task: %s\n", pcTaskName);
//        __nop();
    }
}

Do you mean the function vTaskStartScheduler returns and no task starts? If yes, try increasing the the value of configTOTAL_HEAP_SIZE. You can also enable configUSE_MALLOC_FAILED_HOOK to catch malloc failures.