Author Topic: ARM programming on QEMU failed  (Read 7411 times)

0 Members and 1 Guest are viewing this topic.

Offline mlugo2Topic starter

  • Contributor
  • Posts: 24
  • Country: us
ARM programming on QEMU failed
« on: July 22, 2017, 06:48:49 pm »
Hello I working through some examples from the book Embedded and Real-Time Operating Systems by K.C. Wang.  I can assemble the program but when I try to run the binary executable file on QEMU I get this error:
Code: [Select]
QEMU 2.5.0 monitor - type 'help' for more information
(qemu) pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument

Am I missing some arguments or is something wrong with my linking script?

Here are the examples he gives to setup and run a simple program:

Arm Toolchain
Code: [Select]
sudo apt-get install gcc-arm-none-eabi
Code: [Select]
sudo apt-get install qemu-system-arm
Programming Example 1: ts.s
Code: [Select]
.text
.global start
start:
mov r0, #1 @ r0 = 1
mov r1, #2 @ r1 = 2
add r1, r1, r0  @ r1 = r1 + r0
ldr r2, =result @ r2 = &result
str r1, [r2] @ result = r1
stop: b stop
.data
result: .word 0


Linker script file: t.ld
Code: [Select]
ENTRY(start) /* Define start as the entry address */
SECTIONS /* program sections */
{
. = 0x10000; /* loading address, required by QEMU */
.text : { *(.text) } /* all text in .text section */
.data : { *(.data) } /* all data in .data section */
.bss  : { *(.bss)  } /* all bss in .bss section */
. =ALIGN(8);
. =. + 0x1000; /* 4 KB stack space */
stack_top =.; /* stack_top is a symbol exported by linker */
}


mk script file: mk.sh
Code: [Select]
#!/bin/bash

arm-none-eabi-as -o ts.o ts.s                 # assemble ts.s to ts.o
arm-none-eabi-ld -T t.ld -o t.elf ts.o          # link ts.o to t.elf file
arm-none-eabi-nm t.elf                          # show symbols in t.efl
arm-none-eabi-objcopy -O binary t.elf t.bin # objcopy t.elf to t.bin

How to execute:
Code: [Select]
qemu-system-arm -M versatilepb -kernel t.bin -nographic -serial /dev/null
« Last Edit: July 22, 2017, 08:52:40 pm by mlugo2 »
 

Offline abraxa

  • Frequent Contributor
  • **
  • Posts: 377
  • Country: de
  • Sigrok associate
Re: ARM programming on QEMU failed
« Reply #1 on: July 22, 2017, 08:12:58 pm »
How do you conclude that it didn't work? pulseaudio is an audio backend and is used by QEMU for audio output if needed. It has no relevance to what you're doing and the messages can be ignored - though they would annoy me, no doubt.
 

Offline mlugo2Topic starter

  • Contributor
  • Posts: 24
  • Country: us
Re: ARM programming on QEMU failed
« Reply #2 on: July 22, 2017, 08:53:05 pm »
Yeah I didn't realize I could press enter and continue  :-DD Thanks!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf