This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS20216 MDK + FreeRTOS + HALCoGen

Other Parts Discussed in Thread: TMS570LS20216, HALCOGEN, UNIFLASH, TMS570LC4357

Hello TI

I use TMS570LS20216 MDK, CCSv6.1.1 and HalCoGen v04.05.01. I use FreeRTOS generated by the same HALCoGen version. Once the Code is flashed for the first time, the controller runs normally. When flashing is attempted second time, the controller throws error and doesnt permit to flash the code.

Please let me know the reason why this problem occurs and solution for the same.

Thanks in advance !

  • Hi,

    Address mentioned above in the console doesn't look right.

    This is mostly to do with your existing code running currently which is corrupting something before the flash programmer attempts Flashing second time.

    Can you pls try adding asm(" b $"); //Branch to itself code (once it stops here, manually push the Program counter to keep running)
    right after you get on to main() and check if the code post main or the initialization code is causing this issue.
  • Hi Karthik

    From your suggestion I understand that asm("b $"); line has to be added next to main() and then flash the program. But right now I'm unable to flash after adding this code in main(). I feel the above suggestion doesn't help me at this point.

    Can TI E2E technical support engineer give any other solution for this?

    Thanks in advance !
  • Here is the procedure to follow for erasing the flash, which gets to a state where flash programmer cannot do its job because of faulty code in the Micro controller.

    Once the reset is released the device starts executing the code(if its a faulty code) and is no more suitable for flash programmer to work.

    1. Hold the power on reset active low (So CPU doesn't start executing the code that already exists in flash)
    2. Start erase operation using the Flash programming tool (Say UNIFLASH - CCS may not work since the moment you hold reset active low, CCS will disc onnect)
    3. While your uniflash keeps waiting since the device is still in reset, try releasing the reset randomly after a couple of sec's

    This should help to get your part erased. But still if you are not able to erase, then try the same sequence(1,2,3) a few more times so that the Flash programmer gets hold of the CPU by halting it before CPU executes the code which will execute the faulty code.

    Best Regards,
  • Thanks Karthik ! This suggestion helps. I tried this.

    My biggest doubt is, is there a solution to overcome this problem (Memory lock while using FreeRTOS from HALCoGen) ? Same problem occurs for TMS570LC4357 as well.

  • Can you check the map file to see what region is getting mapped to address 0x00600000 and onward? This is an undefined region on TMS570LS20x.
  • Hello Sunil !

    I've attached the memory configuration above

  • Karthik I used asm(" b $");

    Until vTaskStartScheduler(); inside main() , there is no problem. Once I inserted asm(" b $");  inside vTaskStartScheduler( void ), and reach asm(" b $")

    ------------------------------os_tasks.c (HALCoGen generated)-------------------------

    void vTaskStartScheduler( void )

    {

    BaseType_t xReturn;

    /* Add the idle task at the lowest priority. */

    #if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )

    {

    /* Create the idle task, storing its handle in xIdleTaskHandle so it can

    be returned by the xTaskGetIdleTaskHandle() function. */

    xReturn = xTaskCreate( prvIdleTask, "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), &xIdleTaskHandle ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */

    }

    #else

    {

    asm(" b $");

     /* Create the idle task without storing its handle. */

    xReturn = xTaskCreate( prvIdleTask, "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), NULL );  /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */

    }

    #endif /* INCLUDE_xTaskGetIdleTaskHandle */

    #if ( configUSE_TIMERS == 1 )

    {

    if( xReturn == pdPASS )

    {

    xReturn = xTimerCreateTimerTask();

    }

    else

    {

    mtCOVERAGE_TEST_MARKER();

    }

    }

    #endif /* configUSE_TIMERS */

    if( xReturn == pdPASS )

    {

    /* Interrupts are turned off here, to ensure a tick does not occur

    before or during the call to xPortStartScheduler().  The stacks of

    the created tasks contain a status word with interrupts switched on

    so interrupts will automatically get re-enabled when the first task

    starts to run. */

    portDISABLE_INTERRUPTS();

    #if ( configUSE_NEWLIB_REENTRANT == 1 )

    {

    /* Switch Newlib's _impure_ptr variable to point to the _reent

    structure specific to the task that will run first. */

    _impure_ptr = &( pxCurrentTCB->xNewLib_reent );

    }

    #endif /* configUSE_NEWLIB_REENTRANT */

    xSchedulerRunning = pdTRUE;

    xTickCount = ( TickType_t ) 0U;

    /* If configGENERATE_RUN_TIME_STATS is defined then the following

    macro must be defined to configure the timer/counter used to generate

    the run time counter time base. */

    portCONFIGURE_TIMER_FOR_RUN_TIME_STATS();

    /* Setting up the timer tick is hardware specific and thus in the

    portable interface. */

    if( xPortStartScheduler() != pdFALSE )

    {

    /* Should not reach here as if the scheduler is running the

    function will not return. */

    }

    else

    {

    /* Should only reach here if a task calls xTaskEndScheduler(). */

    }

    }

    else

    {

    /* This line will only be reached if the kernel could not be started,

    because there was not enough FreeRTOS heap to create the idle task

    or the timer task. */

    configASSERT( xReturn );

    }

    }

    ---------------------------

    the control comes to next line
    xReturn = xTaskCreate( prvIdleTask, "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), NULL );        when I do step into instead of looping inside the same asm(" b $");

    Program enters dataEntry after stepping into vPortStartFirstTask(); inside os_port.c

    ----------------------------------------------------------------------------------

    BaseType_t xPortStartScheduler(void)
    {
        /* Start the timer that generates the tick ISR. */
        prvSetupTimerInterrupt();

        /* Reset the critical section nesting count read to execute the first task. */
        ulCriticalNesting = 0;

        /* Start the first task.  This is done from portASM.asm as ARM mode must be
        used. */
        vPortStartFirstTask();

        /* Should not get here! */
        return pdFAIL;
    }


    --------------------------------------------------------------------------------

    dataEntry
            b   dataEntry
            b   phantomInterrupt
            ldr pc,[pc,#-0x1b0]
            ldr pc,[pc,#-0x1b0]
    ----------------------------------------------------------------------------------

    This is my observation in the code.



  • Can TI Support provide solution for this issue ?
  • If you are getting a data abort then pls check the source of the same and debug accordingly. Your code is apparently trying to access an invalid memory location.