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

TMS320F28388D ] 부트 과정

by eteo 2023. 8. 16.

 

 

 

 

Reset이 일어나면 먼저 PC(Program Counter)는 Reset Vector가 fetch되어있는 0x3FFFC0으로 설정된다. Reset Vector의 내용은 Boot ROM 영역에 있는 InitBoot 코드로 점프하는 것이다.

 

Boot ROM은 한번만 프로그래밍 가능한 영역으로 공장 출하시 TI사가 부트로더 Software를 마스킹해둔 곳인데, 여기에 부트로더 역할을 하는 InitBoot 함수가 있다.

 

InitBoot 코드가 실행되면 부트로딩을 위한 루틴을 수행하고 I/O 핀 상태에 따라 BootMode를 결정한 뒤 BootMode에 따라 온칩 메모리의 특정 Entry Point를 실행하게 된다.

 

 

참고로 Boot ROM에 마스킹된 Boot Code는 아래 경로에서 살펴볼 수 있다.

 

C:\ti\c2000\C2000Ware_<version>\libraries\boot_rom\f2838x\revA\rom_sources\cpu1\F2838x_ROM\bootROM\source

 

 

 

 

 

 

 

이때 BootMode가 Flash Boot인 경우의 Entry Point는 0x00080000이다.

 

 

 

 

 

링커커맨드파일이나 맵파일을 보면 알겠지만 0x00080000 주소에는 codestart 섹션이 위치하는데 codestart의 내용은 f2838x_codestartbranch.asm에서 확인할 수 있다.

 

watchdog을 disable하고 컴파일러의 runtime support library인 _c_init00 함수를 호출한다.

 

***********************************************************************
* Function: codestart section
*
* Description: Branch to code starting point
***********************************************************************

    .sect "codestart"
    .retain

code_start:
    .if WD_DISABLE == 1
        LB wd_disable       ;Branch to watchdog disable code
    .else
        LB _c_int00         ;Branch to start of boot._asm in RTS library
    .endif

;end codestart section

 

 

_c_init00 함수는 C/C++ 프로그램을 위한 스타트업 루틴 코드로 아래의 내용을 포함한다. 

 

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

 

이 내용은 아래 경로의 boot28.asm 파일에서 확인할 수 있다.

 

C:\ti\ccs<version>\ccs\tools\compiler\ti-cgt-c2000_<version>\lib\src

 

startup code가 끝난 이후에 user code의 main이 호출된다.

 

 

 

Reference :

https://www.ti.com/lit/ug/spru722c/spru722c.pdf?ts=1691471711909&ref_url=https%253A%252F%252Fwww.google.com%252F 

https://dev.ti.com/tirex/explore/node?node=AQ1tGMpLRjv7eHExtaFLPw__jEBbtmC__LATEST (Boot-mode, Resets, Interrupts, Non Maskable Interrupts (NMI) and Watchdog)