Presentation is loading. Please wait.

Presentation is loading. Please wait.

#FOSDEM Februari 4, 2017 brabo

Similar presentations


Presentation on theme: "#FOSDEM Februari 4, 2017 brabo"— Presentation transcript:

1 #FOSDEM Februari 4, 2017 brabo
Insane Adding Machines presents: frosted #FOSDEM Februari 4, 2017 brabo

2 Free Operating System for tiny embedded devices
frosted Free Operating System for tiny embedded devices License: GPL Developed by: Insane adding machines Non-profit development team Research on Free Software for IoT Management platform: github Decentralized Copyleft

3 Target ARM® Cortex-M® CPU

4 Target ARM® Cortex-M® CPU

5 Cortex-M features 32-bit architecture Low power
Physical addressing (no MMU) Integrated network Bus: I2C/SPI/UART/USB-OTG Multimedia (DSP) (M4/M7) Accelerated Floating point processing (M4/M7)

6 Cortex-M software state of the art
Baremetal programming Single-threaded Event-loop + IRQ handling “Real-Time” OS Basic support for threads (no process handling) “centralized” IRQ handling No advanced OS features (filesystems, terminals) No multiplexing drivers Cryptic, unique, non portable API No application safety in any case

7 Embedded Linux Not feasible:
Linux is no longer designed for the embedded world Even Non-MMU Linux (uCLinux) has too high resource requirements

8 Goals POSIX API Allows to port existing *NIX applications and libraries Fast learning process for linux developers Hard Kernel/userspace separation Physical memory segmentation Safe process environment Isolated from kernel Isolated from other processes System and drivers functions exposed via standard syscalls Real Time Ultra Low Power TCP/IP connectivity Free kernel-space code All kernel code is GPL

9 POSIX Embedded conformance

10 Components

11 Flash Kernel code area size is fixed
Base applications and shell scripts are compiled as flat binaries and stored into XipFS XipFS gets mounted under /bin at startup

12 Application code Goal: port ANY *nix executable with no modifications
Reality: possibly something is missing Some less-popular calls not yet implemented in libC s/fork/vfork

13 Application executables
In bFLT format (to allow relocation/XiP) Use arm-frosted-eabi-gcc toolchain Compile with: -fPIC -mlong-calls -fno-common -msingle-pic-base -mno-pic-data-is-text- relative Link with: -fPIC -mlong-calls -fno-common -Wl,-elf2flt -lgloss See Userland repository

14 Context separation Processes execute in their own context
No access to supervisor code No access to kernel memory No access to other tasks’ stack Separate stack pointer

15 System Interrupts

16 Scheduler Double list (idling, running) Round-robin policy
Multiple priority levels Timeslice calculation based on priority Special Real-time priority Voluntary pre-emption (task_suspend) Locks: processes sleep while waiting for semaphore/mutex Real time: task_resume in RT tasks forces immediate scheduling after IRQ events Latency for RT tasks is predictable

17 Scheduler

18 Repositories Frosted kernel Kernelspace code
Makefile environment to build full system GCC-based Toolchain arm-frosted-eabi Required to compile applications and libraries Common headers System specific API definition (ioctl values, syscall mapping) Frosted-userland Example applications and libraries Unicore-mx Hardware abstraction layer

19 Repositories and interdependencies (via git-submodules)

20 Toolchain Build time from sources: 25-50 minutes
Periodic binary releases for x86_64 on github Nightly builds available at: Why? Built-in libraries to compile applications Automatically resolve system include paths Able to produce “flat” binaries Nice side effect: The toolchain can compile the kernel too No other toolchain is required to build the full system

21 Kernel configuration If your board has a pre-defined config, use make defconfig TARGET=boardname Run make menuconfig to customize kernel features and supported drivers

22 Userland configuration
Selection of components based on menuconfig Selected apps are archived in a XipFS that will be mounted at startup on /bin When the system starts, /bin/init is executed If /bin/init.sh is present, it will be parsed using the default shell (/bin/fresh)

23 Compilation Now that frosted is configured, type make to build

24 Linking and image creation
The binaries produced by the build are: kernel.elf: kernel executable in ELF format kernel.img: image version of the kernel Padded up to selected kernel size to be placed at the beginning of the flash apps.img: XipFS image containing the userland programs, generated by frosted-userland image.bin: concatenation of kernel.img and apps.img to facilitate flashing/running

25 Running on qemu Qemu can emulate a M3 target, based on TI stellaris LM3S, with UART and Ethernet Unfortunately, with only 256KB Flash and 64KB RAM, allowing only basic system We provide a modified qemu with a “tuned” LM3S, closer to nowadays real HW: 1MB Flash 256KB RAM To run on qemu: Compile for LM3S Run “make qemunet”

26 Continuous integration
Code is verified at every commit by Jenkins Build Non-regression tests on real and synthetic (qemu) targets Non-regression tests running on four different boards

27 Flashing to target Depending on the target type, one of the following mechanisms must be used to flash the system: If the target supports st-link Run st-flash as indicated If the target has an MBED bootloader: Copy image.bin directly to the USB storage If the target supports DFU format: Image.bin must be converted to .dfu with dfu-utils before transferring it

28 Thank you! Questions? Comments?
irc.freenode.net / #frosted


Download ppt "#FOSDEM Februari 4, 2017 brabo"

Similar presentations


Ads by Google