Liu Jaloo <liu.ja...@gmail.com> writes: > in qemu branch statble-9.2 > > $ ./build/qemu-system-arm -M microbit -device > loader,file=/path/to/heart-hearts-makecode.hex > > Segmentation fault
Is it really a hex file? The code in question is generic_loader_realize() and it falls back through a series of steps: if (s->file) { AddressSpace *as = s->cpu ? s->cpu->as : NULL; if (!s->force_raw) { size = load_elf_as(s->file, NULL, NULL, NULL, &entry, NULL, NULL, NULL, big_endian, 0, 0, 0, as); if (size < 0) { size = load_uimage_as(s->file, &entry, NULL, NULL, NULL, NULL, as); } if (size < 0) { size = load_targphys_hex_as(s->file, &entry, as); } } > > > about the error, gdb backtrace like this: > > bash-5.1$ gdb ./build/qemu-system-arm > GNU gdb (GDB) 11.2 > Copyright (C) 2022 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 "x86_64-slackware-linux". > Type "show configuration" for configuration details. > For bug reporting instructions, please see: > <https://www.gnu.org/software/gdb/bugs/>. > Find the GDB manual and other documentation resources online at: > <http://www.gnu.org/software/gdb/documentation/>. > > For help, type "help". > Type "apropos word" to search for commands related to "word"... > Reading symbols from ./build/qemu-system-arm... > warning: File "/home/jaloo/slackware/qemu/qemu/.gdbinit" auto-loading has > been declined by your `auto-load safe-path' > set to "$debugdir:$datadir/auto-load". > To enable execution of this file add > add-auto-load-safe-path /home/jaloo/slackware/qemu/qemu/.gdbinit > line to your configuration file "/home/jaloo/.config/gdb/gdbinit". > To completely disable this security protection add > set auto-load safe-path / > line to your configuration file "/home/jaloo/.config/gdb/gdbinit". > For more information about this security protection see the > --Type <RET> for more, q to quit, c to continue without paging-- > "Auto-loading safe path" section in the GDB manual. E.g., run from the > shell: > info "(gdb)Auto-loading safe path" > (gdb) r -M microbit -device loader,file=../microbit/heart-hearts-makecode.hex > Starting program: /home/jaloo/slackware/qemu/qemu/build/qemu-system-arm -M > microbit -device > loader,file=../microbit/heart-hearts-makecode.hex > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/lib64/libthread_db.so.1". > [New Thread 0x7ffff228d640 (LWP 2380)] > [New Thread 0x7ffff190a640 (LWP 2382)] > > Thread 1 "qemu-system-arm" received signal SIGSEGV, Segmentation fault. > 0x00007ffff60e53d1 in __memmove_avx_unaligned_erms () from /lib64/libc.so.6 > (gdb) bt > #0 0x00007ffff60e53d1 in __memmove_avx_unaligned_erms () at /lib64/libc.so.6 > #1 0x0000555556037ed9 in address_space_write_rom_internal > (as=0x555557afe160, addr=0, attrs=..., ptr=0x555557de8290, len=1313804, > type=WRITE_DATA) at . > ./system/physmem.c:3040 > #2 0x0000555556037fa7 in address_space_write_rom > (as=0x555557afe160, addr=0, attrs=..., buf=0x555557de8290, len=1313804) > at ../system/physmem.c:3060 > #3 0x0000555555977704 in rom_reset (unused=0x0) at ../hw/core/loader.c:1252 > #4 0x0000555555986644 in legacy_reset_hold > (obj=0x5555576c12c0, type=RESET_TYPE_COLD) at ../hw/core/reset.c:76 > #5 0x00005555560a3938 in resettable_phase_hold > (obj=0x5555576c12c0, opaque=0x0, type=RESET_TYPE_COLD) > at ../hw/core/resettable.c:162 > #6 0x00005555560a2049 in resettable_container_child_foreach > (obj=0x555557a2a9f0, cb=0x5555560a3820 <resettable_phase_hold>, > opaque=0x0, type=RESET_TYPE_COLD) at . > ./hw/core/resetcontainer.c:54 > #7 0x00005555560a3687 in resettable_child_foreach > (rc=0x5555578ced10, obj=0x555557a2a9f0, cb=0x5555560a3820 > <resettable_phase_hold>, opaque=0x0, > type=RESET_TYPE_COLD) at ../hw/core/resettable.c:92 > #8 0x00005555560a38dd in resettable_phase_hold > (obj=0x555557a2a9f0, opaque=0x0, type=RESET_TYPE_COLD) > at ../hw/core/resettable.c:155 > #9 0x00005555560a353c in resettable_assert_reset > --Type <RET> for more, q to quit, c to continue without paging-- > (obj=0x555557a2a9f0, type=RESET_TYPE_COLD) at ../hw/core/resettable.c:58 > #10 0x00005555560a3494 in resettable_reset > (obj=0x555557a2a9f0, type=RESET_TYPE_COLD) at ../hw/core/resettable.c:45 > #11 0x000055555598696e in qemu_devices_reset (type=RESET_TYPE_COLD) > at ../hw/core/reset.c:176 > #12 0x0000555555cf5826 in qemu_system_reset (reason=SHUTDOWN_CAUSE_NONE) > at ../system/runstate.c:527 > #13 0x000055555597fb9d in qdev_machine_creation_done () > at ../hw/core/machine.c:1689 > #14 0x0000555555cfd197 in qemu_machine_creation_done > (errp=0x5555575be0e0 <error_fatal>) at ../system/vl.c:2690 > #15 0x0000555555cfd30f in qmp_x_exit_preconfig > (errp=0x5555575be0e0 <error_fatal>) at ../system/vl.c:2720 > #16 0x0000555555cffce8 in qemu_init (argc=5, argv=0x7fffffffdd08) > at ../system/vl.c:3753 > #17 0x00005555562479f0 in main (argc=5, argv=0x7fffffffdd08) > at ../system/main.c:47 > > according to docs/system/arm/nrf.rst > > $ qemu-system-arm -M microbit -device loader,file=test.hex > > from the page https://microbit.org/projects/make-it-code-it/heart/ download > the hex file : > > wget https://microbit.org/downloads/heart-hearts-makecode.hex Hmm it looks like its crashing after it loaded. But did it get to load_targphys_hex_as? -- Alex Bennée Virtualisation Tech Lead @ Linaro