Skip to main content

Prerequisites

Ensure the following tools are installed and available on your PATH before building:
ToolPurpose
arm-none-eabi-gccC compiler for ARM bare-metal targets
arm-none-eabi-asARM assembler
arm-none-eabi-ldARM linker
arm-none-eabi-objcopyELF to raw binary conversion
qemu-system-armARM system emulator (QEMU target only)
gdb-multiarchDebugger with ARM support (optional, for GDB sessions)
On Debian/Ubuntu: sudo apt install gcc-arm-none-eabi binutils-arm-none-eabi qemu-system-arm gdb-multiarch

Clone the repository

git clone https://github.com/Martin-ing/Proyecto1cc7.git
cd Proyecto1cc7

Build

The build system reads platform-specific memory-map definitions from .venv.qemu or .venv.beagle at compile time and selects the matching linker script automatically.
1

Build for QEMU

make TARGET=qemu
# or use the shorthand target
make qemu
The QEMU build compiles with -O0 -g3 (no optimisation, full debug info) and links against linker/linker_qemu.ld.Key compiler flags applied by both methods:
FlagDescription
-mcpu=cortex-a8Target the Cortex-A8 core
-mfpu=neonEnable the NEON FPU
-mfloat-abi=hardUse hardware floating-point ABI
-nostdlib -nostartfilesNo standard library or C runtime startup
-ffreestandingFreestanding (bare-metal) environment
QEMU memory map (from OS/.venv.qemu, enforced by linker/linker_qemu.ld):
RegionBaseSize
OS text/data/bss0x0001000064 KB
Process 1 (P1)0x0006000064 KB
P1 stack0x000700004 KB
Process 2 (P2)0x0008000064 KB
P2 stack0x000900004 KB
UART00x101f1000
Timer0x101e2000
Interrupt controller0x10140000
2

Verify output binaries

Both methods produce the same artifacts under bin/:
bin/program.elf   ← ELF with debug symbols (used by QEMU -kernel and GDB)
bin/program.bin   ← Raw binary (used for flashing)
bin/program.map   ← Linker map (build_and_run.sh only)

Run

1

Launch QEMU with a GDB server

qemu-system-arm \
    -M versatilepb \
    -cpu cortex-a8 \
    -kernel bin/program.elf \
    -nographic \
    -S -s
-S halts the CPU at startup; -s opens a GDB server on localhost:1234. QEMU will wait silently until a debugger connects or you resume execution.
make qemu runs this exact command automatically after a successful build.
2

Connect GDB (optional)

In a second terminal:
gdb-multiarch bin/program.elf
Then inside GDB:
set architecture arm
target remote :1234
file bin/program.elf
break main
continue
3

Resume and observe UART output

To run without halting (no GDB), omit the -S -s flags:
qemu-system-arm -M versatilepb -cpu cortex-a8 -kernel bin/program.elf -nographic
build_and_run.sh qemu uses this form — it builds and immediately launches QEMU without pausing.The OS schedules two user processes in round-robin. Each prints to UART0. Expected output:
----From OS: hola
----From P1: 0
----From P2: a
----From OS: hola
----From P1: 1
----From P2: b
----From OS: hola
----From P1: 2
----From P2: c
...
Press Ctrl+A then X to exit QEMU when running with -nographic.

Clean

Remove all build artifacts:
make clean
This deletes the entire bin/ directory.

Build docs developers (and LLMs) love