Full Download Getting Started with Secure Embedded Systems: Developing IoT Systems for micro:bit and Raspberry Pi Pico Using Rust and Tock 1st Edition Alexandru Radovici PDF DOCX
Full Download Getting Started with Secure Embedded Systems: Developing IoT Systems for micro:bit and Raspberry Pi Pico Using Rust and Tock 1st Edition Alexandru Radovici PDF DOCX
com
OR CLICK HERE
DOWLOAD NOW
https://ebookmeta.com/product/beginning-micropython-with-the-
raspberry-pi-pico-build-electronics-and-iot-projects-1st-edition-
charles-bell/
ebookmeta.com
https://ebookmeta.com/product/programming-the-raspberry-pi-getting-
started-with-python-third-edition-simon-monk/
ebookmeta.com
https://ebookmeta.com/product/rivers-of-iron-railroads-and-chinese-
power-in-southeast-asia-1st-edition-david-m-lampton/
ebookmeta.com
Skepticism The Basics 1st Edition Juan Comesaña & Manuel
Comesaña
https://ebookmeta.com/product/skepticism-the-basics-1st-edition-juan-
comesana-manuel-comesana/
ebookmeta.com
https://ebookmeta.com/product/encyclopedia-of-renewable-energy-1st-
edition-james-g-speight/
ebookmeta.com
https://ebookmeta.com/product/metaphysics-5th-edition-peter-van-
inwagen/
ebookmeta.com
https://ebookmeta.com/product/formal-aspects-of-component-software-
gwen-salaun-anton-wijs/
ebookmeta.com
https://ebookmeta.com/product/soft-war-the-ethics-of-unarmed-
conflict-1st-edition-michael-l-gross/
ebookmeta.com
Stem Mathematics for Secondary Senior 2021 Spring 1st
Edition B■t Nh■
https://ebookmeta.com/product/stem-mathematics-for-secondary-
senior-2021-spring-1st-edition-bat-nhi/
ebookmeta.com
Alexandru Radovici and Ioana Culic
Ioana Culic
Wyliodrin, Bucharest, Romania
This work is subject to copyright. All rights are solely and exclusively
licensed by the Publisher, whether the whole or part of the material is
concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in
any other physical way, and transmission or information storage and
retrieval, electronic adaptation, computer software, or by similar or
dissimilar methodology now known or hereafter developed.
The publisher, the authors and the editors are safe to assume that the
advice and information in this book are believed to be true and accurate
at the date of publication. Neither the publisher nor the authors or the
editors give a warranty, expressed or implied, with respect to the
material contained herein or for any errors or omissions that may have
been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.
This Apress imprint is published by the registered company APress
Media, LLC part of Springer Nature.
The registered company address is: 1 New York Plaza, New York, NY
10004, U.S.A.
Any source code or other supplementary material referenced by the
author in this book is available to readers on GitHub via the book’s
product page, located at www.apress.com/978-1-4842-7788-1. For
more detailed information, please visit
http://www.apress.com/source-code.
Acknowledgments
We would like to thank the Tock Core Team for their support, especially
to Leon Schü rmann (University of Stuttgart) and Branden Ghena
(Northwestern University). Their feedback has been very important
and has helped us greatly improve the book’s contents.
A special thank you goes to our colleagues Ș tefan Dan Ciocîrlan and
Jan Alexandru Vă duva from the University Politehnica of Bucharest for
their suggestions that helped us improve this book.
Thank you all for your support.
Table of Contents
Chapter 1:Embedded Systems and Architectures
The Eagle Has Landed
The Architecture of a Generic Embedded System
Central Processing Unit
The System Bus
The Memory
Input/Output Devices
The Storage Space
The Interrupt Controller
The Debug Interface
Microcontrollers, Computers, and Hybrid Systems
Microcontrollers
Computers
Hybrids
Embedded Systems Platforms
Summary
Chapter 2:Embedded Systems Software Development
What About the Software?
Development Languages
Assembly Language
Structured Programming
A Few Words About Security
C Programming and Safety
Beware of Rust
Bare Metal Embedded
The Arduino Library
CMSIS
OpenCM3
The Rust Embedded Devices Working Group
Embedded Operating Systems and Frameworks
FreeRTOS
The Zephyr Project
Mbed OS
RIOT
Tock
Summary
Chapter 3:The Tock System Architecture
Why Tock?
A Few Words About Operating Systems
The Kernel
The Drivers
The Applications
Services
The Tock System Architecture
User Space
The Tock Kernel
Hardware Drivers
Capsules
Security Facts
The Tock User Space Architecture
Process States
System Calls
The Process Memory
Tock Application Package
Flashing the System
The Debug Chip
Flashing
Programming
The Safe Way
Summary
Chapter 4:Rust for Tock
Introduction to Rust
Rust Primary Data Types
Mutability
Who Owns A Value?
Strings
Borrowing
Slices
Lifetimes
Who Is Responsible for Deallocation?
Lifetime Elision Rules
Generics and Trait Objects
A Kind of Inheritance
Traits
Generic Structures
Associated Types
Null Values and Error Reporting
Rust Concepts Used in Tock
Interior Mutability
Global Variables
Buffer Lifetimes
Unwrapping Values
Transforming Values
Summary
Chapter 5:Getting Started with Tock
Hardware Requirements
About the Tock Repository
The Tock Project Structure
The libtock-c and libtock-rs Repositories
Environment Setup
Environment Setup for Programming the micro:bit Device
Install the Necessary Tools for the Raspberry Pi Pico
Clone the Tock Kernel Source Code
Clone Tock Additional Libraries
Compile and Deploy the Tock Kernel and Applications
Deploy the Tock Kernel on the micro:bit
Hello World from micro:bit!
Deploy the Tock Kernel on the Raspberry Pi Pico
Hello World from Raspberry Pi Pico!
Summary
Chapter 6:The Structure of a Custom Tock System
Initialize the Kernel Component
Link the Tock Kernel Repository
Add the Board-Specific Folder
Create the Drivers Folder
Initialize the Userspace Component
Link the libtock-c Repository
Create the Applications Folder
The Rust Toolchain
Build the Project
Build the Kernel
Build an Application
Summary
Chapter 7:Userspace Applications Development
Hardware Requirements
Userspace Capsule APIs
The Timer Library
The GPIO Library
Application Example
The LED Library
Application Example
The ADC Library
Application Example
The Sensor Libraries
Reading The Temperature
Reading The Motion
Application Example
Human Interaction Libraries
The Console Library
The Text Screen Library
The Screen Library
The Button Library
Persistent Data Storage Library
Summary
Chapter 8:Synchronous Syscall Capsules
Hardware Requirements
The Tock Capsule
Why Write A Capsule?
A Closer Look at The System Call Interface
The Command System Call
The CommandReturn Structure
A Capsule’s Architecture
The API Definition
Writing the Capsule
Defining the Driver
Defining the Font
Connecting the LEDs
Display Digits and Letters
The Syscall API Implementation
Registering the Capsule
The Board Implementation
The KernelResources Trait
Starting The Kernel
The DigitLetterDisplay Capsule Registration
Writing the Userspace Library
The Header File
The Library
Using the Library Inside the Process
Run the Project on the Raspberry Pi Pico
The Hardware Setup
Setting Up the Driver
Using the Driver
Summary
Chapter 9:Asynchronous Syscall Capsules
Requirements
Extending the API
The command System Call
The subscribe System Call
The allow System Call
Capsule Architecture
Asynchronous Tock Drivers
Writing the Capsule
Defining the Capsule’s Data Structures
Storing the Buffer
Executing the Commands
The Text Display
The Capsule Registration
The Userspace Library Implementation
The Userspace API
The API Implementation
Writing an Example Application
The Synchronous Application
The Asynchronous Application
Using the Raspberry Pi Pico
Summary
Chapter 10:Service Capsules
Requirements
The Separation Between Syscall and Service Capsules
The TextScreen Driver
The Architecture of the Capsule
The Text Screen API
The Driver Implementation
Driver Initialization
The TextScreen HIL Implementation
The Text Displaying Process
The Setup Syscall API Implementation
Capsule Registration
Capsule Usage
The Text Screen API
The Setup API
Use the Raspberry Pi Pico
Summary
Chapter 11:Tock Userspace Drivers
Requirements
The Tock Inter-Process Communication Library
Use IPC to Implement a Userspace Driver
The TextDisplay Service
The Service API
The Client Process
Summary
Chapter 12:Tock Systems Management
Running Tockloader
Use tockloader with the micro:bit
Troubleshooting
Use tockloader with the Raspberry Pi Pico
Flash the Kernel
Device Console
Install/Remove Applications
Tockloader Install
Tockloader Uninstall
Update an Application
Inspect the Applications
List Applications
Inspect TAB Files
Application Configurations
Enable/Disable an Application
Sticky Applications
Fault Policies
Write a Custom FaultPolicy
Override the Fault Handler
System Information
Inspecting Processes
System Status
Another Random Document on
Scribd Without Any Related Topics
the land "that needeth not the sun;" and in the coach, with
strangers around her, Nora prayed as she had never done
before—prayed for the life of her little cousin—prayed a very
earnest prayer for herself, that God would answer her in
these prayers for Christ's sake, and make her truly his child,
even as little Minnie was.
He had half carried her into the parlour, and laid her down
on the sofa. Quietly he stood by for a few minutes, with
bent head and lowered eyes, letting her give vent to the
tears which come so easily from hearts in their first sorrow,
and which bring such blessed relief.
Her uncle bent over her lovingly. "My Nora," he said, "be
brave; help us to say, 'Thy will be done.' Your poor aunt will
need all your help. There have been two angels here this
evening, darling—one of death and one of life. One hour
after our darling fell asleep in Jesus, God sent us another
little daughter to comfort us."
And amid all his sorrow, these words sent a thrill of joy
through Mr. Macleod's heart, for hitherto Nora had seemed
to feel that she could do all things in her own strength; but
in the bitter hours of sorrow, and self-reproach, and self-
examination through which she had passed that day, she
had been brought to see her own weakness as never
before.
Very softly she slipped into her aunt's room, and bent for a
moment over the bed.
"Auntie, dear auntie, I've come," she said; but despite her
efforts at self-control, one hot tear fell on the pallid face as
she kissed the soft cheek.
A quiet, feeble voice said, "'The Lord gave, and the Lord
hath taken away: blessed be the name of the Lord.'"
CHAPTER X.
A HIGHLAND FIELD-PREACHING.
Brightly shone the sun that day, and every blade of grass
and remaining tuft of heather sparkled under its rays, as
the party from Benvourd set off to the place of meeting. It
was a good way off; but both Nora and her uncle were
famous pedestrians, and fully enjoyed the walk on that
quiet early Sabbath morn. The impression made on her
heart by Minnie's early death had never worn completely
off; the longing after higher and more satisfying joys than
the world could give was still filling the girl's heart; the soil
was soft, prepared, though she knew it not, by the great
Creator for the ready reception of the words which, by the
lips of his faithful messenger, were to prove that day to
many souls the savour of life.
Her uncle smiled. "You may well ask that, Nora. The greater
number of these people have come from places miles
distant, and some must have walked for hours to get here
so early. God grant that not mere curiosity has brought
them, but a hunger for the bread of life."
Just then the ferry-boat reached the bank of the river where
they stood, and Mr. Macleod and his niece stepped into it,
along with several others.
"Ay, ay, sir," was the ready reply, spoken in the Gaelic
language; "but it's blessed work too, for if half that we hear
is true, it's the Lord's own message that will be given to-
day, and na doot many o' Satan's captives will be set free.
The ferry work is one o' necessity and mercy, I'm thinking;
and the Lord'll no' hold us guilty for doin' that kind o' work
on his holy day. Not one penny o' payment will old Sandy
take for this work. Yon's a grand sicht, sir."
Young and old, rich and poor were grouped there, the grass
and the heather their carpet, and the blue arched sky their
roof, while a small mountain cascade, as it leaped from rock
to rock over-canopied by the rowan trees, mingled its music
with that of the slight breeze and the chorus of strong
voices. The scarlet cloaks and white caps of some of the
older women, and the checked shepherd's plaids of the
men, all formed a picture that would not soon die out of
memory's eye.
But now the preacher stood in their midst, and with a voice
of power, and eyes that once seen were never to be
forgotten, addressed the crowd.
And what of Nora? Not even the uncle sitting beside her
knew of the conflict in her heart; no spoken words told of
the surrender of heart and life into her Saviour's keeping.
Yet the Lord of glory knew of it.
And when Nora lay down to rest that night, there played on
her lips a smile of God's own peace, and on her brow, it
may be, the angel-host could see the shadow of a crown
more beautiful far than any earthly one of gold and rubies.
And when, ere many days elapsed, Ronald received a letter
from his dearly-beloved sister, telling the glad news of her
new-found peace in Jesus, his lips also gave praise to God
for the answer to many prayers, both of those who were
still on earth and of those who had passed within the veil,
yet whose prayers had been laid upon the golden altar, to
be answered when the great Answerer of prayer saw fit.
CHAPTER XI.
HOME LIFE.
MORE than two years have passed since the death of little
Minnie Macleod. Life at Benvourd has gone quietly on. Little
duties, little cares, and what some would call little
pleasures, made up the daily routine of the lives of most of
the inhabitants of the neighbourhood.
And yet both in nature and the souls of the inmates of the
glen there was growth. Not very visible, perhaps, to an
unobservant eye, still the young trees in the pass were
reaching upwards, and, all unseen, their roots were striking
deeper down, enabling them the better to bear unharmed
the wild winter blasts that from time to time swept over
them. The river also, though almost imperceptibly, was
deepened, the large boulder stones in its channel were
getting more firmly fixed in their places than of yore. And in
the souls of many of the dwellers there, the words of gospel
truth, sown on the September day we have written of, at
the field-meeting, were springing up, "first the blade, then
the ear," one day to ripen into full corn.
"Any messages, auntie?" she said. "I'm off to see old nurse
and some, of the poor bodies; and I'll look into the school
on my way back, and see how the children are getting on
with their work."
"All right, dear," was the reply; "only, do not get cold. And
take Cherry with you for company."
Warmly was she welcomed by old nurse. Not long had she
been in discovering the change that had taken place in her
darling's heart; and many a time now, as she stroked back
the golden brown locks off the broad brow, she loved to
think that a fairer diadem than that of this world would one
day rest there.
"Come in, come in, my lambkin; I'm wantin' sore to see ye.
Look ye here; I've had news o' my puir misguided laddie.
He's livin', Miss Nora, sore broke down, they write, in mind
an' body, but ower prood to say a word to his auld grannie,
wha loes him dearly yet, in spite o' a' his faults."
"How got I the news, you ask? Weel, ye see, it's this
Duncan Finlay; ye'll mind o' him?—Jean Finlay's son, doon
the glen. Weel, he's been in furrin pairts, a sailor lad; an' in
the ship comin' hame, wha should he see but Johnny—my
Johnny—workin' his passage hame (for it seems he's been i'
the Indies, puir laddie); and when he saw Duncan, he made
him promise he'd no tell ony o' his folk where he was, or
what he was daein'."
"An' at first Duncan had kind o' agreed to that; but when
they were nearin' England, Johnny fell sick, an' Duncan has
been rale kind to him, got him intil lodgin's, an' tended him
like a brither. But my puir laddie's gettin' nee better; an'
noo Duncan feels he canna' keep silence ony langer, an' so
he wrote to his mither to tell her a' this—And oh, Miss Nora,
he says, for a' Johnny appears hardened-like to his hame,
he thinks his heart turns fondly to his auld grannie still: for
in his sleep, he ca's for me, an' speaks aboot the auld hills
an' the bonny pass, whiles fancyin' he's helpin the gentry to
fish i' the river, or gangin' wi' them as he's dune mony a
time ower the muirs when they're shootin' the grouse. An'
aince, missie, only think Duncan writes—" and as she
spoke, tears ran down the old woman's cheeks—"he thocht
he was in the kirk, an' began singin' oot the words o' the
psalm, 'The Lord's my shepherd, I'll not want.'"
Nora looked at it. "Oh yes, nurse," she said; "I'll write at
once to Ronald; I know he and my cousin, Mr. Arbuthnot,
often visit among the lodging-houses in London; and Ronald
will be so pleased if he can help poor Johnny in any way.
Keep up your spirits, nurse; perhaps the illness may be
God's way of drawing poor Johnny to himself."
"Ay, ay," was the old woman's reply. "I'm trustin' in him,
missie; the Good Shepherd goes into the wilderness after
his errin' sheep, an' sometimes, even against their will,
carries them home to the fold in his ain lovin' arms. And
ye'll write soon, missie, an' tell me whenever ye hear?"
"That I will," said Nora, rising; "but I must run off now, for I
have one or two sick people to see down the glen, and
auntie told me not to linger too long."
And calling Cherry to come away from the cosy fire, she set
off, having cheered up by her bright looks and loving words
the heart of the old woman.
Through the pass she wound her way, now running a bit
with Cherry, now pausing to look at the river as it danced
along, or to note the little birds as they hopped about from
spray to spray, picking at the bright berries that yet
remained.
Then turning out of the pass, she crossed the highroad, and
entered a small cottage in a field, where dwelt a sick child,
nigh unto death; but at the sight of the bright young face,
she looked up with a smile. Nora produced some little
delicacy out of the leather bag, to tempt the failing
appetite; then seating herself beside the bed, began, at the
child's request, to "sing to her something about heaven."
In the rich, sweet voice with which God had endowed her,
she sang of the land where hunger and thirst, pain and
sickness are felt no more, and where—
One or two more visits of love, and then Nora turned into
the village school, the face of the teacher lighting up as she
entered. She had a kind, merry word for all, praised some
and gently chid others; then sat right down among the
workers, and told them a story over which eyes that were
beginning to look weary sparkled again, and to which the
teacher herself listened as eagerly as the little ones. Then
followed a simple hymn about the "Happy Land," in which
the voices of even the very little ones chimed in sweetly.
And once again Nora was off, having left a good influence
behind her. She had had a happy day and an adventure as
well; for just as she was leaving the pass, who should she
meet but two young girls, nieces of their neighbour, Mrs.
Forbes, who, along with their governess, were going to
Benvourd with an invitation for her to spend a week at
Craiglora, to meet some friends from England who had
arrived unexpectedly.
The girls had come so far in the carriage, and were to walk
through the pass to Benvourd, but had contrived to take a
wrong turn, and being strangers to that part of the country,
were wandering about in great perplexity when they met
Nora and her dog.
"No doubt," said one of them, "if you had not met us, we
would have been benighted, and, perhaps, perished in the
snow!"
Nora had laughed at that idea, but made a good joke about
the travellers who had lost their way in the Highland pass.
They did not return with her to Benvourd, as they had lost
so much time, and were to await the carriage again at a
house not far from the pass.
In the evening Mr. Macleod gave Nora Mrs. Ross's letter, and
told her, he and her aunt gave her full liberty to accept the
invitation, if she felt at all inclined to do so.
"We will miss our bright sunbeam," he said, "but only desire
that in this matter you should please yourself."
Nora read the letter, laughing over the idea of her moping.
"Why, uncle, what does she mean? I am as happy as I can
possibly be; and I have so many things to interest me, and
people to love, I could not manage to be dull."
Her uncle drew her into his arms and kissed her tenderly.
"Thank God you can say that, Nora. I do believe your dear
mother's prayers are answered for you, that you might be
led to seek after the wisdom that is better far than gold and
rubies."
CHAPTER XII.
SOUGHT AND FOUND.
But the words had struck on the ear of a young man who
was just entering the room, after having asked "if a lad
called John Robertson lodged there."