Thanks Stefan for explaining the method.
After following above method when I run below command to compile my custom
device in Qemu source code , I get the output on terminal which is attached
in a file for your reference.

Command:- make -j8 -C build

Most of the lines in attached file indicate that error might be due to
helper.c file.

How to resolve it?

My qemu version:4.2.50


Thanks,
Priyamvad Acharya

On Tue, 3 Mar 2020 at 16:16, Stefan Hajnoczi <stefa...@gmail.com> wrote:

> On Tue, Mar 3, 2020 at 7:45 AM Priyamvad Acharya
> <priyamvad.agni...@gmail.com> wrote:
>
> Please use Reply-All when replying to mailing list emails so that
> qemu-devel@nongnu.org is included in the CC list.  That way the
> discussion stays on the mailing list.
>
> > Hi,
> > I have written code to emulate a custom PCI device.
> > Now I want to run custom device with Qemu, so that user application can
> perform read/write operation with custom PCI device.
> > So what is the method to do it?
>
> 1. Add the source file somewhere below hw/.
> 2. Add a make rule to build the object file in Makefile.objs in the
> same directory as the source file.
> 3. Compile QEMU and run with -device testpci.
>
> > I am new to emulating a custom device model in Qemu, so request you to
> explain me in that way.
>
> Reading the source code is necessary to understand how things work.
> You can find many examples of devices in the hw/ directory.  Using
> git-log(1) can be helpful because it shows how new devices were
> introduced.
>
> Stefan
>
target/arm/arm-semi.o: In function `do_arm_semihosting':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/arm-semi.c:784: 
undefined reference to `qemu_semihosting_console_outc'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/arm-semi.c:787: 
undefined reference to `qemu_semihosting_console_outs'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/arm-semi.c:815: 
undefined reference to `qemu_semihosting_console_inc'
target/arm/cpu.o: In function `arm_v7m_cpu_exec_interrupt':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/cpu.c:483: undefined 
reference to `armv7m_nvic_can_take_pending_exception'
target/arm/m_helper.o: In function `v7m_stack_write':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:260: 
undefined reference to `armv7m_nvic_set_pending_derived'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:263: 
undefined reference to `armv7m_nvic_set_pending_lazyfp'
target/arm/m_helper.o: In function `v7m_stack_read':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:329: 
undefined reference to `armv7m_nvic_set_pending'
target/arm/m_helper.o: In function `helper_v7m_preserve_fp_state':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:356: 
undefined reference to `armv7m_nvic_set_pending_lazyfp'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:360: 
undefined reference to `armv7m_nvic_set_pending_lazyfp'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:399: 
undefined reference to `armv7m_nvic_can_take_pending_exception'
target/arm/m_helper.o: In function `arm_v7m_load_vector':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:728: 
undefined reference to `armv7m_nvic_set_pending_derived'
target/arm/m_helper.o: In function `v7m_push_callee_stack':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:796: 
undefined reference to `armv7m_nvic_set_pending'
target/arm/m_helper.o: In function `v7m_exception_taken':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:838: 
undefined reference to `armv7m_nvic_get_pending_irq_info'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:946: 
undefined reference to `armv7m_nvic_acknowledge_irq'
target/arm/m_helper.o: In function `v7m_update_fpccr':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:988: 
undefined reference to `armv7m_nvic_neg_prio_requested'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1004: 
undefined reference to `armv7m_nvic_get_ready_status'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1007: 
undefined reference to `armv7m_nvic_get_ready_status'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1010: 
undefined reference to `armv7m_nvic_get_ready_status'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1013: 
undefined reference to `armv7m_nvic_get_ready_status'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1016: 
undefined reference to `armv7m_nvic_get_ready_status'
target/arm/m_helper.o:/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1020:
 more undefined references to `armv7m_nvic_get_ready_status' follow
target/arm/m_helper.o: In function `v7m_push_stack':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1204: 
undefined reference to `armv7m_nvic_set_pending'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1249: 
undefined reference to `armv7m_nvic_set_pending'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1254: 
undefined reference to `armv7m_nvic_set_pending'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1272: 
undefined reference to `armv7m_nvic_set_pending'
target/arm/m_helper.o: In function `do_v7m_exception_exit':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1408: 
undefined reference to `armv7m_nvic_raw_execution_priority'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1416: 
undefined reference to `armv7m_nvic_complete_irq'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1497: 
undefined reference to `armv7m_nvic_set_pending'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1515: 
undefined reference to `armv7m_nvic_set_pending'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1528: 
undefined reference to `armv7m_nvic_set_pending'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1545: 
undefined reference to `armv7m_nvic_can_take_pending_exception'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1595: 
undefined reference to `armv7m_nvic_set_pending'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1669: 
undefined reference to `armv7m_nvic_set_pending'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1684: 
undefined reference to `armv7m_nvic_set_pending'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1711: 
undefined reference to `armv7m_nvic_set_pending'
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1721: 
undefined reference to `armv7m_nvic_set_pending'
target/arm/m_helper.o:/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:1820:
 more undefined references to `armv7m_nvic_set_pending' follow
target/arm/m_helper.o: In function `arm_v7m_mmu_idx_for_secstate_and_priv':
/lhome/priyamvad/debian_qemu_arm32_updated/qemu/target/arm/m_helper.c:2710: 
undefined reference to `armv7m_nvic_neg_prio_requested'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:206: qemu-system-arm] Error 1
make: *** [Makefile:494: arm-softmmu/all] Error 2

Reply via email to