본문 바로가기
DSP, MCU/TMS320F2838x (C28x)

TMS320F28388D ] CM, C28x 코어 진입점으로 점프

by eteo 2023. 5. 7.

 

CM

 

먼저 CM코어의 경우는 Application 실행을 위한 Entry Point는 0x200001 이고 해당 주소로 점프하면 된다.

 

 

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/923512/tms320f28388d-cm-core-code-jump-to-execution-giving-meets-error-asking-for-how-to-do

 

TMS320F28388D: CM core code jump to execution giving meets error, asking for how to do - C2000 microcontrollers forum - C2000

 

e2e.ti.com

 

 

 

그러면 ResetISR()함수가 호출되는데 startup_cm.c에 정의되어 있다. 여기서 하는일은 다시 _c_init00 으로 분기한다.

//
// This is the code that gets called when the processor first starts execution
// following a reset event. 
// Any actions (such as making decisions based on the reset cause register,    
// and resetting the bits in that register) are left solely in the hands of    
// the application.
//                                                               
#pragma RETAIN(resetISR)
#pragma CODE_SECTION(resetISR, ".resetisr")
void resetISR(void)
{
    //
    // Jump to the CCS C Initialization Routine.
    //
    __asm("    .global _c_int00\n"
          "    b.w     _c_int00");
}

 

 

 

 

CM Entry Point로 점프

void (*jump)(void) = (void (*)(void))(uint32_t)0x00200001;
(*jump)();

 

 

 

 

 

 

 

 

 

C28x

 

 

C28x 코어의 경우 Entry Point는 codestart 섹션의 시작주소인 0x080000이다.

 

 

codestart 섹션안에 있는 code_start함수는 f2838x_codestartbranch.asm에 정의되어 있다. watchdog을 disable하고 C프로그램 실행시 필요한 초기화 루틴이 포함된 _c_int00으로 분기한다.

 

 

 

 

C28x Entry Point로 점프

void (*jump)(void) = (void (*)(void))(uint32_t)0x080000;
(*jump)();

 

 

Long branch 어셈블리 명령어를 사용하는 방법도 있다.

__asm(" LB #0x80000");

 

 

혹은 Watchdog timeout을 일으켜 리셋시키는 방법도 있다.

 

EALLOW;
SysCtl_setWatchdogMode(SYSCTL_WD_MODE_RESET);

SysCtl_enableWatchdog();
EDIS;

 

 

 

 

참고로 _c_int00 함수의 실체는 컴파일러 설치 경로 안의 boot28.asm에서 찾을 수 있다.

 

C:/ti/ccs1110/ccs/tools/compiler/ti-cgt-c2000_21.6.0.LTS/lib/src/boot28.asm

 

 

그리고 _c_int00 함수가 하는 일은 다음과 같다.

 

 

1. Set up the stack by initializing SP

2. Set up the data page pointer DP (for architectures that have one)

3. Set configuration registers

4. Process the .cinit table to autoinitialize global variables (when using the --rom_model option)

5. Process the .pinit table to construct global C++ objects.

6. Call the function main with appropriate arguments

7. Call exit when main returns