Preparing the Build System for Debugging - 2023.1 English

PetaLinux Tools Documentation: Reference Guide (UG1144)

Document ID
UG1144
Release Date
2023-05-16
Version
2023.1 English
  1. Change to the project directory:
    cd <plnx-proj-root>
  2. Add the following lines in <plnx-proj-root>/project-spec/meta-user/conf/user-rootfsconfig:
    CONFIG_myapp-dev
    CONFIG_myapp-dbg
    
  3. Add the following lines in <plnx-proj-root>/project-spec/meta-user/recipe-apps/myapp/myapp.bb.
    
    DEBUG_FLAGS = "-g3 -O0"
    
    # Specifies to build packages with debugging information
    DEBUG_BUILD = "1"
    
    # Do not remove debug symbols
    INHIBIT_PACKAGE_STRIP = "1"
    
    # OPTIONAL: Do not split debug symbols in a separate file
    INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
  4. Run petalinux-config -c rootfs on the command console:
    petalinux-config -c rootfs
  5. Scroll down the user packages Configuration menu to Debugging:
    Filesystem Packages   ---> 
    PetaLinux Package Groups --->
    apps   ---> 
    user packages   --->
    PetaLinux RootFS Settings  --->
  6. Select user packages.
    [X] myapp-dbg
    [ ] myapp-dev
  7. Select myapp-dbg. Exit the myapp submenu.
  8. Exit the user packages submenu, and select Filesystem Packages > misc > gdb.
  9. Select gdb, and ensure that the GDB server is enabled:
    [ ] gdb 
    [ ] gdb-dev 
    [X] gdbserver 
    [ ] gdb-dbg
  10. Exit the menu and select <Yes> to save the configuration.
  11. Select Filesystem Packages > misc > tcf-agent.
  12. Deselect tcf-agent as it uses the same 1534 port. Exit the menu and save the configuration.
  13. Rebuild the target system image. Add the following line in <plnx-proj-root>/project-spec/meta-user/conf/petalinuxbsp.conf.
    RM_WORK_EXCLUDE += "myapp"

For more information, see Building a System Image.