Difference between revisions of "U-Boot - How to debug"

[quality revision] [quality revision]
m
 
m (Debug with console)

Template:ArticleMainWriter

Template:ArticleApprovedVersion
Applicable for STM32MP13x lines, STM32MP15x lines

Contents

1 Debug with console[edit]

Trace and error See U-Boot Documentation or doc/develop/logging.rst for U-Boot logging details.

CONFIG_LOG is enable in OpenSTLinux.

By default, traces are available on the U-Boot console which use stdout-path defined in the chosen node of the Linux kernel device tree by the stdout-path field:

 chosen {
 	stdout-path = "serial3:115200n8";
 };

By default, the as described in the Linux kernel binding[1].

See page How to configure U-Boot for your board for configuration details.

The ST boards use the default logging configuration:

  • CONFIG_LOG_DEFAULT_LEVEL = CONFIG_LOG_MAX_LEVEL = LOGL_INFO = 6
    the 'debug' macros used by U-Boot (log_debug(), debug(), pr_debug()...)
do not print any trace; to activate the debug traces on a specific file, you need to enable the DEBUG compilation flag and change the LOGLEVEL for the file:
  • define DEBUG are removed in the U-Boot binary.
  • CONFIG_LOGF_FILE, CONFIG_LOGF_LINE, CONFIG_LOGF_FUNC are not activated
    no debug information in log messages by default.

To enable all the debug traces in U-Boot you need to increase the max logging level with a major impact on U-Boot size; e.g. set CONFIG_LOG_MAX_LEVEL to LOGL_DEBUG by adding in your defconfig file the line:

 CONFIG_LOG_MAX_LEVEL=7

When the traces are present in U-Boot, you can change the default trace level with CONFIG_LOG_DEFAULT_LEVEL or you can use the log command (CONFIG_CMD_LOG) to dynamically configure and filter the output:

   log level 7
   log format all

1.1 Activate debug trace on one file[edit]

To turn on this debug logging just in one file, you can define LOG_DEBUG and DEBUG for this file

  • add define before any include in the <file>.c file
 #define LOG_DEBUG
 #undef CONFIG_LOGLEVEL
 #define CONFIG_LOGLEVELDEBUG
8

  • with a Makefile
 CFLAGS_<file>.o+= -DDEBUGDLOG_DEBUG  -DCONFIG_LOGLEVEL=8DDEBUG

1.2 Debug before console[edit]

If U-Boot fails before the console configuration (in the first stage of U-Boot execution), trace is not available.

In this case, you need to:

  • debug with GDB (see the next chapter)

or,

  • activate the debug UART feature:
    • activate add in defconfig of U-Boot configuration
      • CONFIG_DEBUG_UART
      with configure
      • CONFIG_DEBUG_UART_STM32
    • adapt the function board_debug_uart_init(): this is a weak function that configures the required resources (pad, clock) before initialization by the U-Boot driver.
      This function needs to be adapted for your caseboard.

2 Debug with GDB on a Flashed device[edit]

You need to:

  • connect GDB to the target
  • load the symbols of the binary to be debugged (see #SPL symbol load and #U-Boot symbol load).
    The required files are

    With OpenSTLinux, you can directly use GDB script Setup.gdb:

    Or for manual GDB connection, you need to:

    2.2 U-Boot symbol load
    1. get the elf files for U-Boot = u-boot available in the build directory.
    2. connect GDB to the target
    3. reset with attach the target with the gdb "monitor reset halt" command:
    4. start execution with the "continue" command

    2.1 SPL symbol load[edit]

    To debug SPL, the GDB script just consists of loading the SPL symbols:

     (gdb) symbol-file spl/u-boot-spl
    
    
    1. execution is stopped in ROM code or at the beginning of FSBL execution.
    2. load the symbols of the binary to be debugged with commands available in next chapter:
      #Load U-Boot symbol
    3. start execution with the "continue" command

    2.1 Load U-Boot symbol[edit]

    With U-Boot relocation, symbols are more difficult to load.

    See https://www.denx.de/wiki/DULG/DebuggingUBoot

    Here is an example of a GDB script to debug U-Boot:

    (gdb)

    If you connect GDB on running target, you can load the debug symbols:

    • Before relocation with "symbol-file" command:
      symbol-file u-boot
    
    
    • After relocation with "add-symbol-file" command to relocate the symbol with the code offset = gd->relocaddr:
      symbol-file u-boot                            --> only for "gd_t" definition
      set $offset = ((gd_t *)$r9)->relocaddr        --> get relocation offset
      symbol-file                                   --> clear previous symbol 
      add-symbol-file u-boot $offset
    
    

    The following GDB example script automatically loads the U-Boot symbol before and after relocation for a programmed board, after "monitor reset halt" command:

      thbreak *0xC0100000
     (gdb) commands
     > symbol-file u-boot
     > thbreak relocate_code
     > commands
       > print "RELOCATE U-Boot..."
       > set $offset = ((gd_t *)$r9)->relocaddr
       > print $offset
       > symbol-file
       > add-symbol-file u-boot $offset
       > thbreak boot_jump_linux
       > continue
       > end
     > continue
     > end
    

    The U-Boot code is relocated at the end of the DDR, at gd->relocaddr.

    The This script uses a temporary hardware breakpoint ("thbreak) " to automatically load the symbol when U-Boot symbol with

    'u-boot' = the elf file for

    code is loaded in DDR by FSBL = TF-A at the U-Boot

    entry point, CONFIG_SYS_TEXT_BASE =

    0xC0100000 (loading symbol

    • 0xC0000000 for STM32MP13x lines Warning.png
    • 0xC0100000 for STM32MP15x lines More info.png

    It allows the symbol to be loaded only when code is executed

    )

    to avoid DDR access before DDR initialization.

    3 Load code and debug with GDB[edit]

    To load and debug on the target, you need to:

    1. reset and attach to the target as soon as possible: with the GDB "monitor reset halt" command, see GDB for details
    2. load the code and device-tree by using GDB (with the load command, see the following examples)
    3. execute the binary (the PC is automatically updated, execute the code with the GDB "continue" command)

    Depending on the device tree location defined with one of the CONFIG_OF_* configuration flags, the scripts to load the SPL code are:

    • CONFIG_OF_SEPARATE = dtb appended at the end of the code, not present in the elf file
     (gdb) file spl/u-boot-spl
     (gdb) load
     (gdb) set $dtb =  __bss_end
     (gdb) restore spl/dt.dtb binary $dtb
    
    
    • CONFIG_OF_EMBED = dtb embedded in the elf file
     (gdb) file spl/u-boot-spl
     (gdb) load
    
    

    References[edit]

    1. Documentation/devicetree/bindings/chosen.txt the Linux kernel binding for chosen node


    <noinclude>
    
    {{ArticleMainWriter|PatrickD}}
    
    {{ ArticleApprovedVersion |PatrickD| GeraldB, PatriceC , LionelD, NicolasLB, YannG, ChristopheG, JeanPhilippeR , ChristopheK| Jan'18  | PhilipS - 20Jul'18 - 7956 | 22Jul'18 }}
    
    [[Category:U-Boot]]
    [[Category:Tracing tools]]
    [[Category:Debugging tools]]</noinclude>
    
    
    == Debug with console ==
    Trace and error {{ApplicableFor
    |MPUs list=STM32MP13x, STM32MP15x
    |MPUs checklist=STM32MP13x,STM32MP15x
    }}</noinclude>
    
    == Debug with console ==
    
    See {{DocSource | domain=U-Boot |path=develop/logging.html | text=U-Boot Documentation}} or {{CodeSource | U-Boot |doc/develop/logging.rst}} for U-Boot logging details.
    
    '''CONFIG_LOG''' is enable in OpenSTLinux.
    
    By default, traces are available on the U-Boot console which use <code>stdout-path</code> defined in the '''<code>chosen'''</code> node of the Linux kernel device tree by the '''stdout-path''' field:
    
      chosen {
      	stdout-path = "serial3:115200n8";
      };
    
    By default, the as described in the Linux kernel binding<ref>{{CodeSource | Linux kernel | Documentation/devicetree/bindings/chosen.txt | Documentation/devicetree/bindings/chosen.txt}} the Linux kernel binding for chosen node</ref>.
    
    See page [[How_to_configure_U-Boot_for_your_board#Console|How to configure U-Boot for your board]] for configuration details.
    
    The ST boards use the default logging configuration:
    * {{highlight|CONFIG_LOG_DEFAULT_LEVEL}} = {{highlight|CONFIG_LOG_MAX_LEVEL}} =  {{highlightParam|LOGL_INFO}} = {{highlightParam|6}}<br/>the 'debug' macros used by U-Boot (log_debug(), debug(), pr_debug()...) do not print any trace; to activate the debug traces on a specific file, you need to enable the '''DEBUG''' compilation flag and change the LOGLEVEL for the file:
    * define DEBUG are removed in the U-Boot binary.
    * CONFIG_LOGF_FILE, CONFIG_LOGF_LINE, CONFIG_LOGF_FUNC are not activated<br/>no debug information in log messages by default.
    
    To enable all the debug traces in U-Boot you need to increase the max logging level with a major impact on U-Boot size; e.g. set {{highlight|CONFIG_LOG_MAX_LEVEL}} to {{highlightParam|LOGL_DEBUG}} by adding in your defconfig file the line:
    
      {{highlight|CONFIG_LOG_MAX_LEVEL}}={{HighlightParam|7}}
    
    When the traces are present in U-Boot, you can change the default trace level with {{highlight|CONFIG_LOG_DEFAULT_LEVEL}} or you can use the <code>log</code> command (CONFIG_CMD_LOG) to dynamically configure and filter the output:
    
      {{U-Boot$}}  log level 7
      {{U-Boot$}}  log format all
    
    === Activate debug trace on one file ===
    
    To turn on this debug logging just in one file, you can define LOG_DEBUG and DEBUG for this file 
    
    * add define before any include in the <file>.c file
      #define LOG_DEBUG#undef CONFIG_LOGLEVEL
      #define CONFIG_LOGLEVEL 8
    #define DEBUG
    * with a Makefile
      CFLAGS_<file>.o+= -DDEBUG -DCONFIG_LOGLEVEL=8
    DLOG_DEBUG  -DDEBUG
    
    === Debug before console ===
    If U-Boot fails before the console configuration (in the first stage of U-Boot execution), trace is not available.
    
    In this case, you need to:
    * debug with GDB (see the next chapter)
    or,
    * activate the debug UART feature:
    ** activate CONFIG_DEBUG_UART with configure
    ** add in defconfig of [[U-Boot_overview#U-Boot_configuration|U-Boot configuration]]
    *** {{Highlight|CONFIG_DEBUG_UART}}
    *** {{Highlight|CONFIG_DEBUG_UART_STM32}}
    ** adapt the function {{Highlight|board_debug_uart_init(): this is a weak function }}: that configures the required resources (pad, clock) before initialization by the U-Boot driver.<br/>This function needs to be adapted for your caseboard.
    
    == Debug with GDB on a Flashed device ==
    You need to:
    # connect [[GDB]] to the target
    # load the symbols of the binary to be debugged (see [[#SPL symbol load]] and [[#U-Boot symbol load]]).<br/>The required files are ==
    
    With OpenSTLinux,  you can directly use GDB script Setup.gdb:
    * [[GDB#U-Boot_execution_phase]]
    * [[GDB#U-Boot_boot_case]]
    
    Or for manual GDB connection, you need to:
    # get the [[U-Boot_overview#Output_files|elf files]] for U-Boot = <code>u-boot</code> available in the build directory.
    
    # connect [[GDB]] to the target
    # '''reset with attach''' the target with the gdb {{Highlight|"monitor reset halt"}} command
    
    # start execution with the "continue" command
    
    === SPL symbol load ===
    
    To debug SPL, the GDB script just consists of loading the SPL symbols:
    
      (gdb) symbol-file spl/u-boot-spl
    
    === U-Boot symbol load :<br/>execution is stopped in ROM code or at the beginning of FSBL execution.
    # load the symbols of the binary to be debugged with commands available in next chapter:<br/>[[#Load U-Boot symbol]]
    # start execution with the {{Highlight|"continue"}} command
    
    === Load U-Boot symbol ===
    
    With [[U-Boot_overview#U-Boot_phases|U-Boot relocation]], symbols are more difficult to load.
    
    See https://www.denx.de/wiki/DULG/DebuggingUBoot
    Here is an example of a GDB script to debug U-Boot:
    
      (gdb) thbreak *0xC0100000
      (gdb) commands
      > symbol-file u-boot
      > thbreak relocate_code
      > commands
        > print "RELOCATE U-Boot..."
        > If you connect GDB on running target, you can load the debug symbols:
    
    * Before relocation with {{Highlight|"symbol-file"}} command:
      {{GDB$}} {{Highlight|symbol-file u-boot}}
    
    * After relocation with {{Highlight|"add-symbol-file"}} command to relocate the symbol with the code offset = gd->relocaddr:
      {{GDB$}} symbol-file u-boot                            {{Highlight|--> only for "gd_t" definition}}
      {{GDB$}} set $offset = ((gd_t *)$r9)->relocaddr     > print $offset
        > symbol-file
        > add-symbol-file u-boot $offset
        > thbreak boot_jump_linux
        > continue
        > end
      > continue
      > end
    
    The U-Boot code is relocated at the end of the DDR, at gd->relocaddr.
    
    The script uses a temporary hardware breakpoint (thbreak) to automatically load   {{Highlight|--> get relocation offset}}
      {{GDB$}} symbol-file                                   {{Highlight|--> clear previous symbol }}
      {{GDB$}} {{Highlight|add-symbol-file u-boot $offset}}
    
    The following GDB example script automatically loads the U-Boot symbol with
    * 'u-boot' = the elf file for U-Boot
    * CONFIG_SYS_TEXT_BASE = 0xC0100000 (loading symbol only when code is executed)
    
    == Load code and debug with GDB ==
    
    To load and debug on the target, you need to:
    # reset and attach to the target as soon as possible: with the GDB "monitor reset halt" command, see [[GDB]] for details
    # load the code and device-tree by using GDB (with the load command, see the following examples)
    # execute the binary (the PC is automatically updated, execute the code with the GDB "continue" command)
    
    Depending on the [[U-Boot_overview#Device_tree|device tree location]] defined with one of the CONFIG_OF_* configuration flags, the scripts to load the SPL code are:
    
    * CONFIG_OF_SEPARATE = dtb appended at the end of the code, not present in the elf file
    
      (gdb) file spl/u-boot-spl
      (gdb) load
      (gdb) set $dtb =  __bss_end
      (gdb) restore spl/dt.dtb binary $dtb
    
    * CONFIG_OF_EMBED = dtb embedded in the elf file
    
      (gdb) file spl/u-boot-spl
      (gdb) loadbefore and after relocation for a programmed board, after {{Highlight|"monitor reset halt"}} command:
    
      {{GDB$}} thbreak *{{HighlightParam|0xC0100000}}
      {{GDB$}} commands
      > symbol-file u-boot
      > thbreak relocate_code
      > commands
        > print "RELOCATE U-Boot..."
        > set $offset = ((gd_t *)$r9)->relocaddr
        > print $offset
        > symbol-file
        > add-symbol-file u-boot $offset
        > thbreak boot_jump_linux
        > continue
        > end
      > continue
      > end
    
    This script uses a temporary hardware breakpoint {{Highlight|"thbreak"}} to load the symbol when U-Boot code is loaded in DDR by FSBL = TF-A at the U-Boot entry point, CONFIG_SYS_TEXT_BASE =
    * {{HighlightParam|0xC0000000}} for {{MicroprocessorDevice | device=13}}
    * {{HighlightParam|0xC0100000}} for {{MicroprocessorDevice | device=15}}
    
    It allows the symbol to be loaded only when code is executed to avoid DDR access before DDR initialization.
    
    == References ==<references/>
    
    
    [[Category:U-Boot|U-Boot - 8]]
    [[Category:Tracing tools]]
    [[Category:Debugging tools]]
    {{PublicationRequestId | 12894 | 2019-08-01}}</noinclude>
    (37 intermediate revisions by 5 users not shown)
    Line 1: Line 1:
    <noinclude>
    +
    <noinclude>{{ApplicableFor
    {{ArticleMainWriter|PatrickD}}
    +
    |MPUs list=STM32MP13x, STM32MP15x
      +
    |MPUs checklist=STM32MP13x,STM32MP15x
      +
    }}</noinclude>
      +
    == Debug with console ==
      +
     
      +
    See {{DocSource | domain=U-Boot |path=develop/logging.html | text=U-Boot Documentation}} or {{CodeSource | U-Boot |doc/develop/logging.rst}} for U-Boot logging details.
      +
     
      +
    '''CONFIG_LOG''' is enable in OpenSTLinux.
      +
     
      +
    By default, traces are available on the U-Boot console which use <code>stdout-path</code> defined in the <code>chosen</code> node of the Linux kernel device tree as described in the Linux kernel binding<ref>{{CodeSource | Linux kernel | Documentation/devicetree/bindings/chosen.txt | Documentation/devicetree/bindings/chosen.txt}} the Linux kernel binding for chosen node</ref>.
      +
     
      +
    See page [[How_to_configure_U-Boot_for_your_board#Console|How to configure U-Boot for your board]] for configuration details.
      +
     
      +
    The ST boards use the default logging configuration:
      +
    * {{highlight|CONFIG_LOG_DEFAULT_LEVEL}} = {{highlight|CONFIG_LOG_MAX_LEVEL}} =  {{highlightParam|LOGL_INFO}} = {{highlightParam|6}}<br/>the 'debug' macros used by U-Boot (log_debug(), debug(), pr_debug()...) are removed in the U-Boot binary.
      +
    * CONFIG_LOGF_FILE, CONFIG_LOGF_LINE, CONFIG_LOGF_FUNC are not activated<br/>no debug information in log messages by default.
      +
     
      +
    To enable all the debug traces in U-Boot you need to increase the max logging level with a major impact on U-Boot size; e.g. set {{highlight|CONFIG_LOG_MAX_LEVEL}} to {{highlightParam|LOGL_DEBUG}} by adding in your defconfig file the line:
      +
     
      +
      {{highlight|CONFIG_LOG_MAX_LEVEL}}={{HighlightParam|7}}
       
    {{ ArticleApprovedVersion |PatrickD| GeraldB, PatriceC , LionelD, NicolasLB, YannG, ChristopheG, JeanPhilippeR , ChristopheK| Jan'18  | PhilipS - 20Jul'18 - 7956 | 22Jul'18 }}
    +
    When the traces are present in U-Boot, you can change the default trace level with {{highlight|CONFIG_LOG_DEFAULT_LEVEL}} or you can use the <code>log</code> command (CONFIG_CMD_LOG) to dynamically configure and filter the output:
       
    [[Category:U-Boot]]
    +
      {{U-Boot$}}  log level 7
    [[Category:Tracing tools]]
    +
      {{U-Boot$}}  log format all
    [[Category:Debugging tools]]
     
    </noinclude>
     
       
    == Debug with console ==
    +
    === Activate debug trace on one file ===
    Trace and error are available on the console defined in the '''chosen''' node of the device tree by the '''stdout-path''' field:
     
       
      chosen {
    +
    To turn on this debug logging just in one file, you can define LOG_DEBUG and DEBUG for this file
      stdout-path = "serial3:115200n8";
     
      };
     
       
    By default, the macros used by U-Boot (debug(), pr_debug()...) do not print any trace; to activate the debug traces on a specific file, you need to enable the '''DEBUG''' compilation flag and change the LOGLEVEL for the file:
    +
    * add define before any include in the <file>.c file
    * define DEBUG before any include in the <file>.c file
    +
      #define LOG_DEBUG
     
       #define DEBUG
     
       #define DEBUG
      #undef CONFIG_LOGLEVEL
     
      #define CONFIG_LOGLEVEL 8
     
       
     
    * with a Makefile
     
    * with a Makefile
       CFLAGS_<file>.o+= -DDEBUG -DCONFIG_LOGLEVEL=8
    +
       CFLAGS_<file>.o+= -DLOG_DEBUG  -DDEBUG
      +
     
      +
    === Debug before console ===
       
     
    If U-Boot fails before the console configuration (in the first stage of U-Boot execution), trace is not available.
     
    If U-Boot fails before the console configuration (in the first stage of U-Boot execution), trace is not available.
    Line 31: Line 45:
     
    or,
     
    or,
     
    * activate the debug UART feature:
     
    * activate the debug UART feature:
    ** activate CONFIG_DEBUG_UART with configure
    +
    ** add in defconfig of [[U-Boot_overview#U-Boot_configuration|U-Boot configuration]]
    ** board_debug_uart_init(): this is a weak function that configures the required resources (pad, clock) before initialization by the U-Boot driver.<br/>This function needs to be adapted for your case.
    +
    *** {{Highlight|CONFIG_DEBUG_UART}}
      +
    *** {{Highlight|CONFIG_DEBUG_UART_STM32}}
      +
    ** adapt the function {{Highlight|board_debug_uart_init()}}: that configures the required resources (pad, clock) before initialization by the U-Boot driver.<br/>This function needs to be adapted for your board.
       
    == Debug with GDB on a Flashed device ==
    +
    == Debug with GDB ==
    You need to:
    +
     
      +
    With OpenSTLinux,  you can directly use GDB script Setup.gdb:
      +
    * [[GDB#U-Boot_execution_phase]]
      +
    * [[GDB#U-Boot_boot_case]]
      +
     
      +
    Or for manual GDB connection, you need to:
      +
    # get the [[U-Boot_overview#Output_files|elf files]] for U-Boot = <code>u-boot</code> available in the build directory
     
    # connect [[GDB]] to the target
     
    # connect [[GDB]] to the target
    # load the symbols of the binary to be debugged (see [[#SPL symbol load]] and [[#U-Boot symbol load]]).<br/>The required files are available in the build directory.
    +
    # '''reset with attach''' the target with the gdb {{Highlight|"monitor reset halt"}} command:<br/>execution is stopped in ROM code or at the beginning of FSBL execution.
    # '''reset with attach''' the target with the gdb "monitor reset halt" command
    +
    # load the symbols of the binary to be debugged with commands available in next chapter:<br/>[[#Load U-Boot symbol]]
    # start execution with the "continue" command
    +
    # start execution with the {{Highlight|"continue"}} command
       
    === SPL symbol load ===
    +
    === Load U-Boot symbol ===
       
    To debug SPL, the GDB script just consists of loading the SPL symbols:
    +
    With [[U-Boot_overview#U-Boot_phases|U-Boot relocation]], symbols are more difficult to load.
       
      (gdb) symbol-file spl/u-boot-spl
    +
    See https://www.denx.de/wiki/DULG/DebuggingUBoot
       
    === U-Boot symbol load ===
    +
    If you connect GDB on running target, you can load the debug symbols:
       
    With [[U-Boot_overview#U-Boot_phases|U-Boot relocation]], symbols are more difficult to load.
    +
    * Before relocation with {{Highlight|"symbol-file"}} command:
      +
      {{GDB$}} {{Highlight|symbol-file u-boot}}
       
    See https://www.denx.de/wiki/DULG/DebuggingUBoot
    +
    * After relocation with {{Highlight|"add-symbol-file"}} command to relocate the symbol with the code offset = gd->relocaddr:
      +
      {{GDB$}} symbol-file u-boot                            {{Highlight|--> only for "gd_t" definition}}
      +
      {{GDB$}} set $offset = ((gd_t *)$r9)->relocaddr        {{Highlight|--> get relocation offset}}
      +
      {{GDB$}} symbol-file                                  {{Highlight|--> clear previous symbol }}
      +
      {{GDB$}} {{Highlight|add-symbol-file u-boot $offset}}
       
    Here is an example of a GDB script to debug U-Boot:
    +
    The following GDB example script automatically loads the U-Boot symbol before and after relocation for a programmed board, after {{Highlight|"monitor reset halt"}} command:
       
       (gdb) thbreak *0xC0100000
    +
       {{GDB$}} thbreak *{{HighlightParam|0xC0100000}}
       (gdb) commands
    +
       {{GDB$}} commands
     
       > symbol-file u-boot
     
       > symbol-file u-boot
     
       > thbreak relocate_code
     
       > thbreak relocate_code
    Line 71: Line 98:
     
       > end
     
       > end
       
    The U-Boot code is relocated at the end of the DDR, at gd->relocaddr.
    +
    This script uses a temporary hardware breakpoint {{Highlight|"thbreak"}} to load the symbol when U-Boot code is loaded in DDR by FSBL = TF-A at the U-Boot entry point, CONFIG_SYS_TEXT_BASE =
      +
    * {{HighlightParam|0xC0000000}} for {{MicroprocessorDevice | device=13}}
      +
    * {{HighlightParam|0xC0100000}} for {{MicroprocessorDevice | device=15}}
       
    The script uses a temporary hardware breakpoint (thbreak) to automatically load the U-Boot symbol with
    +
    It allows the symbol to be loaded only when code is executed to avoid DDR access before DDR initialization.
    * 'u-boot' = the elf file for U-Boot
     
    * CONFIG_SYS_TEXT_BASE = 0xC0100000 (loading symbol only when code is executed)
     
       
    == Load code and debug with GDB ==
    +
    == References ==
      +
    <references/>
       
    To load and debug on the target, you need to:
    +
    [[Category:U-Boot|U-Boot - 8]]
    # reset and attach to the target as soon as possible: with the GDB "monitor reset halt" command, see [[GDB]] for details
    +
    [[Category:Tracing tools]]
    # load the code and device-tree by using GDB (with the load command, see the following examples)
    +
    [[Category:Debugging tools]]
    # execute the binary (the PC is automatically updated, execute the code with the GDB "continue" command)
    +
    {{PublicationRequestId | 12894 | 2019-08-01}}
     
    +
    </noinclude>
    Depending on the [[U-Boot_overview#Device_tree|device tree location]] defined with one of the CONFIG_OF_* configuration flags, the scripts to load the SPL code are:
     
     
     
    * CONFIG_OF_SEPARATE = dtb appended at the end of the code, not present in the elf file
     
     
     
      (gdb) file spl/u-boot-spl
     
      (gdb) load
     
      (gdb) set $dtb =  __bss_end
     
      (gdb) restore spl/dt.dtb binary $dtb
     
     
     
    * CONFIG_OF_EMBED = dtb embedded in the elf file
     
     
     
      (gdb) file spl/u-boot-spl
     
      (gdb) load