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.

Problems running functions from RAM

Other Parts Discussed in Thread: HALCOGEN

Hi @ all,

I am using the TMS570LC43 HDK together with CCS  Version: 6.0.1.00040 and HALCoGen 04.01.00.


To get familar with the concept of different load and run addresses I implemented an small sample project that uses copy tables in conjunction

with the copy_in RTS-function in preparation for an XCPoE-based flash tool (automotive). Up to the point where the program should do the execution from RAM

everything works fine: correct entries in map-file, RAM contains same code as ROM after using copy_in.

Then when calling the function by function name the program runs into prefetchentry. Following the call sequence in disassembly window, the trampoline is called and jumps to prefetchEntry.


Here the basic snippets of my test project:

########################################################################################
Linker cmd file:

.intvecs : {} > VECTORS
    .text   align(8) : {} > FLASH0 | FLASH1
    .const  align(8) : {} > FLASH0 | FLASH1
    .cinit  align(8) : {} > FLASH0 | FLASH1
    .pinit  align(8) : {} > FLASH0 | FLASH1
    .bss     : {} > RAM
    .data    : {} > RAM
    .sysmem  : {} > RAM
    

/* USER CODE BEGIN (6) */

    .test_sec :   {..\Debug\source\Test\Test.obj (.text)} load = FLASH0, run = RAM, table(_flash_ctbl)
    .ovly  > FLASH0

########################################################################################

excerpt from main.c

#include "hl_het.h"
#include "hl_reg_het.h"
#include "hl_gio.h"
#include "hl_reg_gio.h"
#include "HL_esm.h"

#include "Test.h"

#include "cpy_tbl.h"
/* USER CODE END */

/** @fn void main(void)
*   @brief Application main function
*   @note This function is empty by default.
*
*   This function is called after startup.
*   The user can use this function to implement the application.
*/

/* USER CODE BEGIN (2) */
extern COPY_TABLE _flash_ctbl;
/* USER CODE END */

void main(void)
{
/* USER CODE BEGIN (3) */
    uint32 buffer;

    esmInit();
    esmTriggerErrorPinReset();

    copy_in(&_flash_ctbl);

    hetInit();
    gioSetDirection( hetPORT1, 0xFFFFFFFF );
    gioSetPort( hetPORT1, 0xFFFFFFFF );

    gioSetDirection( gioPORTA, 0x00 );


    while( 1 ){
        buffer = gioGetBit( gioPORTA, 7 );
        if ( buffer == 0 )
            Test_Fcn();
        else
            gioSetPort( hetPORT1, 0xFFFFFFFF );

########################################################################################

excerpt from Test.c

#include "Test.h"

#include "HL_gio.h"
#include "HL_reg_gio.h"
#include "HL_het.h"
#include "HL_reg_het.h"

//#pragma CODE_SECTION( Test_Fcn, ".test_sec")
void Test_Fcn( void ){
    gioSetPort( hetPORT1, 0xFFFFFFF0 );
}

Can anybody give me a hint, what is wrong with the implementation or my understanding of the concept itself?

Thank you in advance!