Hi,
I want to move a RISC-V model from hw/riscv directory to hw/uart
directory. The C file includes "target/riscv/cpu.h", but it fails to
compile:
include/exec/cpu-defs.h:23:2: error: #error cpu.h included from common code
#error cpu.h included from common code
^
In file included from include/exec/cpu-defs.h:29:0,
from target/riscv/cpu.h:25,
...
tcg/i386/tcg-target.h:140:42: error: attempt to use poisoned "TARGET_LONG_BITS"
#define TCG_TARGET_HAS_extrl_i64_i32 (TARGET_LONG_BITS == 32)
^
tcg/i386/tcg-target.h:141:42: error: attempt to use poisoned "TARGET_LONG_BITS"
#define TCG_TARGET_HAS_extrh_i64_i32 (TARGET_LONG_BITS == 32)
^
It seems to me that when building hw/char directory NEED_CPU_H is not
defined. However when building hw/riscv and hw/intc NEED_CPU_H is
defined. I see NEED_CPU_H is defined in c_args in meson.build:
c_args = ['-DNEED_CPU_H',
'-DCONFIG_TARGET="@[email protected]"'.format(target),
'-DCONFIG_DEVICES="@[email protected]"'.format(target)]
Currently codes in hw/riscv and hw/intc have the "target/riscv/cpu.h"
inclusion but they do build fine. This seems to me that c_args applies
to hw/riscv and hw/intc directory but not hw/char. I also tried other
directories like hw/dma and it didn't work either.
I have no clue where to control c_args to build sub-directories. Any
suggestions?
Regards,
Bin