bedrock[RTOS] uses chorus as its build system. Chorus is included as a git submodule at 3rd/tools/chorus.
arm-none-eabi-gcctoolchainqemu-system-arm(for running on QEMU)- Go compiler (to build chorus, if not using a prebuilt binary)
sudo pacman -S arm-none-eabi-gcc qemu-system-armcd 3rd/tools/chorus
go build -o chorus .
sudo cp chorus /usr/local/bin/From the project root:
chorusThis produces:
| Artifact | Description |
|---|---|
libbedrock_kernel.a |
Kernel: scheduler, tasks, time, IPC |
libbedrock_hal.a |
HAL: timer, context switch, UART, startup |
libbedrock_lib.a |
Library: static pool allocator |
bedrock_example.elf |
Example application linked with all libraries |
chorus cleanRemoves all *.o, *.a, *.elf, *.bin files.
qemu-system-arm -M lm3s6965evb -nographic -kernel bedrock_example.elfPress Ctrl+A, then X to exit QEMU.
The chorus.build file defines:
| Variable | Description |
|---|---|
CC |
C compiler (arm-none-eabi-gcc) |
AR |
Archiver (arm-none-eabi-ar) |
OBJCOPY |
Object copy tool (arm-none-eabi-objcopy) |
CFLAGS |
Compiler flags (C11, Cortex-M3, thumb, includes, config defines) |
LDFLAGS |
Linker flags (nostdlib, gc-sections, linker script) |
Configuration values are passed as -D flags in CFLAGS:
| Define | Default | Description |
|---|---|---|
CONFIG_MAX_TASKS |
16 | Maximum number of tasks |
CONFIG_NUM_PRIORITIES |
8 | Number of priority levels |
CONFIG_DEFAULT_STACK_SIZE |
1024 | Default stack size in bytes |
CONFIG_TICKLESS |
1 | Enable tickless operation |
CONFIG_TASK_STATS |
1 | Per-task CPU time accounting |
BR_HAL_SYS_CLOCK_HZ |
16000000 | System clock frequency |
To change a value, edit the CFLAGS line in chorus.build.
The linker processes libraries left-to-right:
main.o -lbedrock_hal -lbedrock_kernel -lbedrock_lib -lgcc
The kernel does not use libc. memcpy and memset, including calls generated by the compiler, come from lib/br_string.c in libbedrock_lib.a, so it goes after the kernel and HAL. -lgcc provides compiler runtime helpers such as 64-bit division.