diff --git a/CODEOWNERS b/CODEOWNERS index 53e48ed47a0..61b38da0bb6 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -255,6 +255,7 @@ /kernel/device.c @andrewboie @andyross @nashif /kernel/idle.c @andrewboie @andyross @nashif /samples/ @nashif +/samples/basic/minimal/ @carlescufi /samples/basic/servo_motor/*microbit* @jhe /samples/bluetooth/ @joerchan @jhedberg @Vudentz /samples/boards/intel_s1000_crb/ @sathishkuttan @dcpleung @nashif diff --git a/samples/basic/minimal/CMakeLists.txt b/samples/basic/minimal/CMakeLists.txt new file mode 100644 index 00000000000..0ffa890ac02 --- /dev/null +++ b/samples/basic/minimal/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.13.1) + +include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +project(minimal) + +target_sources(app PRIVATE src/main.c) diff --git a/samples/basic/minimal/README.rst b/samples/basic/minimal/README.rst new file mode 100644 index 00000000000..040365e4daa --- /dev/null +++ b/samples/basic/minimal/README.rst @@ -0,0 +1,97 @@ +.. _minimal_sample: + +Minimal sample +############## + +Overview +******** + +This sample defines An empty ``main()`` and a set of minimal configurations +that provide tests for the smallest ROM sizes possible with the Zephyr kernel. + +The following configuration files are available: + +* :file:`mt.conf`: Enable multithreading +* :file:`no-mt.conf`: Disable multithreading +* :file:`no-preempt.conf`: Disable preemption +* :file:`no-timers.conf`:: Disable timers +* :file:`arm.conf`: Arm-specific disabling of features + +Building and measuring ROM size +******************************* + +In order to compare ROM sizes with different minimal configurations, the +following combinations are suggested: + +* Reel board (Arm architecture) + + * Multithreading enabled + + * Reference ROM size: 7-8KB + + .. zephyr-app-commands:: + :zephyr-app: samples/basic/minimal + :tool: west + :host-os: unix + :board: reel_board + :build-dir: reel_board/mt/ + :conf: "common.conf mt.conf arm.conf" + :goals: rom_report + :compact: + + * Multithreading enabled, no preemption + + * Reference ROM size: 7-8KB + + .. zephyr-app-commands:: + :zephyr-app: samples/basic/minimal + :tool: west + :host-os: unix + :board: reel_board + :build-dir: reel_board/mt-no-preempt/ + :conf: "common.conf mt.conf no-preempt.conf arm.conf" + :goals: rom_report + :compact: + + * Multithreading enabled, no preemption, timers disabled + + * Reference ROM size: 3-4KB + + .. zephyr-app-commands:: + :zephyr-app: samples/basic/minimal + :tool: west + :host-os: unix + :board: reel_board + :build-dir: reel_board/mt-no-preempt-no-timers/ + :conf: "common.conf mt.conf no-preempt.conf no-timers.conf arm.conf" + :goals: rom_report + :compact: + + * Multithreading disabled, timers enabled + + * Reference ROM size: 4-5KB + + .. zephyr-app-commands:: + :zephyr-app: samples/basic/minimal + :tool: west + :host-os: unix + :board: reel_board + :build-dir: reel_board/no-mt/ + :conf: "common.conf no-mt.conf arm.conf" + :goals: rom_report + :compact: + + * Multithreading disabled, timers disabled + + * Reference ROM size: 2-3KB + + .. zephyr-app-commands:: + :zephyr-app: samples/basic/minimal + :tool: west + :host-os: unix + :board: reel_board + :build-dir: reel_board/no-mt-no-timers/ + :conf: "common.conf no-mt.conf no-timers.conf arm.conf" + :goals: rom_report + :compact: + diff --git a/samples/basic/minimal/arm.conf b/samples/basic/minimal/arm.conf new file mode 100644 index 00000000000..b695c18ab28 --- /dev/null +++ b/samples/basic/minimal/arm.conf @@ -0,0 +1 @@ +CONFIG_ARM_MPU=n diff --git a/samples/basic/minimal/common.conf b/samples/basic/minimal/common.conf new file mode 100644 index 00000000000..7473dc45799 --- /dev/null +++ b/samples/basic/minimal/common.conf @@ -0,0 +1,35 @@ +# Drivers and peripherals +CONFIG_I2C=n +CONFIG_WATCHDOG=n +CONFIG_GPIO=n +CONFIG_PINMUX=n +CONFIG_SPI=n +CONFIG_SERIAL=n +CONFIG_FLASH=n + +# Power management +CONFIG_SYS_POWER_MANAGEMENT=n + +# Interrupts +CONFIG_DYNAMIC_INTERRUPTS=n +CONFIG_IRQ_OFFLOAD=n + +# Memory protection +CONFIG_MEMORY_PROTECTION=n +CONFIG_THREAD_STACK_INFO=n +CONFIG_THREAD_CUSTOM_DATA=n +CONFIG_FLOAT=n + +# Boot +CONFIG_BOOT_BANNER=n +CONFIG_BOOT_DELAY=0 + +# Console +CONFIG_CONSOLE=n +CONFIG_UART_CONSOLE=n +CONFIG_STDOUT_CONSOLE=n +CONFIG_PRINTK=n +CONFIG_EARLY_CONSOLE=n + +# Build +CONFIG_SIZE_OPTIMIZATIONS=y diff --git a/samples/basic/minimal/mt.conf b/samples/basic/minimal/mt.conf new file mode 100644 index 00000000000..d9cea530365 --- /dev/null +++ b/samples/basic/minimal/mt.conf @@ -0,0 +1,8 @@ +CONFIG_MULTITHREADING=y +CONFIG_NUM_COOP_PRIORITIES=16 +CONFIG_NUM_METAIRQ_PRIORITIES=0 + +CONFIG_ERRNO=n +CONFIG_SCHED_DUMB=y +CONFIG_WAITQ_DUMB=y + diff --git a/samples/basic/minimal/no-mt.conf b/samples/basic/minimal/no-mt.conf new file mode 100644 index 00000000000..312b3906c8d --- /dev/null +++ b/samples/basic/minimal/no-mt.conf @@ -0,0 +1,3 @@ +# Single-threaded, no timer support in the kernel + +CONFIG_MULTITHREADING=n diff --git a/samples/basic/minimal/no-preempt.conf b/samples/basic/minimal/no-preempt.conf new file mode 100644 index 00000000000..4319a2a8ba4 --- /dev/null +++ b/samples/basic/minimal/no-preempt.conf @@ -0,0 +1 @@ +CONFIG_NUM_PREEMPT_PRIORITIES=0 diff --git a/samples/basic/minimal/no-timers.conf b/samples/basic/minimal/no-timers.conf new file mode 100644 index 00000000000..05dc0d53afd --- /dev/null +++ b/samples/basic/minimal/no-timers.conf @@ -0,0 +1,3 @@ +# No timer support in the kernel + +CONFIG_SYS_CLOCK_TICKS_PER_SEC=0 diff --git a/samples/basic/minimal/sample.yaml b/samples/basic/minimal/sample.yaml new file mode 100644 index 00000000000..94d79a38d73 --- /dev/null +++ b/samples/basic/minimal/sample.yaml @@ -0,0 +1,45 @@ +sample: + description: minimal sample, the smallest possible Zephyr application + name: minimal +tests: + sample.minimal.mt.arm: + build_only: true + extra_args: CONF_FILE='common.conf;mt.conf;arm.conf' + platform_whitelist: reel_board frdm_k64f mps2_an385 nrf51_pca10028 + sample.minimal.mt-no-preempt.arm: + build_only: true + extra_args: CONF_FILE='common.conf;mt.conf;no-preempt.conf;arm.conf' + platform_whitelist: reel_board frdm_k64f mps2_an385 nrf51_pca10028 + sample.minimal.mt-no-preempt-no-timers.arm: + build_only: true + extra_args: CONF_FILE='common.conf;mt.conf;no-preempt.conf;no-timers.conf;arm.conf' + platform_whitelist: reel_board frdm_k64f mps2_an385 nrf51_pca10028 + sample.minimal.no-mt.arm: + build_only: true + extra_args: CONF_FILE='common.conf;no-mt.conf;arm.conf' + platform_whitelist: reel_board frdm_k64f mps2_an385 nrf51_pca10028 + sample.minimal.no-mt-no-timers.arm: + build_only: true + extra_args: CONF_FILE='common.conf;no-mt.conf;no-timers.conf;arm.conf' + platform_whitelist: reel_board frdm_k64f mps2_an385 nrf51_pca10028 + sample.minimal.mt.x86: + build_only: true + extra_args: CONF_FILE='common.conf;mt.conf;x86.conf' + platform_whitelist: qemu_x86 + sample.minimal.mt-no-preempt.x86: + build_only: true + extra_args: CONF_FILE='common.conf;mt.conf;no-preempt.conf;x86.conf' + platform_whitelist: qemu_x86 + sample.minimal.mt-no-preempt-no-timers.x86: + build_only: true + extra_args: CONF_FILE='common.conf;mt.conf;no-preempt.conf;no-timers.conf;x86.conf' + platform_whitelist: qemu_x86 + sample.minimal.no-mt.x86: + build_only: true + extra_args: CONF_FILE='common.conf;no-mt.conf;x86.conf' + platform_whitelist: qemu_x86 + sample.minimal.no-mt-no-timers.x86: + build_only: true + extra_args: CONF_FILE='common.conf;no-mt.conf;no-timers.conf;x86.conf' + platform_whitelist: qemu_x86 + diff --git a/samples/basic/minimal/src/main.c b/samples/basic/minimal/src/main.c new file mode 100644 index 00000000000..eeba938b838 --- /dev/null +++ b/samples/basic/minimal/src/main.c @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2019 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +void main(void) +{ +} diff --git a/samples/basic/minimal/x86.conf b/samples/basic/minimal/x86.conf new file mode 100644 index 00000000000..9f31dfe6c42 --- /dev/null +++ b/samples/basic/minimal/x86.conf @@ -0,0 +1 @@ +CONFIG_X86_MMU=n