添加自定义计算机时,QEMU中的分段错误(核心转储)

时间:2019-04-17 13:42:51

标签: c embedded stm32 qemu

我正在尝试在QEMU中为STM32机器构建自定义机器,并且编写了一个简单的代码将该机器添加到QEMU -machine help列表中。我还写了一个代码,可以在其中添加所有外围设备(通用文件/主文件)

但是,当我运行代码时,出现Segmentation fault (core dumped)错误。当我评论了某个部分时,我可以查明出现错误的位置:

static Property stm32f407_soc_properties[] = {
    DEFINE_PROP_STRING("cpu-type", struct stm32f407_soc,cpu_type),
    DEFINE_PROP_END_OF_LIST(),

};

获取CPU-type时出现错误。此外,当我通过GDB调试时,它提供了一些我不理解的信息:

(gdb) run -machine stm32f407ve_scu -kernel test.elf
Starting program: /usr/local/bin/qemu-system-arm -machine stm32f407ve_scu -kernel test.elf
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe7e4f700 (LWP 3487)]
[New Thread 0x7fffe764e700 (LWP 3490)]
[New Thread 0x7fffe69dc700 (LWP 3500)]
[New Thread 0x7fffe61db700 (LWP 3501)]

Thread 1 "qemu-system-arm" received signal SIGSEGV, Segmentation fault.
0x00005555557ea571 in cpu_get_address_space (cpu=0x0, asidx=1) at /home/sups/Documents/stm32/qemu/exec.c:930
930     return cpu->cpu_ases[asidx].as;
(gdb) where
#0  0x00005555557ea571 in cpu_get_address_space (cpu=0x0, asidx=1) at /home/sups/Documents/stm32/qemu/exec.c:930
#1  0x00005555559700c6 in armv7m_load_kernel (cpu=0x0, kernel_filename=0x5555568afa00 "test.elf", mem_size=2097152)
    at /home/sups/Documents/stm32/qemu/hw/arm/armv7m.c:297
#2  0x0000555555999e3e in stm32f407ve_scu_init (machine=0x555556783f00) at /home/sups/Documents/stm32/qemu/hw/arm/stm32f407ve_scu.c:57
#3  0x0000555555ae9ed9 in machine_run_board_init (machine=0x555556783f00) at hw/core/machine.c:830
#4  0x0000555555a40372 in main (argc=5, argv=0x7fffffffde98, envp=0x7fffffffdec8) at vl.c:4516

我打开了上面错误中提到的所有文件,并检查了错误所在的行,并且所有这些行均与机器调用相对应。但是我不知道该怎么改变?

有人可以帮助我吗? 谢谢。

0 个答案:

没有答案