Re: Question ARM sim target and Cortex M

Luis Machado via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.