概述:
本文描述了,如何添加STM32F407的Soc框架模拟代码。
板子截图:
添加步骤
1. 创建stm32f407_soc.h文件
在qemu源码下添加include/hw/arm/stm32f407_soc.h文件,在文件中主要添加如下成员:
#ifndef STM32F407_SOC_H
#define STM32F407_SOC_H
#include "hw/or-irq.h"
#include "hw/arm/armv7m.h"
#define TYPE_STM32F407_SOC "stm32f407-soc"
#define STM32F407_SOC(obj) \
OBJECT_CHECK(STM32F407State, (obj), TYPE_STM32F407_SOC)
typedef struct STM32F407State {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
char *kernel_filename;
char *cpu_type;
ARMv7MState armv7m;
} STM32F407State;
#endif
2. 创建stm32f407_soc.c文件
在qemu源码下添加hw/arm/stm32f407_soc.c文件,在文件中主要内容如下
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "qemu/osdep.h"
#include "qemu/module.h"
#include "hw/arm/boot.h"
#include "hw/qdev-properties.h"
#include "sysemu/sysemu.h"
#include "migration/vmstate.h"
#include "exec/address-spaces.h"