xref: /aosp_15_r20/external/pigweed/targets/lm3s6965evb_qemu/target_docs.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker.. _target-lm3s6965evb-qemu:
2*61c4878aSAndroid Build Coastguard Worker
3*61c4878aSAndroid Build Coastguard Worker----------------
4*61c4878aSAndroid Build Coastguard Workerlm3s6965evb-qemu
5*61c4878aSAndroid Build Coastguard Worker----------------
6*61c4878aSAndroid Build Coastguard WorkerThis target is specifically for emulation of the Texas Instruments Stellaris
7*61c4878aSAndroid Build Coastguard WorkerLM3S lm3s6965evb using QEMU. This may be useful for testing ARMv7-M code without
8*61c4878aSAndroid Build Coastguard Workerphysical hardware.
9*61c4878aSAndroid Build Coastguard Worker
10*61c4878aSAndroid Build Coastguard WorkerThis target configuration has **not** been tested on the physical Stellaris
11*61c4878aSAndroid Build Coastguard Workerdevelopment board.
12*61c4878aSAndroid Build Coastguard Worker
13*61c4878aSAndroid Build Coastguard WorkerBuilding
14*61c4878aSAndroid Build Coastguard Worker========
15*61c4878aSAndroid Build Coastguard WorkerTo build for this Pigweed target, simply build the top-level "qemu_gcc" Ninja
16*61c4878aSAndroid Build Coastguard Workertarget.
17*61c4878aSAndroid Build Coastguard Worker
18*61c4878aSAndroid Build Coastguard Worker.. code-block:: sh
19*61c4878aSAndroid Build Coastguard Worker
20*61c4878aSAndroid Build Coastguard Worker   $ ninja -C out qemu_gcc
21*61c4878aSAndroid Build Coastguard Worker
22*61c4878aSAndroid Build Coastguard WorkerTesting
23*61c4878aSAndroid Build Coastguard Worker=======
24*61c4878aSAndroid Build Coastguard WorkerThis target does not yet support automatic test running (though it would be
25*61c4878aSAndroid Build Coastguard Workerrelatively easy to do so). To run a QEMU binary, see the instructions below.
26*61c4878aSAndroid Build Coastguard Worker
27*61c4878aSAndroid Build Coastguard WorkerExecuting Binaries
28*61c4878aSAndroid Build Coastguard Worker==================
29*61c4878aSAndroid Build Coastguard WorkerWhen running a QEMU binary, you may chose to run it interactively with GDB, or
30*61c4878aSAndroid Build Coastguard Workerallow the binary to run in a hands-off manner.
31*61c4878aSAndroid Build Coastguard Worker
32*61c4878aSAndroid Build Coastguard WorkerRunning Without GDB
33*61c4878aSAndroid Build Coastguard Worker-------------------
34*61c4878aSAndroid Build Coastguard WorkerWhen running without GDB, the firmware will execute normally without requiring
35*61c4878aSAndroid Build Coastguard Workerfurther interaction.
36*61c4878aSAndroid Build Coastguard Worker
37*61c4878aSAndroid Build Coastguard Worker.. code-block:: sh
38*61c4878aSAndroid Build Coastguard Worker
39*61c4878aSAndroid Build Coastguard Worker   $ qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb \
40*61c4878aSAndroid Build Coastguard Worker     -nographic -no-reboot \
41*61c4878aSAndroid Build Coastguard Worker     -kernel path/to/firmware.elf
42*61c4878aSAndroid Build Coastguard Worker
43*61c4878aSAndroid Build Coastguard WorkerRun With GDB
44*61c4878aSAndroid Build Coastguard Worker------------------
45*61c4878aSAndroid Build Coastguard WorkerWhen running with GDB, execution of the binary will begin in a halted state. To
46*61c4878aSAndroid Build Coastguard Workerbegin running the code, you must connect using GDB, set any breakpoints you
47*61c4878aSAndroid Build Coastguard Workerwish, and then continue execution.
48*61c4878aSAndroid Build Coastguard Worker
49*61c4878aSAndroid Build Coastguard Worker.. code-block:: sh
50*61c4878aSAndroid Build Coastguard Worker
51*61c4878aSAndroid Build Coastguard Worker   # Start the VM and GDB server.
52*61c4878aSAndroid Build Coastguard Worker   $ qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb \
53*61c4878aSAndroid Build Coastguard Worker     -gdb tcp::3333 -S
54*61c4878aSAndroid Build Coastguard Worker     -nographic -no-reboot \
55*61c4878aSAndroid Build Coastguard Worker     -kernel path/to/firmware.elf
56*61c4878aSAndroid Build Coastguard Worker
57*61c4878aSAndroid Build Coastguard WorkerIn another window
58*61c4878aSAndroid Build Coastguard Worker
59*61c4878aSAndroid Build Coastguard Worker.. code-block:: sh
60*61c4878aSAndroid Build Coastguard Worker
61*61c4878aSAndroid Build Coastguard Worker   $ arm-none-eabi-gdb path/to/firmare.elf
62*61c4878aSAndroid Build Coastguard Worker   (gdb) target remote :3333
63*61c4878aSAndroid Build Coastguard Worker   (gdb) break SomeFunction()
64*61c4878aSAndroid Build Coastguard Worker   (gdb) continue
65