Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gdb "Load failed" with STM32F429I-DISCO #188

Closed
chrisdew opened this issue Oct 30, 2013 · 2 comments
Closed

gdb "Load failed" with STM32F429I-DISCO #188

chrisdew opened this issue Oct 30, 2013 · 2 comments

Comments

@chrisdew
Copy link
Contributor

I'm having a similar problem to #10 but that solution doesn't work for me. (I'm already using arm-none-eabi-gdb and connected to the stlink process.)

$ arm-none-eabi-gdb minimum-CM4.axf
GNU gdb (GNU Tools for ARM Embedded Processors) 7.4.1.20130913-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/chris/stm32/gcc-arm-none-eabi-4_7-2013q3/share/gcc-arm-none-eabi/samples/src/minimum/minimum-CM4.axf...done.
(gdb) target extended localhost:4242
Remote debugging using localhost:4242
0x080ec790 in ?? ()
(gdb) kill
Kill the program being debugged? (y or n) y
(gdb) load
Loading section .text, size 0x9c lma 0x0
Load failed
(gdb) 

I'm trying to make the program 'minimum' from gcc-arm-none-eabi-4_7-2013q3/share/gcc-arm-none-eabi/samples/src work.

I've altered the ../../nokeep.ld script to use the addresses and sizes I got from the STM32 datasheet. It now begins:

MEMORY
{
  FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 0x200000 
  RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x1C000 
}

I've also altered the ../makefile.conf to use CORTEX_M=4 instead of 3.

Where can I find more information on why the load is failing?

Thanks,

Chris.

P.S. Using readelf I noticed that several symbols are being put into very low addresses i.e. not those blocks which I've defined as FLASH or RAM.

Have I made a broken elf that will never install onto my board?

$ arm-none-eabi-readelf -a minimum-CM4.axf 
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x8000059
  Start of program headers:          52 (bytes into file)
  Start of section headers:          37280 (bytes into file)
  Flags:                             0x5000002, has entry point, Version5 EABI
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         1
  Size of section headers:           40 (bytes)
  Number of section headers:         16
  Section header string table index: 13

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        08000000 008000 00009c 00  AX  0   0  4
  [ 2] .stack_dummy      PROGBITS        20000000 0080a0 000c00 00      0   0  8
  [ 3] .debug_info       PROGBITS        00000000 008ca0 0000f6 00      0   0  1
  [ 4] .debug_abbrev     PROGBITS        00000000 008d96 000040 00      0   0  1
  [ 5] .debug_loc        PROGBITS        00000000 008dd6 000058 00      0   0  1
  [ 6] .debug_aranges    PROGBITS        00000000 008e30 000048 00      0   0  8
  [ 7] .debug_ranges     PROGBITS        00000000 008e78 000018 00      0   0  1
  [ 8] .debug_line       PROGBITS        00000000 008e90 0000b3 00      0   0  1
  [ 9] .debug_str        PROGBITS        00000000 008f43 0000d1 01  MS  0   0  1
  [10] .comment          PROGBITS        00000000 009014 000070 01  MS  0   0  1
  [11] .ARM.attributes   ARM_ATTRIBUTES  00000000 009084 00002a 00      0   0  1
  [12] .debug_frame      PROGBITS        00000000 0090b0 000040 00      0   0  4
  [13] .shstrtab         STRTAB          00000000 0090f0 0000ad 00      0   0  1
  [14] .symtab           SYMTAB          00000000 009420 000450 10     15  31  4
  [15] .strtab           STRTAB          00000000 009870 0002d4 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

There are no section groups in this file.

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x008000 0x08000000 0x08000000 0x0009c 0x0009c R E 0x8000

 Section to Segment mapping:
  Segment Sections...
   00     .text 

There is no dynamic section in this file.

There are no relocations in this file.

There are no unwind sections in this file.

Symbol table '.symtab' contains 69 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 08000000     0 SECTION LOCAL  DEFAULT    1 
     2: 20000000     0 SECTION LOCAL  DEFAULT    2 
     3: 00000000     0 SECTION LOCAL  DEFAULT    3 
     4: 00000000     0 SECTION LOCAL  DEFAULT    4 
     5: 00000000     0 SECTION LOCAL  DEFAULT    5 
     6: 00000000     0 SECTION LOCAL  DEFAULT    6 
     7: 00000000     0 SECTION LOCAL  DEFAULT    7 
     8: 00000000     0 SECTION LOCAL  DEFAULT    8 
     9: 00000000     0 SECTION LOCAL  DEFAULT    9 
    10: 00000000     0 SECTION LOCAL  DEFAULT   10 
    11: 00000000     0 SECTION LOCAL  DEFAULT   11 
    12: 00000000     0 SECTION LOCAL  DEFAULT   12 
    13: 20000000     0 NOTYPE  LOCAL  DEFAULT    2 $d
    14: 00000c00     0 NOTYPE  LOCAL  DEFAULT  ABS Stack_Size
    15: 00000000     0 NOTYPE  LOCAL  DEFAULT  ABS Heap_Size
    16: 08000000     0 NOTYPE  LOCAL  DEFAULT    1 $d
    17: 08000058     0 NOTYPE  LOCAL  DEFAULT    1 $t
    18: 08000084     0 NOTYPE  LOCAL  DEFAULT    1 $d
    19: 08000098     0 NOTYPE  LOCAL  DEFAULT    1 $t
    20: 00000034     0 NOTYPE  LOCAL  DEFAULT    6 $d
    21: 00000000     0 FILE    LOCAL  DEFAULT  ABS cc6mE6SD.ltrans0.o
    22: 08000044     0 NOTYPE  LOCAL  DEFAULT    1 $t
    23: 08000050     0 NOTYPE  LOCAL  DEFAULT    1 $t
    24: 00000010     0 NOTYPE  LOCAL  DEFAULT   12 $d
    25: 20000000     0 NOTYPE  LOCAL  DEFAULT    1 __fini_array_end
    26: 20000000     0 NOTYPE  LOCAL  DEFAULT    1 __fini_array_start
    27: 20000000     0 NOTYPE  LOCAL  DEFAULT    1 __init_array_end
    28: 20000000     0 NOTYPE  LOCAL  DEFAULT    1 __preinit_array_end
    29: 20000000     0 NOTYPE  LOCAL  DEFAULT    1 __init_array_start
    30: 20000000     0 NOTYPE  LOCAL  DEFAULT    1 __preinit_array_start
    31: 20000000     0 NOTYPE  GLOBAL DEFAULT    1 __HeapBase
    32: 08000099     2 FUNC    WEAK   DEFAULT    1 DebugMon_Handler
    33: 20000000     0 NOTYPE  GLOBAL DEFAULT    1 __data_start__
    34: 08000099     2 FUNC    WEAK   DEFAULT    1 HardFault_Handler
    35: 08000099     2 FUNC    WEAK   DEFAULT    1 SysTick_Handler
    36: 08000099     2 FUNC    WEAK   DEFAULT    1 PendSV_Handler
    37: 08000099     2 FUNC    WEAK   DEFAULT    1 NMI_Handler
    38: 0800009c     0 NOTYPE  GLOBAL DEFAULT  ABS __exidx_end
    39: 0800009c     0 NOTYPE  GLOBAL DEFAULT  ABS __etext
    40: 08000099     2 FUNC    WEAK   DEFAULT    1 UsageFault_Handler
    41: 20000000     0 NOTYPE  GLOBAL DEFAULT    1 __HeapLimit
    42: 20000000     0 NOTYPE  GLOBAL DEFAULT    1 __bss_start__
    43: 0800009c     0 NOTYPE  GLOBAL DEFAULT  ABS __exidx_start
    44: 08000059    64 FUNC    GLOBAL DEFAULT    1 Reset_Handler
    45: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __sf_fake_stderr
    46: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __deregister_frame_info
    47: 20000000     0 NOTYPE  GLOBAL DEFAULT    1 __data_end__
    48: 20000000     0 NOTYPE  GLOBAL DEFAULT    1 __bss_end__
    49: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __call_exitprocs
    50: 08000099     2 FUNC    WEAK   DEFAULT    1 Default_Handler
    51: 00000000     0 NOTYPE  WEAK   DEFAULT  UND software_init_hook
    52: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __sf_fake_stdin
    53: 08000099     2 FUNC    WEAK   DEFAULT    1 MemManage_Handler
    54: 08000000    68 NOTYPE  GLOBAL DEFAULT    1 __isr_vector
    55: 08000051     6 FUNC    GLOBAL DEFAULT    1 main
    56: 08000099     2 FUNC    WEAK   DEFAULT    1 SVC_Handler
    57: 00000000     0 NOTYPE  WEAK   DEFAULT  UND hardware_init_hook
    58: 20000000     0 NOTYPE  GLOBAL DEFAULT    1 __end__
    59: 08000045    10 FUNC    GLOBAL DEFAULT    1 SystemInit
    60: 2001c000     0 NOTYPE  GLOBAL DEFAULT  ABS __StackTop
    61: 08000099     2 FUNC    WEAK   DEFAULT    1 DEF_IRQHandler
    62: 2001c000     0 NOTYPE  GLOBAL DEFAULT  ABS __stack
    63: 2001b400  3072 NOTYPE  GLOBAL DEFAULT  ABS __StackLimit
    64: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __sf_fake_stdout
    65: 08000099     2 FUNC    WEAK   DEFAULT    1 BusFault_Handler
    66: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __do_register_exitproc
    67: 00000000     0 NOTYPE  WEAK   DEFAULT  UND _Jv_RegisterClasses
    68: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __register_frame_info

No version information found in this file.
Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "7E-M"
  Tag_CPU_arch: v7E-M
  Tag_CPU_arch_profile: Microcontroller
  Tag_THUMB_ISA_use: Thumb-2
  Tag_ABI_PCS_wchar_t: 4
  Tag_ABI_FP_denormal: Needed
  Tag_ABI_FP_exceptions: Needed
  Tag_ABI_FP_number_model: IEEE 754
  Tag_ABI_align_needed: 8-byte
  Tag_ABI_enum_size: small
  Tag_CPU_unaligned_access: v6
2013-10-30 08:32:54 chris@chris-thorcom:~/stm32/gcc-arm-none-eabi-4_7-2013q3/share/gcc-arm-none-eabi/samples/src/minimum 
@xor-gate
Copy link
Member

Closing due to inactivity of issuer, please test against latest tools in master or v1.2.0 (at time of writing). Feel free to open a new issue if the problem still exists.

@Nightwalker-87
Copy link
Member

Likely fixed in #251.

@Nightwalker-87 Nightwalker-87 modified the milestones: Feedback required, v1.2.0 and older Mar 28, 2020
@stlink-org stlink-org locked as resolved and limited conversation to collaborators Apr 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants