Error not a valid device model name in Qemu - virtualization

I am trying to add a custom device in Qemu source code.
Below are the steps which I followed to add a device in Qemu source code:
Go to directory where qemu is installed
Then
created a custom device file in hw/misc/.c
created a entry in qemu/hw/misc/Makefile.objs
created a entry in qemu/config-all-devices.mak
created a entry in qemu/arm-softmmu/config-devices.mak
created a entry in qemu/arm-softmmu/config-devices.mak.old
After I run below two commands
sudo make CFLAGS="-Wno-error"
sudo make install
Then I run qemu with my custom device
Below is the script to run qemu
#!/bin/bash
KERNEL="/lhome/priyamvad/debian_qemu_arm32/vmlinuz-3.16.0-6-armmp-lpae"
INIT_IMAGE="/lhome/priyamvad/debian_qemu_arm32/initrd.img-3.16.0-6-armmp-lpae"
DISK="/lhome/priyamvad/debian_qemu_arm32/hda30.qcow2"
/lhome/priyamvad/arm_qemu_Setup/qemu/arm-softmmu/qemu-system-arm \
-M virt \
-m 1024 \
-smp 4 \
-kernel $KERNEL \
-object rng-random,filename=/dev/urandom,id=rng0 \
-device virtio-rng-device,rng=rng0 \
-initrd $INIT_IMAGE \
-append 'root=/dev/vda2' \
-drive if=none,file=$DISK,format=qcow2,id=hd \
**-device hello-world-device** \
-device virtio-blk-device,drive=hd \
-device virtio-net-device,netdev=usernet \
-netdev user,id=usernet,hostfwd=tcp::2222-:22 \
-nographic
When I run above script, I get following error:
ERROR:
qemu-system-arm: -device hello-world-device: 'hello-world-device' is
not a valid device model name
So what i am missing in above steps?

You're trying to edit some files which are autogenerated by the configure and make process, so when you run make your changes will be overwritten again: config-devices.mak, config-devices.mak.old and config-all-devices.mak are all autogenerated.
The place you want to put your new CONFIG_HELLO_DEVICE=y is in default-configs/arm-softmmu.mak. Then hw/misc/Makefile.objs can use it in a line like "common-obj-$(CONFIG_HELLO_DEVICE) += hello.o".
Check that your source file is actually getting compiled and linked into the QEMU binary when you run make. If it is, then the problem is something in your C sources; if it is not, then you haven't got your makefile/default-configs stuff right.
Some extra advice:
sudo make CFLAGS="-Wno-error" sudo make install
is a really bad way to do "compile QEMU for testing":
it's running the whole make process as root unnecessarily
it's doing an install, which you don't need to do to just run the QEMU binary you've built for testing
you're overriding the default "warnings are errors" setting, which is just hiding bugs in your code you need to fix (and if you really do need to do this for some reason, it's the wrong way to do it: there is a configure --disable-werror option)
it's doing a build in the source directory, which means that autogenerated files from the build get mixed in with the source files. This is why you got confused and tried to edit the autogenerated config-devices.mak files I think.
Upstream QEMU strongly recommends doing a build in a separate build directory (I give some plausible configure options but use what you want):
mkdir build
(cd build && ../configure --target-list=arm-softmmu --enable-debug)
make -j8 -C build
(You will need to do a 'distclean' on your current source tree to get rid of the results of the build-in-source-tree or just throw it away and start again to get to a clean state that you can then do an out-of-tree build from.)
Once you've done 'make' you can simply run the built qemu binary directly as ./build/arm-softmmu/qemu-system-arm.

I have tried the method you suggested for adding custom device to Qemu(arm-32bit) source code but it give following errors:
Added entry for my device in following file hw/misc/Makefile.objs and default-configs/arm-softmmu.mak
Run make by giving below commands
make distclean
make -j8 -C build
I am attaching below image to show output containing error
qemu-system-arm build error
After checking the output shown by above image, I created a file "config-devices.mak" in build/arm-softmmu.
I once again run commands described in step 2.
I get following output and error show below.
ERROR
ar: creating libfdt/libfdt.a
ar: creating /lhome/priyamvad/debian_qemu_arm32_updated/qemu/build/capstone/libcapstone.a
In file included from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/hw/misc/testpci.c:19:
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/hw/hw.h:8:20: error: expected \u2018=\u2019, \u2018,\u2019, \u2018;\u2019, \u2018asm\u2019 or \u2018__attribute__\u2019 before \u2018hw_error\u2019
void QEMU_NORETURN hw_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
^~~~~~~~
In file included from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:7,
from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/memory.h:19,
from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/hw/pci/pci.h:4,
from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/hw/misc/testpci.c:20:
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/hwaddr.h:11:9: error: unknown type name \u2018uint64_t\u2019
typedef uint64_t hwaddr;
^~~~~~~~
In file included from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/memory.h:19,
from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/hw/pci/pci.h:4,
from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/hw/misc/testpci.c:20:
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:15:28: error: unknown type name \u2018CPUState\u2019
void tcg_flush_softmmu_tlb(CPUState *cs);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:37:9: error: unknown type name \u2018uintptr_t\u2019
typedef uintptr_t ram_addr_t;
^~~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:46:60: error: unknown type name \u2018uint32_t\u2019
typedef void CPUWriteMemoryFunc(void *opaque, hwaddr addr, uint32_t value);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:47:9: error: unknown type name \u2018uint32_t\u2019
typedef uint32_t CPUReadMemoryFunc(void *opaque, hwaddr addr);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:52:1: error: unknown type name \u2018RAMBlock\u2019
RAMBlock *qemu_ram_block_by_name(const char *name);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:53:1: error: unknown type name \u2018RAMBlock\u2019
RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:53:47: error: unknown type name \u2018bool\u2019; did you mean \u2018_Bool\u2019?
RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
^~~~
_Bool
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:55:39: error: unknown type name \u2018RAMBlock\u2019
ram_addr_t qemu_ram_block_host_offset(RAMBlock *rb, void *host);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:56:25: error: unknown type name \u2018RAMBlock\u2019
void qemu_ram_set_idstr(RAMBlock *block, const char *name, DeviceState *dev);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:56:60: error: unknown type name \u2018DeviceState\u2019
void qemu_ram_set_idstr(RAMBlock *block, const char *name, DeviceState *dev);
^~~~~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:57:27: error: unknown type name \u2018RAMBlock\u2019
void qemu_ram_unset_idstr(RAMBlock *block);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:58:32: error: unknown type name \u2018RAMBlock\u2019
const char *qemu_ram_get_idstr(RAMBlock *rb);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:59:30: error: unknown type name \u2018RAMBlock\u2019
void *qemu_ram_get_host_addr(RAMBlock *rb);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:60:32: error: unknown type name \u2018RAMBlock\u2019
ram_addr_t qemu_ram_get_offset(RAMBlock *rb);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:61:37: error: unknown type name \u2018RAMBlock\u2019
ram_addr_t qemu_ram_get_used_length(RAMBlock *rb);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:62:1: error: unknown type name \u2018bool\u2019; did you mean \u2018_Bool\u2019?
bool qemu_ram_is_shared(RAMBlock *rb);
^~~~
_Bool
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:62:25: error: unknown type name \u2018RAMBlock\u2019
bool qemu_ram_is_shared(RAMBlock *rb);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:63:1: error: unknown type name \u2018bool\u2019; did you mean \u2018_Bool\u2019?
bool qemu_ram_is_uf_zeroable(RAMBlock *rb);
^~~~
_Bool
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:63:30: error: unknown type name \u2018RAMBlock\u2019
bool qemu_ram_is_uf_zeroable(RAMBlock *rb);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:64:31: error: unknown type name \u2018RAMBlock\u2019
void qemu_ram_set_uf_zeroable(RAMBlock *rb);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:65:1: error: unknown type name \u2018bool\u2019; did you mean \u2018_Bool\u2019?
bool qemu_ram_is_migratable(RAMBlock *rb);
^~~~
_Bool
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:65:29: error: unknown type name \u2018RAMBlock\u2019
bool qemu_ram_is_migratable(RAMBlock *rb);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:66:30: error: unknown type name \u2018RAMBlock\u2019
void qemu_ram_set_migratable(RAMBlock *rb);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:67:32: error: unknown type name \u2018RAMBlock\u2019
void qemu_ram_unset_migratable(RAMBlock *rb);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:69:1: error: unknown type name \u2018size_t\u2019
size_t qemu_ram_pagesize(RAMBlock *block);
^~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:69:1: note: \u2018size_t\u2019 is defined in header \u2018\u2019; did you forget to \u2018#include \u2019?
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:8:1:
+#include
#endif
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:69:1:
size_t qemu_ram_pagesize(RAMBlock *block);
^~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:69:26: error: unknown type name \u2018RAMBlock\u2019
size_t qemu_ram_pagesize(RAMBlock *block);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:70:1: error: unknown type name \u2018size_t\u2019
size_t qemu_ram_pagesize_largest(void);
^~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:70:1: note: \u2018size_t\u2019 is defined in header \u2018\u2019; did you forget to \u2018#include \u2019?
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:72:42: error: unknown type name \u2018uint8_t\u2019
void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
^~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h: In function \u2018cpu_physical_memory_read\u2019:
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:77:5: error: implicit declaration of function \u2018cpu_physical_memory_rw\u2019; did you mean \u2018cpu_physical_memory_read\u2019? [-Werror=implicit-function-declaration]
cpu_physical_memory_rw(addr, buf, len, 0);
^~~~~~~~~~~~~~~~~~~~~~
cpu_physical_memory_read
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:77:5: error: nested extern declaration of \u2018cpu_physical_memory_rw\u2019 [-Werror=nested-externs]
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h: At top level:
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:89:30: error: unknown type name \u2018QEMUBH\u2019; did you mean \u2018QEMU_HW_H\u2019?
void cpu_register_map_client(QEMUBH *bh);
^~~~~~
QEMU_HW_H
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:90:32: error: unknown type name \u2018QEMUBH\u2019; did you mean \u2018QEMU_HW_H\u2019?
void cpu_unregister_map_client(QEMUBH *bh);
^~~~~~
QEMU_HW_H
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:92:1: error: unknown type name \u2018bool\u2019; did you mean \u2018_Bool\u2019?
bool cpu_physical_memory_is_io(hwaddr phys_addr);
^~~~
_Bool
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:103:32: error: unknown type name \u2018RAMBlock\u2019
typedef int (RAMBlockIterFunc)(RAMBlock *rb, void *opaque);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:105:28: error: unknown type name \u2018RAMBlockIterFunc\u2019
int qemu_ram_foreach_block(RAMBlockIterFunc func, void *opaque);
^~~~~~~~~~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:106:29: error: unknown type name \u2018RAMBlock\u2019
int ram_block_discard_range(RAMBlock *rb, uint64_t start, size_t length);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:106:43: error: unknown type name \u2018uint64_t\u2019
int ram_block_discard_range(RAMBlock *rb, uint64_t start, size_t length);
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:106:59: error: unknown type name \u2018size_t\u2019
int ram_block_discard_range(RAMBlock *rb, uint64_t start, size_t length);
^~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/cpu-common.h:106:59: note: \u2018size_t\u2019 is defined in header \u2018\u2019; did you forget to \u2018#include \u2019?
In file included from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/memory.h:21,
from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/hw/pci/pci.h:4,
from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/hw/misc/testpci.c:20:
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/memattrs.h:69:9: error: unknown type name \u2018uint32_t\u2019
typedef uint32_t MemTxResult;
^~~~~~~~
In file included from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:4,
from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/host-utils.h:29,
from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/memop.h:15,
from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/memory.h:22,
from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/hw/pci/pci.h:4,
from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/hw/misc/testpci.c:20:
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/fpu/softfloat-types.h:87:9: error: unknown type name \u2018uint8_t\u2019
typedef uint8_t flag;
^~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/fpu/softfloat-types.h:93:9: error: unknown type name \u2018uint16_t\u2019
typedef uint16_t float16;
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/fpu/softfloat-types.h:94:9: error: unknown type name \u2018uint32_t\u2019
typedef uint32_t float32;
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/fpu/softfloat-types.h:95:9: error: unknown type name \u2018uint64_t\u2019
typedef uint64_t float64;
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/fpu/softfloat-types.h:106:5: error: unknown type name \u2018uint64_t\u2019
uint64_t low;
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/fpu/softfloat-types.h:107:5: error: unknown type name \u2018uint16_t\u2019
uint16_t high;
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/fpu/softfloat-types.h:115:5: error: unknown type name \u2018uint64_t\u2019
uint64_t low, high;
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/fpu/softfloat-types.h:169:5: error: unknown type name \u2018uint8_t\u2019
uint8_t float_exception_flags;
^~~~~~~
In file included from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/host-utils.h:29,
from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/memop.h:15,
from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/exec/memory.h:22,
from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/hw/pci/pci.h:4,
from /lhome/priyamvad/debian_qemu_arm32_updated/qemu/hw/misc/testpci.c:20:
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:29:15: error: unknown type name \u2018uint16_t\u2019
static inline uint16_t bswap16(uint16_t x)
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:29:32: error: unknown type name \u2018uint16_t\u2019
static inline uint16_t bswap16(uint16_t x)
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:35:15: error: unknown type name \u2018uint32_t\u2019
static inline uint32_t bswap32(uint32_t x)
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:35:32: error: unknown type name \u2018uint32_t\u2019
static inline uint32_t bswap32(uint32_t x)
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:43:15: error: unknown type name \u2018uint64_t\u2019
static inline uint64_t bswap64(uint64_t x)
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:43:32: error: unknown type name \u2018uint64_t\u2019
static inline uint64_t bswap64(uint64_t x)
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:56:29: error: unknown type name \u2018uint16_t\u2019
static inline void bswap16s(uint16_t *s)
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:61:29: error: unknown type name \u2018uint32_t\u2019
static inline void bswap32s(uint32_t *s)
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:66:29: error: unknown type name \u2018uint64_t\u2019
static inline void bswap64s(uint64_t *s)
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:162:21: error: unknown type name \u2018uint16_t\u2019
CPU_CONVERT(be, 16, uint16_t)
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:142:15: note: in definition of macro \u2018CPU_CONVERT\u2019
static inline type endian ## size ## _to_cpu(type v)\
^~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:162:21: error: unknown type name \u2018uint16_t\u2019
CPU_CONVERT(be, 16, uint16_t)
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:142:46: note: in definition of macro \u2018CPU_CONVERT\u2019
static inline type endian ## size ## _to_cpu(type v)\
^~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:162:21: error: unknown type name \u2018uint16_t\u2019
CPU_CONVERT(be, 16, uint16_t)
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:147:15: note: in definition of macro \u2018CPU_CONVERT\u2019
static inline type cpu_to_ ## endian ## size(type v)\
^~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:162:21: error: unknown type name \u2018uint16_t\u2019
CPU_CONVERT(be, 16, uint16_t)
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:147:46: note: in definition of macro \u2018CPU_CONVERT\u2019
static inline type cpu_to_ ## endian ## size(type v)\
^~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:162:21: error: unknown type name \u2018uint16_t\u2019
CPU_CONVERT(be, 16, uint16_t)
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:152:47: note: in definition of macro \u2018CPU_CONVERT\u2019
static inline void endian ## size ## _to_cpus(type *p)\
^~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:162:21: error: unknown type name \u2018uint16_t\u2019
CPU_CONVERT(be, 16, uint16_t)
^~~~~~~~
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/include/qemu/bswap.h:157:51: note: in definition of macro \u2018CPU_CONVERT\u2019
static inline void cpu_to_ ## endian ## size ## s(type *p)\
Are the above errors due to bugs in qemu source code or I am doing something nasty?
Some description about my work
Creating a custom device in Qemu.
Creating a device driver to test custom device.
I have created custom device and now I want to run my custom device on Qemu
Qemu is imitating ARM(32 bit) hardware and running debian on it.
Is it necessary to create device driver for custom device or it can be tested by a user application ?
Code of files used
custom device source file
custom device
Makefile.objs source file
Makefile.objs
config-device.mak souce file
config-device.mak

Related

The name of the enclosing class is 'MultipartRequestMultipartFile'

package:http/src/multipart_file.dart: Context: The name of the enclosing class is 'MultipartRequestMultipartFile'.
../…/src/multipart_file.dart:1
: Error: Type 'MultipartFile' not found.
../…/src/multipart_file.dart:92
static Future<MultipartFile> fromPath(String field, String filePath,
^^^^^^^^^^^^^
: Error: Type 'MultipartFile' not found.
../…/src/multipart_request.dart:133
String _headerForFile(MultipartFile file) {
^^^^^^^^^^^^^
: Error: Type 'MultipartFile' not found.
../…/src/multipart_file_io.dart:13
Future<MultipartFile> multipartFileFromPath(String field, String filePath,
^^^^^^^^^^^^^
: Error: 'MultipartFile' isn't a type.
../…/src/multipart_request.dart:46
final files = <MultipartFile>[];
^^^^^^^^^^^^^
: Error: Method not found: 'MultipartFile'.
../…/src/multipart_file.dart:63
return MultipartFile(field, stream, value.length,
^^^^^^^^^^^^^
: Error: Undefined name 'MultipartFile'.
../…/src/multipart_file.dart:79
return MultipartFile.fromBytes(field, encoding.encode(value),
^^^^^^^^^^^^^
: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
../…/src/multipart_request.dart:67
length += '--'.length +
^
: Error: 'MultipartFile' isn't a type.
../…/src/multipart_request.dart:133
String _headerForFile(MultipartFile file) {
^^^^^^^^^^^^^
: Error: Method not found: 'MultipartFile'.
../…/src/multipart_file_io.dart:19
return MultipartFile(field, stream, length,
^^^^^^^^^^^^^
Failed to package /Users/bookwarm/Programming/Flutter/chatApp.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
/Users/bookwarm/Programming/Flutter/chatApp/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'libPhoneNumber-iOS' from project 'Pods')
Result bundle written to path:
/var/folders/cz/5ph142ld41dfggj5brlf41h00000gn/T/flutter_tools.E4o277/flutter_ios_build_temp_dirVbiyqD/temporary_xcresult_bundle
just delete
/Users/xxxxxxx/development/tools/flutter/.pub-cache/hosted/pub.dartlang.org/
and run flutter packages get again on your project.

Failed to build LibcOverlayShims.h

I am attempting to build a framework that I just ported some code from Objective C to Swift in, and I'm getting this error:
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "LibcOverlayShims.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/lib/swift/shims/LibcOverlayShims.h:80:15: error: declaration of 'sem_t' must be imported from module 'Darwin.sys.semaphore' before it is required
static inline sem_t *_stdlib_sem_open2(const char *name, int oflag) {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/sys/semaphore.h:43:13: note: declaration here is not visible
typedef int sem_t;
^
<unknown>:0: error: could not build Objective-C module 'SwiftOverlayShims'
The error is happening because of this one file:
https://github.com/losnoco/Cog/blob/swiftingly/Audio/Visualization/VisualizationController.swift
What am I doing wrong?

LLDB fails to examine global variables

A global var is defined in my framework
var showersInProgress: [ProgressShower] = []
It's global so that I can stop the program
and hopefully examine the state like so:
(lldb) po showersInProgress
error: <user expression 7>:1:1: use of undeclared identifier 'showersInProgress'
showersInProgress
(lldb) p showersInProgress
error: <user expression 8>:1:1: use of undeclared identifier 'showersInProgress'
showersInProgress
(lldb) frame variable showersInProgress
(lldb) frame showersInProgress
invalid command 'frame showersInProgress'.
(lldb) frame -g showersInProgress
invalid command 'frame -g'.
(lldb) frame -g variable showersInProgress
invalid command 'frame -g'.
(lldb) frame variable -g showersInProgress
(lldb) frame variable -g showersInProgress.count
(lldb)
The log enable -f /tmp/lldb-log.txt lldb expr types
in case it's useful to anyone:
== [UserExpression::Evaluate] Parsing expression showersInProgress ==
ClangUserExpression::ScanContext()
[CUE::SC] Null function
[C++ module config] Language doesn't support C++ modules
List of imported modules in expression:
List of include directories gathered for modules:
Parsing the following code:
#line 1 "<lldb wrapper prefix>"
#ifndef offsetof
#define offsetof(t, d) __builtin_offsetof(t, d)
#endif
#ifndef NULL
#define NULL (__null)
#endif
#ifndef Nil
#define Nil (__null)
#endif
#ifndef nil
#define nil (__null)
#endif
#ifndef YES
#define YES ((BOOL)1)
#endif
#ifndef NO
#define NO ((BOOL)0)
#endif
typedef __INT8_TYPE__ int8_t;
typedef __UINT8_TYPE__ uint8_t;
typedef __INT16_TYPE__ int16_t;
typedef __UINT16_TYPE__ uint16_t;
typedef __INT32_TYPE__ int32_t;
typedef __UINT32_TYPE__ uint32_t;
typedef __INT64_TYPE__ int64_t;
typedef __UINT64_TYPE__ uint64_t;
typedef __INTPTR_TYPE__ intptr_t;
typedef __UINTPTR_TYPE__ uintptr_t;
typedef __SIZE_TYPE__ size_t;
typedef __PTRDIFF_TYPE__ ptrdiff_t;
typedef unsigned short unichar;
extern "C"
{
int printf(const char * __restrict, ...);
}
typedef bool BOOL;
void
$__lldb_expr(void *$__lldb_arg)
{
;
#line 1 "<user expression 9>"
showersInProgress
;
#line 1 "<lldb wrapper suffix>"
}
Using x86_64-apple-ios-simulator as the target triple
Using SIMD alignment: 128
Target datalayout string: 'e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128'
Target ABI: ''
Target vector alignment: 128
ClangExpressionDeclMap::FindExternalVisibleDecls[469] for '$__lldb_arg' in a 'TranslationUnit'
CEDM::FEVD[469] Searching the root namespace
ClangASTSource::FindExternalVisibleDecls[469] on (ASTContext*)0x7fb6b48f1800 for '$__lldb_arg' in a 'TranslationUnit'
CAS::FEVD[469] Searching the root namespace
ClangExpressionDeclMap::FindExternalVisibleDecls[470] for '$__lldb_expr' in a 'TranslationUnit'
CEDM::FEVD[470] Searching the root namespace
ClangASTSource::FindExternalVisibleDecls[470] on (ASTContext*)0x7fb6b48f1800 for '$__lldb_expr' in a 'TranslationUnit'
CAS::FEVD[470] Searching the root namespace
ClangExpressionDeclMap::FindExternalVisibleDecls[471] for 'showersInProgress' in a 'TranslationUnit'
CEDM::FEVD[471] Searching the root namespace
Skipped a definition because it has no Clang AST
ClangASTSource::FindExternalVisibleDecls[471] on (ASTContext*)0x7fb6b48f1800 for 'showersInProgress' in a 'TranslationUnit'
CAS::FEVD[471] Searching the root namespace
AppleObjCDeclVendor::FindDecls [434] ('showersInProgress', false, 1, )
AOCTV::FT [434] Couldn't find showersInProgress in the ASTContext
AOCTV::FT [434] Couldn't find the isa
[ClangASTImporter] Forgetting destination (ASTContext*)0x7fb6b48f1800
[ClangASTImporter] Forgetting source->dest (ASTContext*)0x7fb6b48f1800->(ASTContext*)0x7fb69758cc00
frame variable only shows statics in the CompileUnit of the current frame. If you want to see all the globals you need to use target variable. Note, however, target variable only searches the shared library of the current frame. You can add the --shlib flag to direct the search to a specific shared library.

Compiler Warning libpcap

Having followed the examples http://www.tcpdump.org/pcap.htm, and exploring the documentation, I can't see what I have done wrong with the following code
// main.c
void got_packet(u_char *args, struct pcap_pkthdr *header, const u_char *packet);
/// ...snip...
void got_packet(u_char *args, struct pcap_pkthdr *header, const u_char *packet) {
printf("Received Packet\n");
}
/// ...snip...
pcap_dispatch(handle, 100, got_packet, NULL);
to warrant the compiler warnings that I am seeing:
gcc -g -O3 -I../sensor/ -c -o sensordatad.o sensordatad.c
main.c: In function ‘start_capture’:
main.c:96:27: warning: initialization from incompatible pointer type [enabled by default]
main.c:146:3: warning: passing argument 3 of ‘pcap_dispatch’ from incompatible pointer
type [enabled by default]
It might be that I'm being too fussy, it seems like every other piece of C code I have ever seen has a page full of compiler warnings when compiling, but I want to at least finish this code without warnings!
I've also tried doing this, to somehow typecast the function pointer, something I hadn't seen in any of the examples; but I felt it worth a shot:
pcap_handler callback = &got_packet;
/// ...snip...
pcap_dispatch(handle, 100, &callback, NULL);
This resulted in the equally perplexing error:
main.c: In function ‘start_capture’:
main.c:96:27: warning: initialization from incompatible pointer type [enabled by default]
It's the first time I've run across function pointers with special typedef'ed types, the man page for pcap_{loop,dispatch} reads:
NAME
pcap_loop, pcap_dispatch - process packets from a live capture or savefile
SYNOPSIS
#include
typedef void (*pcap_handler)(u_char *user, const struct pcap_pkthdr *h,
const u_char *bytes);
int pcap_loop(pcap_t *p, int cnt,
pcap_handler callback, u_char *user);
int pcap_dispatch(pcap_t *p, int cnt,
pcap_handler callback, u_char *user);
Solved
The function signature should be:
void got_packet(u_char *args, const struct pcap_pkthdr *header, const u_char *packet);
I had:
void got_packet(u_char *args, struct pcap_pkthdr *header, const u_char *packet);
I suppose in some ways the error makes sense?! But anyway Solved.

error: unknown type name ‘mxArray’

When I try to use MATLAB mex command to compile a c file, I met the following error
error: unknown type name ‘mxArray’
The error code is here
const char *model_to_matlab_structure(mxArray *plhs[], int num_of_feature, struct svm_model *model);
struct svm_model *matlab_matrix_to_model(const mxArray *matlab_struct, const char **error_message);
I don't understand why MATLAB doesn't recognize the mxArray type. How could I resolve this? Thanks!
Thanks. It turns out that I forgot
#include "mex.h"