Configuration

Kconfig options and compile-time macros.

Kernel limits are set at compile time. The options are declared in Kconfig at the repository root.

Options

Option Type Default Range Meaning
CONFIG_MAX_TASKS int 16 2 to 256 Size of the static TCB array. The idle task uses one slot.
CONFIG_NUM_PRIORITIES int 8 2 to 32 Number of priority levels. 0 is the highest. The idle task runs at the lowest.
CONFIG_DEFAULT_STACK_SIZE int 1024 128 to 65536 Stack size of the idle task, in bytes.
CONFIG_TICKLESS bool y Declared, but not read by any kernel or port source in 0.0.3.
CONFIG_RR_TIME_SLICE_US int 10000 100 to 1000000 Round-robin slice for tasks of equal priority, in microseconds.
CONFIG_ASSERT bool y Enables br_assert(). When off, the expression is still evaluated.
CONFIG_ARCH_ARM_CORTEX_M choice y Target architecture. ARM Cortex-M is the only choice.
CONFIG_SYS_CLOCK_HZ int 16000000 Core clock. Mapped to BR_HAL_SYS_CLOCK_HZ.

The Cortex-M timer derives microseconds from the core clock and fails to compile if BR_HAL_SYS_CLOCK_HZ is below 1 MHz.

Generating autoconf.h

The configuration targets use kconfig-tools. Build them once:

chorus build-tools

This runs zig build in 3rd/tools/kconfig and places the binaries in 3rd/tools/kconfig/zig-out/bin.

Target Action
chorus defconfig Applies boards/qemu-cortex-m3/defconfig, writes .config and the header.
chorus menuconfig Opens the interactive editor.
chorus configure Regenerates the header from the existing .config.

The generated header is include/generated/autoconf.h. include/bedrock/br_config.h includes it when it exists. Without it, br_config.h falls back to the defaults listed above.

Key Action
Up, Down, k, j Move
Enter, Space Toggle, edit, or open a submenu or choice
Right Open submenu
Left, Esc Back
S Mark for save
Q Save and quit
X Quit without saving

Without Kconfig

Every option in br_config.h is wrapped in #ifndef, so values can also be passed as -D flags. Add them to CFLAGS in chorus.build:

CFLAGS: "... -DCONFIG_MAX_TASKS=32 -DCONFIG_RR_TIME_SLICE_US=5000"

Other macros

Macro Default Defined in Meaning
BR_POOL_MAX_BLOCKS 128 lib/br_pool.h Maximum blocks per pool.
BR_POOL_MAX_POOLS 8 lib/br_pool.c Maximum number of pools.
BR_WARN_EXPERIMENTAL unset bedrock.h Marks BR_EXPERIMENTAL functions as deprecated, so their use produces warnings.
BR_WARN_INTERNAL unset bedrock.h Same for BR_INTERNAL functions.
BR_HOST_TEST unset chorus.build Set by the host build.