debug ti keystone ii u-boot with ccsv5

13
TI Information – Selective Disclosure TI Information – Selective Disclosure Debug TI Keystone II U-Boot with CCSv5 Vincent Han Mar, 2014 1

Upload: quincy-hooper

Post on 02-Jan-2016

42 views

Category:

Documents


0 download

DESCRIPTION

Debug TI Keystone II U-Boot with CCSv5. Vincent Han Mar, 2014. Agenda. Basic U-boot Code Structure Debug on TCI6638EVM with CCSv5. Basic Keystone II U-boot Code Structure. U-boot Relocation Mechanism. U-boot designs the HW initialization as 2 parts - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Debug  TI Keystone  II U-Boot with CCSv5

TI Information – Selective DisclosureTI Information – Selective Disclosure

Debug TI Keystone II U-Boot with CCSv5

Vincent Han

Mar, 2014

1

Page 2: Debug  TI Keystone  II U-Boot with CCSv5

TI Information – Selective Disclosure

• Basic U-boot Code Structure

• Debug on TCI6638EVM with CCSv5

2

Agenda

Page 3: Debug  TI Keystone  II U-Boot with CCSv5

TI Information – Selective Disclosure

Basic Keystone II U-boot Code Structurestart.S crt0.S board.c

_start:

bl _main...

_main:

bl board_init_f...

board_init_f(){

...board_early_init_f

b relocate_code

...

relocate_code:...

...}

ld pc, = board_init_r

...

board_init_r(){

...

}

\tci6638_evm\board.c

board_early_init_f(){ ...}

Page 4: Debug  TI Keystone  II U-Boot with CCSv5

TI Information – Selective Disclosure

U-boot Relocation Mechanism• U-boot designs the HW initialization as 2 parts

– 1st part is function “board_init_f”– 2nd part is function “board_init_r”

• There will be sections’ relocation operation during these 2 steps• Benefits of this design:

– Can implement on some platforms have little on-chip SRAM to run entire image (e.g. have little size of on-chip memory but have enough room on DDR)

– Can improve the code execute efficiency (e.g. first run on Flash then relocate the code and run on SRAM)

• Although Keystone II devices have enough on-chip SRAM ,the Keystone II U-boot code still keeps this mechanism

Page 5: Debug  TI Keystone  II U-Boot with CCSv5

TI Information – Selective Disclosure

U-boot Relocation Procedures - 1

MSMC SRAM DDR SRAM(Not initialized)

U-boot Image

PC board_init_f

relocate_code

board_init_r

InitializeDDR

Page 6: Debug  TI Keystone  II U-Boot with CCSv5

TI Information – Selective Disclosure

U-boot Relocation Procedures - 2

DDR SRAM(Initialized)

PC

Copy sections to

DDR

MSMC SRAM

U-boot Image

board_init_f

relocate_code

board_init_r

U-boot Image

board_init_f

relocate_code

board_init_r

Page 7: Debug  TI Keystone  II U-Boot with CCSv5

TI Information – Selective Disclosure

U-boot Relocation Procedures - 3

DDR SRAM(Initialized)

PC

MSMC SRAM

U-boot Image

board_init_f

relocate_code

board_init_r

U-boot Image

board_init_f

relocate_code

board_init_r

…Not use anymore

can release for others

PC

Page 8: Debug  TI Keystone  II U-Boot with CCSv5

TI Information – Selective Disclosure

• Basic U-boot Code Structure

• Debug on TCI6638EVM with CCSv5

8

Agenda

Page 9: Debug  TI Keystone  II U-Boot with CCSv5

TI Information – Selective Disclosure

Debug on TCI6638EVM with CCSv5• Launch the debug session and connect the target

– Please do not use any ARM core gel file – Connect with the 1st ARM core on TCI6638 (other 3 cores are power-off after reset)

• Load symbol to the target– After you load the symbol table, some of the symbols/functions which defined in U-boot

image can be recognized by CCS

• Load bin file to the target– Choose the load address “0x0C00_1000” and choose the 32-bit load mode

• Change PC and map code in CCS– Add PC pointer in expression view and force PC pointer point to “0x0C00_1000”– Step into/over in the disassembly view by clicking green buttons until the PC pointer

point to “board_init_f”

Page 10: Debug  TI Keystone  II U-Boot with CCSv5

TI Information – Selective Disclosure

Debug on TCI6638EVM with CCSv5– Click “step into” to go to this function, you will see the following hints in code view

window– Click “Locate File” to locate the correct path of board.c on your PC– Then you can debug the first part of hardware configurations code calling in function

“board_init_f”

• Get the relocate address from code– Function “board_init_f” will calculate the relocation address and store it in “id-

>relocaddr”, we can get this value in the end part of this function

• Remap code in CCS for relocation– After the relocation, the disassembly pointer and source code pointer will not be match

with each other, which need our manually adjust to correct offset– We need to run just before calling “relocate_code” in function “_main” by setting the

hardware breakpoint

Page 11: Debug  TI Keystone  II U-Boot with CCSv5

TI Information – Selective Disclosure

Debug on TCI6638EVM with CCSv5– Then reload the symbol by adding the previous offset “0xBFF5_6000” to get the correct

source code and disassembly pointer after the relocation for further debugging – The code and disassembly pointer will adjust to the correct place after relocation– We can switch to the correct address of “board_init_r” and make a hardware breakpoint

in that place, then execute the code to stop at that breakpoint– We need to make the breakpoint at the adjusted address rather than the address before

the relocation, or the breakpoint point to the different place and cannot stop correctly– We can see that after we stopped after relocation, the assembly code seemed incorrect

due to the CCS disassembly view window parse the code in 32-bit ARM mode other than 16-bit Thumb mode, which needs us manually change the disassembly code view to Thumb mode

– After this step, you can move on to debug the U-boot code in CCS by step into/over

• For more information, please refer operation guide on deyisupport

Page 12: Debug  TI Keystone  II U-Boot with CCSv5

TI Information – Selective Disclosure 12

• For the next boot procedure, if you configured the environment variables correctly, U-Boot will boot Linux Kernel automatically by default.

• Using UBI file-system, Linux Kernel, Boot Monitor and DTB files will be burnt on NAND flash, Ethernet is not needed during every boot time.

Boot Linux Kernel (UBI File-system)

Page 13: Debug  TI Keystone  II U-Boot with CCSv5

TI Information – Selective DisclosureTI Information – Selective Disclosure

Thank You!