samples: basic: Add a minimal sample
Add a minimal sample that showcases minimal ROM sizes. It can be built in several configurations, all very restrictive when it comes to features enabled in order to verify the fact that we can fit in small devices and to be able to accurately measure the sizes of the kernel's basic features. Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
5ec96b1766
commit
fc3c2c0abb
|
@ -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
|
||||
|
|
8
samples/basic/minimal/CMakeLists.txt
Normal file
8
samples/basic/minimal/CMakeLists.txt
Normal file
|
@ -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)
|
97
samples/basic/minimal/README.rst
Normal file
97
samples/basic/minimal/README.rst
Normal file
|
@ -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:
|
||||
|
1
samples/basic/minimal/arm.conf
Normal file
1
samples/basic/minimal/arm.conf
Normal file
|
@ -0,0 +1 @@
|
|||
CONFIG_ARM_MPU=n
|
35
samples/basic/minimal/common.conf
Normal file
35
samples/basic/minimal/common.conf
Normal file
|
@ -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
|
8
samples/basic/minimal/mt.conf
Normal file
8
samples/basic/minimal/mt.conf
Normal file
|
@ -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
|
||||
|
3
samples/basic/minimal/no-mt.conf
Normal file
3
samples/basic/minimal/no-mt.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Single-threaded, no timer support in the kernel
|
||||
|
||||
CONFIG_MULTITHREADING=n
|
1
samples/basic/minimal/no-preempt.conf
Normal file
1
samples/basic/minimal/no-preempt.conf
Normal file
|
@ -0,0 +1 @@
|
|||
CONFIG_NUM_PREEMPT_PRIORITIES=0
|
3
samples/basic/minimal/no-timers.conf
Normal file
3
samples/basic/minimal/no-timers.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
# No timer support in the kernel
|
||||
|
||||
CONFIG_SYS_CLOCK_TICKS_PER_SEC=0
|
45
samples/basic/minimal/sample.yaml
Normal file
45
samples/basic/minimal/sample.yaml
Normal file
|
@ -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
|
||||
|
11
samples/basic/minimal/src/main.c
Normal file
11
samples/basic/minimal/src/main.c
Normal file
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
|
||||
void main(void)
|
||||
{
|
||||
}
|
1
samples/basic/minimal/x86.conf
Normal file
1
samples/basic/minimal/x86.conf
Normal file
|
@ -0,0 +1 @@
|
|||
CONFIG_X86_MMU=n
|
Loading…
Reference in a new issue