【发布时间】:2019-04-03 11:55:05
【问题描述】:
我一直在尝试在 QEMU 中开发自定义机器:STM32F407。我已经编写了初始脚本来将机器名称添加到 QEMU 支持的机器列表中,当我们使用机器描述(如定义 SRAM、cpu-type 等)进行-machine help 时。我已将路径~/qemu/hw/arm中的文件添加为stm32f407ve_scu.c
我还在 makefile.objs 文件中添加了 obj-$(CONFIG_STM32F407VE_SCU) += stm32f407ve_scu.o 行。
.c 文件的代码如下:
struct stm32f407ve_scu {
DeviceState *soc;
struct arm_boot_info boot_info;
};
static void stm32f407ve_scu_init(MachineState *machine) { //create a space for the machine kernel
struct stm32f407ve_scu *s =g_new0(struct stm32f407ve_scu, 1);
if (!machine->kernel_filename){
fprintf(stderr," Guest image is missing (use -kernel)\n");
exit(1);
}
s->soc = qdev_create(NULL, "stm32f407-soc");
qdev_prop_set_string (s->soc, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m4")); // assign cortex-m4 as the processor
object_property_set_bool(OBJECT(s->soc), true, "realized", &error_fatal);
MemoryRegion *sram =g_new(MemoryRegion,1); //creates new memory region
memory_region_init_ram(sram, NULL, "scu.sram", 1024 * 1024 * 128, &error_fatal); // ram area defined with size
vmstate_register_ram_global(sram);
//loads kernel of maximum size 2MB
armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename, 2 * 1024 * 1024);
}
static void stm32f407ve_scu_machine_init(MachineClass *mc) //defines the machine init struct and description
{
mc->desc = "STM32F407 board with RAM";
mc->init = stm32f407ve_scu_init;
}
DEFINE_MACHINE("stm32f407ve_scu", stm32f407ve_scu_machine_init) //machine is defined with initialization clas
当我尝试配置和制作 QEMU 时,我没有收到任何错误,但不会生成 stm32f407ve_scu.o 和 stm32f407ve_scu.d。
为什么没有生成 .o 和 .d 文件?但是当我看到其他 .c 文件时,它们已经生成为 .o 和 .c 。
我在这里缺少什么?我像其他文件一样添加了所有头文件,并使用相同的语法来编写我的机器描述。
【问题讨论】:
-
请显示代码和/或说明错误。请不要使用图片链接。问题中缺少文本。图片上的文字太小,有些人看不懂。图像上的文本无法被搜索引擎索引以供将来的访问者使用。另见Why not upload images of code on SO when asking a question?
-
我实际上添加了图像而不是链接,我不知道为什么它显示错误。我会更新。感谢您指出。