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:
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
sudo apt-get install gcc-arm-none-eabi
sudo apt-get install qemu-system-arm
Programming Example 1: ts.s
.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
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
#!/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:
qemu-system-arm -M versatilepb -kernel t.bin -nographic -serial /dev/null