4. F9
Microkernel
Overview
• an
experimental
microkernel
used
to
construct
flexible
embedded
systems
inspired
by
famous
L4
microkernel.
• The
moMvaMon
of
F9
microkernel
is
to
deploy
modern
kernel
techniques
to
support
– running
real-‐Mme
and
Mme-‐sharing
applicaMons
(ex:
wireless
communicaMons)
for
ARM
Cortex-‐M
series
microprocessors
with
efficiency
(performance
+
power
consumpMon)
– security
(memory
protecMon
+
isolated
execuMon)
5. CharacterisMcs
• F9
follows
the
fundamental
principles
of
microkernels
in
that
it
implements
address
spaces,
thread
management,
and
IPC
only
in
the
privileged
kernel.
• Designed
and
customized
for
ARM
Cortex-‐M,
supporMng
NVIC
(Nested
Vectored
Interrupt
Controller),
Bit
Banding,
MPU
(Memory
ProtecMon
Unit)
• Energy
efficient
scheduling
and
Mckless
Mmer
• KProbes
• Independent
TCB
(Thread
Control
Block)
for
each
thread
with
its
global
ID
6. CharacterisMcs
(Cont.)
• Memory
management
– Memory
pool,
Flexible
page,
Address
space
• System
calls:
– Grant,
Map,
Flush
• UTCB
concept
–
a
small
thread-‐specific
region
in
the
thread's
virtual
address
space,
which
is
always
mapped
• Synchronous
IPC
• Debugging
and
profiling
mechanisms
8. Kernel
Line
of
code
Kernel
C
code
line:
2661
Git
head:
7ae6e15bdf4d67740ef9fa2a0c6a2a194df9553b
9. cscope
• CTRL-‐D
to
quit
• Use
arrow
key
<up>,
<down>
to
select
• Type
symbol
name
your
want
to
search
10. Use
case
of
cscope
1.
2.
3.
4.
5.
Get
f9-‐kernel
source
code
git
clone
h=ps://github.com/f9micro/f9-‐kernel
Generate
cscope.files
to
be
scanned
– cd
f9-‐kernel;
find
.
-‐name
"*.c"
-‐o
-‐name
"*.h"
>
cscope.files
Generate
Cscope
database
cscope
-‐b
-‐q
-‐k
Using
the
database
– default
Cscope
browser
cscope
-‐d
(be
able
to
use
vim
or
other
editor
support
cscope
database)
RegeneraHng
database
when
source
code
changes
–
Use
same
command
step
4.
Reference:
hhp://cscope.sourceforge.net/large_projects.html
11. vim
+
ctags
• sudo
apt-‐get
install
ctags
• Generate
tags
ctags
–R
*
• key
definiMon
at
vim
CTRL
+
]
è
goto
the
funcMon
definiMon
CTRL
+
t
è
back
to
previous
funcMon
call
23. Toolchain
for
Cortex-‐M4
• Sourcery
CodeBench
– ARM
Processors:
EABI
Release
– Verified
versions:
arm-‐2012.03,
arm-‐2013.05
• GNU
Tools
for
ARM
Embedded
Processors
24. stlink
Project
for
tools
we
used:
st-‐
flash,
st-‐uMl
hhps://github.com/texane/stlink
29. References
• F9
Microkernel
source
code
and
introducMon
• Using
Cscope
on
large
projects
(example:
the
Linux
kernel)
• Ctags
wiki
• __asm__
__volaMle__
GCC的内嵌汇编语法
AT&T汇编语⾔言语法(⼀一)
• Implemented
interrupt
enabling
delay
in
the
Cortex-‐M3
and
Cortex-‐M4
processors
• texane's
stlink
project
at
github