Skip to contentSkip to conversation

How to compile u-boot with debug option?

DISCUSSION Chan Kim 2 participants 5 messages Oct 19, 2021

lore
Share & tools
lore

Chan Kim

author
#0 lore raw

Hello,

With these commands,

make ARCH=arm CROSS_COMPILE=aarch64-none-elf- qemu_arm64_defconfig

make ARCH=arm CROSS_COMPILE=aarch64-none-elf-

I see only u-boot.bin. How can I make u-boot.elf with debug info?

I found https://lists.denx.de/pipermail/u-boot/2005-May/010240.html and tried adding

-DDEBUG to CFLAGS_NON_EFI in arch/arm/config.mk and adding CFLAGS += -DDEBUG in arch/arm/cpu/armv8/config.mk

But after doing "make ARCH=arm CROSS_COMPILE=aarch64-none-elf- u-boot.elf", when I give file command for the u-boot.elf, it says

u-boot.elf: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, not stripped

I think I should see "with debug_info, not stripped". With connecting gdb, I can't see the source file. The run responds to 'continue' command though.

Could any tell me what I can do?

Thank you,

Chan Kim

#1 lore raw
Quoted 6 lines · Chan Kim

Hello,

With these commands,

Quoted 8 lines

make ARCH=arm CROSS_COMPILE=aarch64-none-elf- qemu_arm64_defconfig

make ARCH=arm CROSS_COMPILE=aarch64-none-elf-

I see only u-boot.bin. How can I make u-boot.elf with debug info?

I found https://protect2.fireeye.com/v1/url?k=126d5a6e-4df662a4-126cd121-0cc47a31bee8-8e6c8ef0c2793943&q=1&e=4928b69d-166a-4647-b6c5-88bc2f73a780&u=https%3A%2F%2Flists.denx.de%2Fpipermail%2Fu-boot%2F2005-May%2F010240.html and tried adding

It's too old patch. It's not proper to current u-boot.

make ARCH=arm menucofig and check config relevant to DEBUG option.

Best Regards,
Jaehoon Chung

Quoted 28 lines

-DDEBUG to CFLAGS_NON_EFI in arch/arm/config.mk and adding CFLAGS += -DDEBUG in arch/arm/cpu/armv8/config.mk

But after doing "make ARCH=arm CROSS_COMPILE=aarch64-none-elf- u-boot.elf", when I give file command for the u-boot.elf, it says

u-boot.elf: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, not stripped

I think I should see "with debug_info, not stripped". With connecting gdb, I can't see the source file. The run responds to 'continue' command though.

Could any tell me what I can do?

Thank you,

Chan Kim

author
#2 lore raw

Hello, Jaehoon and all,

I tried setting in menuconfig TOOLS_DEBUG but no change. It's strainge, when I add "V=1" in the make command, I can see the commands run during the make. The cc command has -g options, a typical command being like this :

aarch64-none-elf-gcc -Wp,-MD,lib/.asm-offsets.s.d -nostdinc -isystem /home/ckim/prj/abdsn/ab21cv/tools/cc_zeus/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/include -Iinclude -I./arch/arm/include -include ./include/linux/kconfig.h -D__KERNEL__ -D__UBOOT__ -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing -fno-PIE -Os -fno-stack-protector -fno-delete-null-pointer-checks -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=./= -g -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=date-time -Wno-packed-not-aligned -D__ARM__ -fno-pic -mstrict-align -ffunction-sections -fdata-sections -fno-common -ffixed-r9 -mgeneral-regs-only -fno-common -ffixed-x18 -pipe -march=armv8-a+crc -D__LINUX_ARM_ARCH__=8 -DDO_DEPS_ONLY -DKBUILD_BASENAME='"asm_offsets"' -DKBUILD_MODNAME='"asm_offsets"' -fverbose-asm -S -o lib/asm-offsets.s lib/asm-offsets.c

(you can see -g option near the middle place)
I don't know why the final .elf file doesn't contain debuginfo.

ckim@ckim-ubuntu:~/U-BOOT/u-boot$ readelf -S u-boot.elf
There are 5 section headers, starting at offset 0xc8950:

Section Headers:

  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .data             PROGBITS         0000000000000000  00010000
       00000000000b8850  0000000000000000  WA       0     0     1
  [ 2] .symtab           SYMTAB           0000000000000000  000c8850
       0000000000000090  0000000000000018           3     2     8
  [ 3] .strtab           STRTAB           0000000000000000  000c88e0
       0000000000000049  0000000000000000           0     0     1
  [ 4] .shstrtab         STRTAB           0000000000000000  000c8929
       0000000000000021  0000000000000000           0     0     1

Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info), L (link order), O (extra OS processing required), G (group), T (TLS), C (compressed), x (unknown), o (OS specific), E (exclude), p (processor specific)

And there are many configs including pattern "DEBUG" like CONFIG_DEBUG_UART_SANDBOX but it seems they are adding special debug features in the program behavior. What I want is to run the u-boot program itself in debug mode so that I can attach gdb and follow the program steps. (continue, step-in, step-out things..)

Any comment will be very much appreciated.
Thank you, and best regards,

Chan Kim

Quoted 62 lines

-----Original Message-----
From: Jaehoon Chung <[email protected]>
Sent: Tuesday, October 19, 2021 12:26 PM
To: Chan Kim <[email protected]>; U-Boot Mailing List <[email protected]>
Subject: Re: How to compile u-boot with debug option?

Quoted 10 lines · Chan Kim

Hello,

With these commands,

make ARCH=arm CROSS_COMPILE=aarch64-none-elf- qemu_arm64_defconfig

make ARCH=arm CROSS_COMPILE=aarch64-none-elf-

Quoted 7 lines

I see only u-boot.bin. How can I make u-boot.elf with debug info?

I found
https://protect2.fireeye.com/v1/url?k=126d5a6e-4df662a4-126cd121-0cc47
a31bee8-8e6c8ef0c2793943&q=1&e=4928b69d-166a-4647-b6c5-88bc2f73a780&u= https%3A%2F%2Flists.denx.de%2Fpipermail%2Fu-boot%2F2005-May%2F010240.h tml and tried adding

It's too old patch. It's not proper to current u-boot.

make ARCH=arm menucofig and check config relevant to DEBUG option.

Best Regards,
Jaehoon Chung

Quoted 9 lines
(quoted diff) +0 -2
-DDEBUG to CFLAGS_NON_EFI in arch/arm/config.mk and adding CFLAGS +=
-DDEBUG in arch/arm/cpu/armv8/config.mk

But after doing "make ARCH=arm CROSS_COMPILE=aarch64-none-elf- u-boot.elf", when I give file command for the u-boot.elf, it says

Quoted 7 lines

u-boot.elf: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, not stripped

I think I should see "with debug_info, not stripped". With connecting gdb, I can't see the source file. The run responds to 'continue' command

though.

Quoted 12 lines

Could any tell me what I can do?

Thank you,

Chan Kim

#3 lore raw

Hi,

Quoted 9 lines · Chan Kim

Hello, Jaehoon and all,

I tried setting in menuconfig TOOLS_DEBUG but no change. It's strainge, when I add "V=1" in the make command, I can see the commands run during the make. The cc command has -g options, a typical command being like this :

aarch64-none-elf-gcc -Wp,-MD,lib/.asm-offsets.s.d -nostdinc -isystem /home/ckim/prj/abdsn/ab21cv/tools/cc_zeus/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/include -Iinclude -I./arch/arm/include -include ./include/linux/kconfig.h -D__KERNEL__ -D__UBOOT__ -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing -fno-PIE -Os -fno-stack-protector -fno-delete-null-pointer-checks -Wno-pointer-sign -Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno-maybe-uninitialized -fmacro-prefix-map=./= -g -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=date-time -Wno-packed-not-aligned -D__ARM__ -fno-pic -mstrict-align -ffunction-sections -fdata-sections -fno-common -ffixed-r9 -mgeneral-regs-only -fno-common -ffixed-x18 -pipe -march=armv8-a+crc -D__LINUX_ARM_ARCH__=8 -DDO_DEPS_ONLY -DKBUILD_BASENAME='"asm_offsets"' -DKBUILD_MODNAME='"asm_offsets"' -fverbose-asm -S -o lib/asm-offsets.s lib/asm-offsets.c

(you can see -g option near the middle place)
I don't know why the final .elf file doesn't contain debuginfo.

Actually, i didn't run u-boot on qemu with gdb. But I followed the below step..

$make ARCH=arm64 qemu_arm64_defconfig
$make CROSS_COMPILE=aarch64-none-elf-

$qemu-system-aarch64 -curses -machine virt -cpu cortex-a57 -bios u-boot.bin -S -s $aarch64-none-elf-gdb u-boot -ex "target remote tcp::1234"

Then I can run u-boot step-by-step.

─── Output/messages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── reset () at arch/arm/cpu/armv8/start.S:57
57 b save_boot_params

─── Assembly ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 0x0000000000000028  ? b    0x174 <save_boot_params>
 0x000000000000002c  ? adr    x0, 0x0 <_start>
 0x0000000000000030  ? ands    x0, x0, #0xfff
 0x0000000000000034  ? b.eq    0x40 <pie_fixup>  // b.none
 0x0000000000000038  ? wfi
 0x000000000000003c  ? b    0x38 <save_boot_params_ret+12>
 0x0000000000000040  ? adr    x0, 0x0 <_start>
 0x0000000000000044  ? ldr    x1, 0x8 <_TEXT_BASE>
 0x0000000000000048  ? subs    x9, x0, x1
 0x000000000000004c  ? b.eq    0x84 <pie_fixup_done>  // b.none
─── Breakpoints ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── Expressions ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── History ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── Memory ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── Registers ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   x0 0x0000000000000000    x1 0x0000000000000000    x2 0x0000000000000000    x3 0x0000000000000000    x4 0x0000000000000000    x5 0x0000000000000000     x6 0x0000000000000000     x7 0x0000000000000000     x8 0x0000000000000000
   x9 0x0000000000000000   x10 0x0000000000000000   x11 0x0000000000000000   x12 0x0000000000000000   x13 0x0000000000000000   x14 0x0000000000000000    x15 0x0000000000000000    x16 0x0000000000000000    x17 0x0000000000000000
  x18 0x0000000000000000   x19 0x0000000000000000   x20 0x0000000000000000   x21 0x0000000000000000   x22 0x0000000000000000   x23 0x0000000000000000    x24 0x0000000000000000    x25 0x0000000000000000    x26 0x0000000000000000
  x27 0x0000000000000000   x28 0x0000000000000000   x29 0x0000000000000000   x30 0x0000000000000000    sp 0x0000000000000000    pc 0x0000000000000028   cpsr 0x400003c5           fpsr 0x00000000           fpcr 0x00000000        
─── Source ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 52  _bss_end_ofs:
 53      .quad    __bss_end - _start
 54  
 55  reset:
 56      /* Allow the board to save important registers */
 57      b    save_boot_params
 58  .globl    save_boot_params_ret
 59  save_boot_params_ret:
 60  
 61  #if CONFIG_POSITION_INDEPENDENT
─── Stack ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[0] from 0x0000000000000028 in reset at arch/arm/cpu/armv8/start.S:57
─── Threads ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[1] id 1 from 0x0000000000000028 in reset at arch/arm/cpu/armv8/start.S:57
─── Variables ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Quoted 1 line
Quoted 1 line
Quoted 1 line

I'm not sure whether it's your wanted or not.

Best Regards,
Jaehoon Chung

Quoted 97 lines
ckim@ckim-ubuntu:~/U-BOOT/u-boot$ readelf -S u-boot.elf
There are 5 section headers, starting at offset 0xc8950:

Section Headers:

  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .data             PROGBITS         0000000000000000  00010000
       00000000000b8850  0000000000000000  WA       0     0     1
  [ 2] .symtab           SYMTAB           0000000000000000  000c8850
       0000000000000090  0000000000000018           3     2     8
  [ 3] .strtab           STRTAB           0000000000000000  000c88e0
       0000000000000049  0000000000000000           0     0     1
  [ 4] .shstrtab         STRTAB           0000000000000000  000c8929
       0000000000000021  0000000000000000           0     0     1

Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info), L (link order), O (extra OS processing required), G (group), T (TLS), C (compressed), x (unknown), o (OS specific), E (exclude), p (processor specific)

And there are many configs including pattern "DEBUG" like CONFIG_DEBUG_UART_SANDBOX but it seems they are adding special debug features in the program behavior. What I want is to run the u-boot program itself in debug mode so that I can attach gdb and follow the program steps. (continue, step-in, step-out things..)

Any comment will be very much appreciated.
Thank you, and best regards,

Chan Kim

Quoted 62 lines

-----Original Message-----
From: Jaehoon Chung <[email protected]>
Sent: Tuesday, October 19, 2021 12:26 PM
To: Chan Kim <[email protected]>; U-Boot Mailing List <[email protected]>
Subject: Re: How to compile u-boot with debug option?

Quoted 10 lines · Chan Kim

Hello,

With these commands,

make ARCH=arm CROSS_COMPILE=aarch64-none-elf- qemu_arm64_defconfig

make ARCH=arm CROSS_COMPILE=aarch64-none-elf-

Quoted 7 lines

I see only u-boot.bin. How can I make u-boot.elf with debug info?

I found
https://protect2.fireeye.com/v1/url?k=126d5a6e-4df662a4-126cd121-0cc47
a31bee8-8e6c8ef0c2793943&q=1&e=4928b69d-166a-4647-b6c5-88bc2f73a780&u= https%3A%2F%2Flists.denx.de%2Fpipermail%2Fu-boot%2F2005-May%2F010240.h tml and tried adding

It's too old patch. It's not proper to current u-boot.

make ARCH=arm menucofig and check config relevant to DEBUG option.

Best Regards,
Jaehoon Chung

Quoted 9 lines
(quoted diff) +0 -2
-DDEBUG to CFLAGS_NON_EFI in arch/arm/config.mk and adding CFLAGS +=
-DDEBUG in arch/arm/cpu/armv8/config.mk

But after doing "make ARCH=arm CROSS_COMPILE=aarch64-none-elf- u-boot.elf", when I give file command for the u-boot.elf, it says

Quoted 7 lines

u-boot.elf: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, not stripped

I think I should see "with debug_info, not stripped". With connecting gdb, I can't see the source file. The run responds to 'continue' command

though.

Quoted 12 lines

Could any tell me what I can do?

Thank you,

Chan Kim

author
#4 lore raw

Hello Jaehoon,

I found 'u-boot' is the elf file containing the debug-info (while reading README.SPL) and found your email below while trying to send an update email. Yes, I don't have to make u-boot.elf but can just use 'u-boot' like you showed(I missed the generated file).
The gdb now can follow the code step by step.
Thank you for taking time for me.
Best regards,

Chan Kim

Quoted 250 lines

-----Original Message-----
From: Jaehoon Chung <[email protected]>
Sent: Tuesday, October 19, 2021 4:02 PM
To: Chan Kim <[email protected]>; 'U-Boot Mailing List' <u- [email protected]>
Subject: Re: How to compile u-boot with debug option?

Hi,

Quoted 4 lines · Chan Kim

Hello, Jaehoon and all,

I tried setting in menuconfig TOOLS_DEBUG but no change. It's strainge,

when I add "V=1" in the make command, I can see the commands run during the make. The cc command has -g options, a typical command being like this :

Quoted 2 lines

aarch64-none-elf-gcc -Wp,-MD,lib/.asm-offsets.s.d -nostdinc -isystem

/home/ckim/prj/abdsn/ab21cv/tools/cc_zeus/gcc-arm-9.2-2019.12-x86_64- aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/include -Iinclude -I./arch/arm/include -include ./include/linux/kconfig.h -D__KERNEL__ - D__UBOOT__ -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin - ffreestanding -std=gnu11 -fshort-wchar -fno-strict-aliasing -fno-PIE -Os - fno-stack-protector -fno-delete-null-pointer-checks -Wno-pointer-sign - Wno-stringop-truncation -Wno-array-bounds -Wno-stringop-overflow -Wno- maybe-uninitialized -fmacro-prefix-map=./= -g -fstack-usage -Wno-format- nonliteral -Wno-address-of-packed-member -Wno-unused-but-set-variable - Werror=date-time -Wno-packed-not-aligned -D__ARM__ -fno-pic -mstrict-align -ffunction-sections -fdata-sections -fno-common -ffixed-r9 -mgeneral-regs- only -fno-common -ffixed-x18 -pipe -march=armv8-a+crc -
D__LINUX_ARM_ARCH__=8 -DDO_DEPS_ONLY -DKBUILD_BASENAME='"asm_offsets"'
-DKBUILD_MODNAME='"asm_offsets"' -fverbose-asm -S -o lib/asm-offsets.s lib/asm-offsets.c

Quoted 3 lines

(you can see -g option near the middle place) I don't know why the final .elf file doesn't contain debuginfo.

Actually, i didn't run u-boot on qemu with gdb. But I followed the below step..

$make ARCH=arm64 qemu_arm64_defconfig
$make CROSS_COMPILE=aarch64-none-elf-

$qemu-system-aarch64 -curses -machine virt -cpu cortex-a57 -bios u- boot.bin -S -s $aarch64-none-elf-gdb u-boot -ex "target remote tcp::1234"

Then I can run u-boot step-by-step.

─── Output/messages
──────────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────────────────────────
─────────────────────────────────────────────────────────────
reset () at arch/arm/cpu/armv8/start.S:57
57		b	save_boot_params
─── Assembly
──────────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────────────
 0x0000000000000028  ? b    0x174 <save_boot_params>
 0x000000000000002c  ? adr    x0, 0x0 <_start>
 0x0000000000000030  ? ands    x0, x0, #0xfff
 0x0000000000000034  ? b.eq    0x40 <pie_fixup>  // b.none
 0x0000000000000038  ? wfi
 0x000000000000003c  ? b    0x38 <save_boot_params_ret+12>
 0x0000000000000040  ? adr    x0, 0x0 <_start>
 0x0000000000000044  ? ldr    x1, 0x8 <_TEXT_BASE>
 0x0000000000000048  ? subs    x9, x0, x1
 0x000000000000004c  ? b.eq    0x84 <pie_fixup_done>  // b.none
─── Breakpoints
──────────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────────────────────────
─────────────────────────────────────────────────────────────────
─── Expressions
──────────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────────────────────────
─────────────────────────────────────────────────────────────────
─── History
──────────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────────────────────────
─────────────────────────────────────────────────────────────────────
─── Memory
──────────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────────────────────
─── Registers
──────────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────
   x0 0x0000000000000000    x1 0x0000000000000000    x2 0x0000000000000000
x3 0x0000000000000000    x4 0x0000000000000000    x5 0x0000000000000000
x6 0x0000000000000000     x7 0x0000000000000000     x8 0x0000000000000000
   x9 0x0000000000000000   x10 0x0000000000000000   x11 0x0000000000000000
x12 0x0000000000000000   x13 0x0000000000000000   x14 0x0000000000000000
x15 0x0000000000000000    x16 0x0000000000000000    x17 0x0000000000000000
  x18 0x0000000000000000   x19 0x0000000000000000   x20 0x0000000000000000
x21 0x0000000000000000   x22 0x0000000000000000   x23 0x0000000000000000
x24 0x0000000000000000    x25 0x0000000000000000    x26 0x0000000000000000
  x27 0x0000000000000000   x28 0x0000000000000000   x29 0x0000000000000000
x30 0x0000000000000000    sp 0x0000000000000000    pc 0x0000000000000028
cpsr 0x400003c5           fpsr 0x00000000           fpcr 0x00000000
─── Source
──────────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────────────────────
 52  _bss_end_ofs:
 53      .quad    __bss_end - _start
 54
 55  reset:
 56      /* Allow the board to save important registers */
 57      b    save_boot_params
 58  .globl    save_boot_params_ret
 59  save_boot_params_ret:
 60
 61  #if CONFIG_POSITION_INDEPENDENT
─── Stack
──────────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────
[0] from 0x0000000000000028 in reset at arch/arm/cpu/armv8/start.S:57 ───
Threads
──────────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────
───────────────
[1] id 1 from 0x0000000000000028 in reset at arch/arm/cpu/armv8/start.S:57
─── Variables
──────────────────────────────────────────────────────────────────────────
──────────────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────
───────────────
────────────────────────────────────────────
────────────────────────────────────────────
────────────────────────────────────────────
────────────────────────────────────────────
────────────────────────────────────────────
─────────
Quoted 1 line
Quoted 1 line
Quoted 1 line

I'm not sure whether it's your wanted or not.

Best Regards,
Jaehoon Chung

Quoted 106 lines
ckim@ckim-ubuntu:~/U-BOOT/u-boot$ readelf -S u-boot.elf There are 5
section headers, starting at offset 0xc8950:

Section Headers:

  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .data             PROGBITS         0000000000000000  00010000
       00000000000b8850  0000000000000000  WA       0     0     1
  [ 2] .symtab           SYMTAB           0000000000000000  000c8850
       0000000000000090  0000000000000018           3     2     8
  [ 3] .strtab           STRTAB           0000000000000000  000c88e0
       0000000000000049  0000000000000000           0     0     1
  [ 4] .shstrtab         STRTAB           0000000000000000  000c8929
       0000000000000021  0000000000000000           0     0     1

Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info), L (link order), O (extra OS processing required), G (group), T (TLS), C (compressed), x (unknown), o (OS specific), E (exclude), p (processor specific)

And there are many configs including pattern "DEBUG" like CONFIG_DEBUG_UART_SANDBOX but it seems they are adding special debug features in the program behavior. What I want is to run the u-boot program itself in debug mode so that I can attach gdb and follow the program steps. (continue, step-in, step-out things..)

Any comment will be very much appreciated.
Thank you, and best regards,

Chan Kim

Quoted 67 lines

-----Original Message-----
From: Jaehoon Chung <[email protected]>
Sent: Tuesday, October 19, 2021 12:26 PM
To: Chan Kim <[email protected]>; U-Boot Mailing List <[email protected]>
Subject: Re: How to compile u-boot with debug option?

Quoted 12 lines · Chan Kim

Hello,

With these commands,

make ARCH=arm CROSS_COMPILE=aarch64-none-elf- qemu_arm64_defconfig

make ARCH=arm CROSS_COMPILE=aarch64-none-elf-

I see only u-boot.bin. How can I make u-boot.elf with debug info?

Quoted 8 lines

I found
https://protect2.fireeye.com/v1/url?k=126d5a6e-4df662a4-126cd121-0cc
47 a31bee8-8e6c8ef0c2793943&q=1&e=4928b69d-166a-4647-b6c5-88bc2f73a780& u= https%3A%2F%2Flists.denx.de%2Fpipermail%2Fu-boot%2F2005-May%2F010240 .h
tml and tried adding

It's too old patch. It's not proper to current u-boot.

make ARCH=arm menucofig and check config relevant to DEBUG option.

Best Regards,
Jaehoon Chung

Quoted 9 lines
(quoted diff) +0 -2
-DDEBUG to CFLAGS_NON_EFI in arch/arm/config.mk and adding CFLAGS +=
-DDEBUG in arch/arm/cpu/armv8/config.mk

But after doing "make ARCH=arm CROSS_COMPILE=aarch64-none-elf- u-boot.elf", when I give file command for the u-boot.elf, it says

Quoted 8 lines

u-boot.elf: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, not stripped

I think I should see "with debug_info, not stripped". With connecting gdb, I can't see the source file. The run responds to 'continue' command

though.

Quoted 12 lines

Could any tell me what I can do?

Thank you,

Chan Kim