qemu中新建子目录 hw/test 编译注意事项

qemu中新建子目录 hw/test 编译注意事项

新建子目录hw/test中包含文件 meson.build \ Kconfig \ trace.h \ trce-events

meson.build

softmmu_ss.add(when: 'CONFIG_TEST_DEVICE', if_true: files('test_device.c'))

Kconfig

config TEST_DEVICE
    bool

trace.h

#include "trace/trace-hw_test.h"

trce-events

# test-device.c
test_read(uint32_t addr, uint32_t value) "read_addr 0x%08x value 0x%08x"
test_write(uint32_t addr, uint32_t value) "write_addr 0x%08x value 0x%08x"
  • 在平台所在目录的Kconfig文件中新增如下代码
config TEST_REF
    bool
    select TEST_DEVICE

hw/meson.build 中新增如下代码

subdir('test')

hw/Kconfig 中新增如下代码

source test/Kconfig
  • 新增trace
    /meson.build->trace_events_subdirs [中加 'hw/test' ,]
posted @ 2023-03-07 14:18  fifii0616  阅读(116)  评论(0)    收藏  举报