public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Question ARM sim target and Cortex M
@ 2020-10-24  9:02 Fredrik Hederstierna
  2020-10-26 13:55 ` Luis Machado
  0 siblings, 1 reply; 2+ messages in thread
From: Fredrik Hederstierna @ 2020-10-24  9:02 UTC (permalink / raw)
  To: gdb

Hi,

I have a question about using ARM target simulator and bare metal Cortex M elf.

I tried to start my arm-none-eabi with my program:

$ arm-none-eabi-gdb myprog.elf
...
(gdb) target sim
Connected to the simulator.
(gdb) load
Loading section .text, size 0x549f0 lma 0x2800
Loading section .data, size 0x934 lma 0x571f0
Loading section .ARM.exidx, size 0x8 lma 0x57b24
Start address 0x28ff
Transfer rate: 2791776 bits in <1 sec.
(gdb) run
Starting program: /home/fredrik/build/myprog.elf 
Unknown machine type '22'; please update sim_create_inferior.
[Inferior 1 (process 42000) exited normally]
(gdb) 

Looking in <sim/arm/wrapper.c> I see missing handling alot of newer targets > arm_5?
Looking in <bfd/bfd-in2.h>:

bfd/bfd-in2.h:#define bfd_mach_arm_5TEJ      14
bfd/bfd-in2.h:#define bfd_mach_arm_6         15
bfd/bfd-in2.h:#define bfd_mach_arm_6KZ       16
bfd/bfd-in2.h:#define bfd_mach_arm_6T2       17
bfd/bfd-in2.h:#define bfd_mach_arm_6K        18
bfd/bfd-in2.h:#define bfd_mach_arm_7         19
bfd/bfd-in2.h:#define bfd_mach_arm_6M        20
bfd/bfd-in2.h:#define bfd_mach_arm_6SM       21
bfd/bfd-in2.h:#define bfd_mach_arm_7EM       22
bfd/bfd-in2.h:#define bfd_mach_arm_8         23
bfd/bfd-in2.h:#define bfd_mach_arm_8R        24
bfd/bfd-in2.h:#define bfd_mach_arm_8M_BASE   25
bfd/bfd-in2.h:#define bfd_mach_arm_8M_MAIN   26
bfd/bfd-in2.h:#define bfd_mach_arm_8_1M_MAIN 27

My target is Cortex-M4 so its ID '22' meaning <bfd_mach_arm_7EM>,
cannot I run Cortex-M4 in target simulator, or what do I do wrong here?
Are there more targets that could be added in eg <sim/arm/wrapper.c>, or am I looking in the wrong place?

Thanks! BR Fredrik

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Question ARM sim target and Cortex M
  2020-10-24  9:02 Question ARM sim target and Cortex M Fredrik Hederstierna
@ 2020-10-26 13:55 ` Luis Machado
  0 siblings, 0 replies; 2+ messages in thread
From: Luis Machado @ 2020-10-26 13:55 UTC (permalink / raw)
  To: Fredrik Hederstierna, gdb

Hi Fredrik,

On 10/24/20 6:02 AM, Fredrik Hederstierna via Gdb wrote:
> Hi,
> 
> I have a question about using ARM target simulator and bare metal Cortex M elf.
> 
> I tried to start my arm-none-eabi with my program:
> 
> $ arm-none-eabi-gdb myprog.elf
> ...
> (gdb) target sim
> Connected to the simulator.
> (gdb) load
> Loading section .text, size 0x549f0 lma 0x2800
> Loading section .data, size 0x934 lma 0x571f0
> Loading section .ARM.exidx, size 0x8 lma 0x57b24
> Start address 0x28ff
> Transfer rate: 2791776 bits in <1 sec.
> (gdb) run
> Starting program: /home/fredrik/build/myprog.elf
> Unknown machine type '22'; please update sim_create_inferior.
> [Inferior 1 (process 42000) exited normally]
> (gdb)
> 
> Looking in <sim/arm/wrapper.c> I see missing handling alot of newer targets > arm_5?
> Looking in <bfd/bfd-in2.h>:
> 
> bfd/bfd-in2.h:#define bfd_mach_arm_5TEJ      14
> bfd/bfd-in2.h:#define bfd_mach_arm_6         15
> bfd/bfd-in2.h:#define bfd_mach_arm_6KZ       16
> bfd/bfd-in2.h:#define bfd_mach_arm_6T2       17
> bfd/bfd-in2.h:#define bfd_mach_arm_6K        18
> bfd/bfd-in2.h:#define bfd_mach_arm_7         19
> bfd/bfd-in2.h:#define bfd_mach_arm_6M        20
> bfd/bfd-in2.h:#define bfd_mach_arm_6SM       21
> bfd/bfd-in2.h:#define bfd_mach_arm_7EM       22
> bfd/bfd-in2.h:#define bfd_mach_arm_8         23
> bfd/bfd-in2.h:#define bfd_mach_arm_8R        24
> bfd/bfd-in2.h:#define bfd_mach_arm_8M_BASE   25
> bfd/bfd-in2.h:#define bfd_mach_arm_8M_MAIN   26
> bfd/bfd-in2.h:#define bfd_mach_arm_8_1M_MAIN 27
> 
> My target is Cortex-M4 so its ID '22' meaning <bfd_mach_arm_7EM>,
> cannot I run Cortex-M4 in target simulator, or what do I do wrong here?
> Are there more targets that could be added in eg <sim/arm/wrapper.c>, or am I looking in the wrong place?
> 
> Thanks! BR Fredrik
> 

Overall, the ARM/AArch64 sim targets should not be considered up-to-date 
nor complete. In fact, I think they are fairly outdated and shouldn't be 
considered for any serious simulator-based work/testing. Only casual 
trivial testing.

I'd recommend QEMU instead, which is much better supported in terms of 
features.

Of course, folks are welcome to update the sim targets.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-26 13:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-24  9:02 Question ARM sim target and Cortex M Fredrik Hederstierna
2020-10-26 13:55 ` Luis Machado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).