100% found this document useful (6 votes)
117 views62 pages

Complete Embedded Systems VOL. 3: Real-Time Operating Systems For ARM Cortex-M Microcontrollers Jonathan Valvano PDF For All Chapters

Systems

Uploaded by

kahalubaraan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (6 votes)
117 views62 pages

Complete Embedded Systems VOL. 3: Real-Time Operating Systems For ARM Cortex-M Microcontrollers Jonathan Valvano PDF For All Chapters

Systems

Uploaded by

kahalubaraan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Download the full version of the textbook now at textbookfull.

com

Embedded Systems VOL. 3: Real-Time Operating


Systems for ARM Cortex-M Microcontrollers
Jonathan Valvano

https://textbookfull.com/product/embedded-systems-
vol-3-real-time-operating-systems-for-arm-cortex-
m-microcontrollers-jonathan-valvano/

Explore and download more textbook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Stm32 Arm Programming for Embedded Systems 1st Edition


Muhammad Ali Mazidi

https://textbookfull.com/product/stm32-arm-programming-for-embedded-
systems-1st-edition-muhammad-ali-mazidi/

textbookfull.com

Distributed Embedded and Real time Java Systems 2012th


Edition M Teresa Higuera Toledano Andy J Wellings

https://textbookfull.com/product/distributed-embedded-and-real-time-
java-systems-2012th-edition-m-teresa-higuera-toledano-andy-j-wellings/

textbookfull.com

Designing Embedded Systems and the Internet of Things IoT


with the ARM Mbed 1st Edition Perry Xiao

https://textbookfull.com/product/designing-embedded-systems-and-the-
internet-of-things-iot-with-the-arm-mbed-1st-edition-perry-xiao/

textbookfull.com

Starch Based Polymeric Materials and Nanocomposites


Chemistry Processing and Applications 1st Edition Jasim
Ahmed (Editor)
https://textbookfull.com/product/starch-based-polymeric-materials-and-
nanocomposites-chemistry-processing-and-applications-1st-edition-
jasim-ahmed-editor/
textbookfull.com
BASH SCRIPT Linux Command Line Reference 1st Edition
Aditya Tiwari

https://textbookfull.com/product/bash-script-linux-command-line-
reference-1st-edition-aditya-tiwari/

textbookfull.com

FIXED INCOME ANALYTICS bonds in high and low interest rate


environments 2nd Edition Wolfgang Marty

https://textbookfull.com/product/fixed-income-analytics-bonds-in-high-
and-low-interest-rate-environments-2nd-edition-wolfgang-marty/

textbookfull.com

Building Digital Libraries Second Edition Kyle Banerjee


Terry Reese Jr

https://textbookfull.com/product/building-digital-libraries-second-
edition-kyle-banerjee-terry-reese-jr/

textbookfull.com

Moral Issues in Business William H. Shaw

https://textbookfull.com/product/moral-issues-in-business-william-h-
shaw/

textbookfull.com

Antimony, Gold, and Jupiter's Wolf - How the Elements Were


Named Wothers Peter

https://textbookfull.com/product/antimony-gold-and-jupiters-wolf-how-
the-elements-were-named-wothers-peter/

textbookfull.com
Quantitative Risk Analysis of Air Pollution Health Effects
Louis Anthony Cox Jr.

https://textbookfull.com/product/quantitative-risk-analysis-of-air-
pollution-health-effects-louis-anthony-cox-jr/

textbookfull.com
EM BED D ED SY STEM S:
REAL-TIME OPERATING SYSTEMS FOR
ARM CORTEX-M MICROCONTROLLERS

Volume 3
Fourth Edition,
January 2017

Jonathan W. Valvano
Fourth edition
January 2017
ARM and uVision are registered trademarks of ARM Limited.
Cortex and Keil are trademarks of ARM Limited.
Stellaris and Tiva are registered trademarks Texas Instruments.
Code Composer Studio is a trademark of Texas Instruments.
All other product or service names mentioned herein are the trademarks of their respective
owners.

In order to reduce costs, this college textbook has been self-published. For more
information about my classes, my research, and my books, see
http://users.ece.utexas.edu/~valvano/

For corrections and comments, please contact me at: [email protected].


Please cite this book as: J. W. Valvano, Embedded Systems: Real-Time Operating
Systems for ARM ® Cortex  -M Microcontrollers, Volume 3,
http://users.ece.utexas.edu/~valvano/, ISBN: 978-1466468863.

Copyright © 2017 Jonathan W. Valvano


All rights reserved. No part of this work covered by the copyright herein may be
reproduced, transmitted, stored, or used in any form or by any means graphic,
electronic, or mechanical, including but not limited to photocopying, recording,
scanning, digitizing, taping, web distribution, information networks, or
information storage and retrieval, except as permitted under Section 107 or 108 of
the 1976 United States Copyright Act, without the prior written permission of the
publisher.
ISBN-13: 978-1466468863
ISBN-10: 1466468866
Table of Contents

Preface to The Fourth Edition


Preface to Volume 3
Acknowledgements
1. Computer Architecture
1.1. Introduction to Real-Time Operating Systems
1.1.1. Real-time operating systems
1.1.2. Embedded Systems
1.2. Computer Architecture
1.2.1. Computers, processors, and microcontrollers
1.2.2. Memory
1.3. Cortex-M Processor Architecture
1.3.1. Registers
1.3.2. Stack
1.3.3. Operating modes
1.3.4. Reset
1.3.5. Clock system
1.4. Texas Instruments Cortex-M Microcontrollers
1.4.1. Introduction to I/O
1.4.2. Texas Instruments TM4C123 LaunchPad I/O pins
1.4.3. Texas Instruments TM4C1294 Connected LaunchPad I/O pins
1.4.4. Texas Instruments MSP432 LaunchPad I/O pins
1.4.5. Interfacing to a LaunchPad
1.5. ARM Cortex-M Assembly Language
1.5.1. Syntax
1.5.2. Addressing modes and operands
1.5.3. List of twelve instructions
1.5.4. Accessing memory
1.5.5. Functions
1.5.6. ARM Cortex Microcontroller Software Interface Standard
1.5.7. Conditional execution
1.5.8. Stack usage
1.5.9. Floating-point math
1.5.10. Keil assembler directives
1.6. Pointers in C
1.6.1. Pointers
1.6.2. Arrays
1.6.3. Linked lists
1.7. Memory Management
1.7.1. Use of the heap
1.7.2. Simple fixed-size heap
1.7.3. Memory manager: malloc and free
1.8. Introduction to debugging
1.9. Exercises
2. Microcontroller Input/Output
2.1. Parallel I/O
2.1.1. TM4C I/O programming
2.1.2. MSP432 I/O programming
2.2. Interrupts
2.2.1. NVIC
2.2.2. SysTick periodic interrupts
2.2.3. Periodic timer interrupts
2.2.4. Critical sections
2.2.5. Executing periodic tasks
2.2.6. Software interrupts
2.3. First in First Out (FIFO) Queues
2.4. Edge-triggered Interrupts
2.4.1. Edge-triggered interrupts on the TM4C123
2.4.2. Edge-triggered Interrupts on the MSP432
2.5. UART Interface
2.5.1. Transmitting in asynchronous mode
2.5.2. Receiving in asynchronous mode
2.5.3. Interrupt-driven UART on the TM4C123
2.5.4. Interrupt-driven UART on the MSP432
2.6. Synchronous Transmission and Receiving using the SSI
2.7. Input Capture or Input Edge Time Mode
2.7.1. Basic principles
2.7.2. Period measurement on the TM4C123
2.7.3. Period measurement on the MSP432
2.7.4. Pulse width measurement
2.7.5. Ultrasonic distance measurement
2.8. Pulse Width Modulation
2.8.1. Pulse width modulation on the TM4C123
2.8.2. Pulse width modulation on the MSP432
2.9. Analog Output
2.10. Analog Input
2.10.1. ADC Parameters
2.10.2. Internal ADC on TM4C
2.10.3. Internal ADC on MSP432
2.10.4. IR distance measurement
2.11. OS Considerations for I/O Devices
2.11.1 Board Support Package
2.11.2 Path Expression
2.12. Debugging
2.12.1. Functional Debugging
2.12.2. Performance Debugging (FFT analysis)
2.12.3. Debugging heartbeat
2.12.4. Profiling
2.13. Exercises
3. Thread Management
3.1. Introduction to RTOS
3.1.1. Motivation
3.1.2. Parallel, distributed and concurrent programming
3.1.3. Introduction to threads
3.1.4. States of a main thread
3.1.5. Real-time systems
3.1.6. Producer/Consumer problem using a mailbox
3.1.7. Scheduler
3.2. Function pointers
3.3. Thread Management
3.3.1. Two types of threads
3.3.2. Thread Control Block (TCB)
3.3.3. Creation of threads
3.3.4. Launching the OS
3.3.5. Switching threads
3.3.6. Profiling the OS
3.3.7. Linking assembly to C
3.3.8. Periodic tasks
3.4. Semaphores
3.5. Thread Synchronization
3.5.1. Resource sharing, nonreentrant code or mutual exclusion
3.5.2. Condition variable
3.5.3. Thread communication between two threads using a mailbox
3.6. Process Management
3.7. Dynamic loading and linking
3.8. Exercises
4. Time Management
4.1. Cooperation
4.1.1. Spin-lock semaphore implementation with cooperation
4.1.2. Cooperative Scheduler
4.2. Blocking semaphores
4.2.1. The need for blocking
4.2.2. The blocked state
4.2.3. Implementation
4.2.4. Thread rendezvous
4.3. First In First Out Queue
4.3.1. Producer/Consumer problem using a FIFO
4.3.2. Little’s Theorem
4.3.3. FIFO implementation
4.3.4. Three-semaphore FIFO implementation
4.3.5. Two-semaphore FIFO implementation
4.3.6. One-semaphore FIFO implementation
4.3.7. Kahn Process Networks
4.4. Thread sleeping
4.5. Deadlocks
4.6. Monitors
4.7. Fixed Scheduling
4.8. Exercises
5. Real-time Systems
5.1. Data Acquisition Systems
5.1.1. Approach
5.1.2. Performance Metrics
5.1.3. Audio Input/Output
5.2. Priority scheduler
5.2.1. Implementation
5.2.2. Multi-level Feedback Queue
5.2.3. Starvation and aging
5.2.4. Priority inversion and inheritance on Mars Pathfinder
5.3. Debouncing a switch
5.3.1. Approach to debouncing
5.3.2. Debouncing a switch on TM4C123
5.3.3. Debouncing a switch on MSP432
5.4. Running event threads as high priority main threads
5.5. Available RTOS
5.5.1. Micrium uC/OS-II
5.5.2. Texas Instruments RTOS
5.5.3. ARM RTX Real-Time Operating System
5.5.4. FreeRTOS
5.5.5. Other Real Time Operating Systems
5.6. Exercises
6. Digital Signal Processing
6.1. Basic Principles
6.2. Multiple Access Circular Queue
6.3. Using the Z-Transform to Derive Filter Response
6.4. IIR Filter Design Using the Pole-Zero Plot
6.5. Discrete Fourier Transform
6.6. FIR Filter Design
6.7. Direct-Form Implementations.
6.8. Exercises
7. High-Speed Interfacing
7.1. The Need for Speed
7.2. High-Speed I/O Applications
7.3. General Approaches to High-Speed Interfaces
7.3.1. Hardware FIFO
7.3.2. Dual Port Memory
7.3.3. Bank-Switched Memory
7.4. Fundamental Approach to DMA
7.4.1. DMA Cycles
7.4.2. DMA Initiation
7.4.3. Burst versus Single Cycle DMA
7.4.4. Single Address versus Dual Address DMA
7.4.5. DMA programming on the TM4C123
7.6. Exercises
8. File system management
8.1. Performance Metrics
8.1.1. Usage
8.1.2. Specifications
8.1.3. Fragmentation
8.2. File System Allocation
8.2.1. Contiguous allocation
8.2.2. Linked allocation
8.2.3. Indexed allocation
8.2.4. File allocation table (FAT)
8.3. Solid State Disk
8.3.1. Flash memory
8.3.2. Flash device driver
8.3.3. eDisk device driver
8.3.4. Secure digital card interface
8.4. Simple File System
8.4.1. Directory
8.4.2. Allocation
8.4.3. Free space management
8.5. Write-once File System
8.5.1. Usage
8.5.2. Allocation
8.5.3. Directory
8.5.4. Append
8.5.5. Free space management
8.6. Readers-Writers Problem
8.7. Exercises
9. Communication Systems
9.1. Fundamentals
9.1.1. The network
9.1.2. Physical Channel
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
9.1.3. Wireless Communication
9.1.4. Radio
9.2. Controller Area Network (CAN)
9.2.1. The Fundamentals of CAN
9.2.2. Texas Instruments TM4C CAN
9.3. Embedded Internet
9.3.1. Abstraction
9.3.2. Message Protocols
9.3.3. Ethernet Physical Layer
9.3.4. Ethernet on the TM4C1294
9.4. Internet of Things
9.4.1. Basic Concepts
9.4.2. UDP and TCP Packets
9.4.3. Web server
9.4.4. UDP communication over WiFi
9.4.5. Other CC3100 Applications
9.4. Bluetooth Fundamentals
9.4.1. Bluetooth Protocol Stack
9.4.2. Client-server Paradigm
9.5. CC2650 Solutions
9.5.1. CC2650 Microcontroller
9.5.2. Single Chip Solution, CC2650 LaunchPad
9.6. Network Processor Interface (NPI)
9.6.1. Overview
9.6.2. Services and Characteristics
9.6.3. Advertising
9.6.4. Read and Write Indications
9.7. Application Layer Protocols for Embedded Systems
9.7.1. CoAP
9.7.2 MQTT
9.8. Exercises
10. Robotic Systems
10.1. Introduction to Digital Control Systems
10.2. Binary Actuators
10.2.1. Electrical Interface
10.2.2. DC Motor Interface with PWM
10.3. Sensors
10.4. Odometry
10.5. Simple Closed-Loop Control Systems.
10.6. PID Controllers
10.6.1. General Approach to a PID Controller
10.6.2. Design Process for a PID Controller
10.7. Fuzzy Logic Control
10.8. Exercises
Appendix 1. Glossary
Appendix 2. Solutions to Checkpoints
Reference Material
Preface to The Fourth Edition
There are two major additions to this fourth edition. First, this version supports both
the TM4C and the MSP432 architectures. The material for the LM3S series has been
removed. Volumes 1 and 2 focused on the hardware and software aspects I/O
interfacing. In this volume we provide a set of low level device drivers allowing this
volume to focus on real-time operating systems, digital signal processing, control
systems, and the internet of things. The second addition is Bluetooth Low Energy
(BLE), which will be implemented by interfacing a CC2650, in a similar manner
with which IEEE802.11b wifi is implemented in this book using the CC3100.
Running on the CC2650 will be an application programmer interface called Simple
Network Processor (SNP). SNP allows the TM4C123/MSP432 microcontroller to
implement BLE using a simple set of UART messaging. Off-loading the BLE
functions to the CC2650 allows the target microcontroller to implement system level
functions without the burden of satisfying the real-time communication required by
Bluetooth.
Preface to Volume 3
Embedded systems are a ubiquitous component of our everyday lives. We interact
with hundreds of tiny computers every day that are embedded into our houses, our
cars, our toys, and our work. As our world has become more complex, so have the
capabilities of the microcontrollers embedded into our devices. The ARM Cortex-M
family represents the new class of microcontrollers much more powerful than the
devices available ten years ago. The purpose of this book is to present the design
methodology to train young engineers to understand the basic building blocks that
comprise devices like a cell phone, an MP3 player, a pacemaker, antilock brakes,
and an engine controller.
This book is the third in a series of three books that teach the fundamentals of
embedded systems as applied to the ARM Cortex-M family of microcontrollers. This
third volume is primarily written for senior undergraduate or first-year graduate
electrical and computer engineering students. It could also be used for professionals
wishing to design or deploy a real-time operating system onto an ARM platform. The
first book Embedded Systems: Introduction to ARM Cortex-M Microcontrollers is an
introduction to computers and interfacing focusing on assembly language and C
programming. The second book Embedded Systems: Real-Time Interfacing to ARM
Cortex-M Microcontrollers focuses on interfacing and the design of embedded
systems. This third book is an advanced book focusing on operating systems, high-
speed interfacing, control systems, and robotics.
An embedded system is a system that performs a specific task and has a computer
embedded inside. A system is comprised of components and interfaces connected
together for a common purpose. This book presents components, interfaces and
methodologies for building systems. Specific topics include microcontrollers, design,
verification, hardware/software synchronization, interfacing devices to the computer,
timing diagrams, real-time operating systems, data collection and processing, motor
control, analog filters, digital filters, and real-time signal processing.
In general, the area of embedded systems is an important and growing discipline
within electrical and computer engineering. In the past, the educational market of
embedded systems has been dominated by simple microcontrollers like the PIC, the
9S12, and the 8051. This is because of their market share, low cost, and historical
dominance. However, as problems become more complex, so must the systems that
solve them. A number of embedded system paradigms must shift in order to
accommodate this growth in complexity. First, the number of calculations per second
will increase from millions/sec to billions/sec. Similarly, the number of lines of
software code will also increase from thousands to millions. Thirdly, systems will
involve multiple microcontrollers supporting many simultaneous operations. Lastly,
the need for system verification will continue to grow as these systems are deployed
into safety critical applications. These changes are more than a simple growth in size
and bandwidth. These systems must employ parallel programming, high-speed
synchronization, real-time operating systems, fault tolerant design, priority interrupt
handling, and networking. Consequently, it will be important to provide our students
with these types of design experiences. The ARM platform is both low cost and
provides the high performance features required in future embedded systems.
Although the ARM market share is large and will continue to grow. Furthermore,
students trained on the ARM will be equipped to design systems across the complete
spectrum from simple to complex. The purpose of writing these three books at this
time is to bring engineering education into the 21st century.
This book employs many approaches to learning. It will not include an exhaustive
recapitulation of the information in data sheets. First, it begins with basic
fundamentals, which allows the reader to solve new problems with new technology.
Second, the book presents many detailed design examples. These examples illustrate
the process of design. There are multiple structural components that assist learning.
Checkpoints, with answers in the back, are short easy to answer questions providing
immediate feedback while reading. Homework problems, which typically are
simpler than labs, provide more learning opportunities. The book includes an index
and a glossary so that information can be searched. The most important learning
experiences in a class like this are of course the laboratories. More detailed lab
descriptions are available on the web. Specifically for Volume 1, look at the lab
assignments for EE319K. For Volume 2 refer to the EE445L labs, and for this
volume, look at the lab assignments for EE445M/EE380L.6.
There is a web site accompanying this book
http://users.ece.utexas.edu/~valvano/arm. Posted here are ARM Keil™ uVision®
and Texas Instruments Code Composer Studio™ projects for each of the example
programs in the book. You will also find data sheets and Excel spreadsheets relevant
to the material in this book.
The book will cover embedded systems for ARM ® Cortex™-M microcontrollers
with specific details on the TM4C123, TM4C1294, and MSP432. Most of the topics
can be run on any Texas Instruments Cortex M microcontroller. In these books the
terms MSP432 and TM4C will refer to any of the Texas Instruments ARM Cortex-M
based microcontrollers. Although the solutions are specific for the MSP432 and
TM4C families, it will be possible to use these books for other ARM derivatives.
Acknowledgements
I owe a wonderful debt of gratitude to Daniel Valvano. He wrote and tested most of
the software examples found in these books. Secondly, he maintains the example web
site, http://users.ece.utexas.edu/~valvano/arm. Lastly, he meticulously proofread
this manuscript.
Many shared experiences contributed to the development of this book. First I would
like to acknowledge the many excellent teaching assistants I have had the pleasure of
working with. Some of these hard-working, underpaid warriors include Pankaj
Bishnoi, Rajeev Sethia, Adson da Rocha, Bao Hua, Raj Randeri, Santosh Jodh,
Naresh Bhavaraju, Ashutosh Kulkarni, Bryan Stiles, V. Krishnamurthy, Paul Johnson,
Craig Kochis, Sean Askew, George Panayi, Jeehyun Kim, Vikram Godbole, Andres
Zambrano, Ann Meyer, Hyunjin Shin, Anand Rajan, Anil Kottam, Chia-ling Wei,
Jignesh Shah, Icaro Santos, David Altman, Nachiket Kharalkar, Robin Tsang, Byung
Geun Jun, John Porterfield, Daniel Fernandez, Deepak Panwar, Jacob Egner, Sandy
Hermawan, Usman Tariq, Sterling Wei, Seil Oh, Antonius Keddis, Lev Shuhatovich,
Glen Rhodes, Geoffrey Luke, Karthik Sankar, Tim Van Ruitenbeek, Raffaele Cetrulo,
Harshad Desai, Justin Capogna, Arindam Goswami, Jungho Jo, Mehmet Basoglu,
Kathryn Loeffler, Evgeni Krimer, Nachiappan Valliappan, Razik Ahmed, Sundeep
Korrapati, Song Zhang, Zahidul Haq, Matthew Halpern, Cruz Monrreal II, Pohan
Wu, Saugata Bhattacharyya, Dayo Lawal, Abhishek Agarwal, Sparsh Singhai,
Nagaraja Revanna, Mahesh Srinivasan, Victoria Bill, Alex Hsu, Dylan Zika, Chun-
Kai Chang, Zhao Zheng, Ce Wei, Kelsey Taylor Ball, Brandon Nguyen, Turan Vural,
Schuyler Christensen, Danny Vo, Justin Nguyen, Danial Rizvi, Armand Behroozi,
Vivian Tan, Anthony Bauer, Jun Qi Lau, Corey Cormier, Cody Horton, Youngchun
Kim, Ryan Chow, Cody Horton, Corey Cormier, and Dylan Zika. These teaching
assistants have contributed greatly to the contents of this book and particularly to its
laboratory assignments. Since 1981, I estimate I have taught embedded systems to
over 5000 students. My students have recharged my energy each semester with their
enthusiasm, dedication, and quest for knowledge. I have decided not to acknowledge
them all individually. However, they know I feel privileged to have had this
opportunity.
Next, I appreciate the patience and expertise of my fellow faculty members here at
the University of Texas at Austin. From a personal perspective Dr. John Pearce
provided much needed encouragement and support throughout my career. Over the
last few years, I have enjoyed teaching embedded systems with Drs. Ramesh
Yerraballi, Mattan Erez, Andreas Gerstlauer, and William Bard. Bill has contributed
to both the excitement and substance of our laboratory based on this book. Many of
the suggestions and corrections from Chris Shore and Drew Barbier of ARM about
Volume 1 applied equally to this volume. Austin Blackstone created and debugged the
Code Composer StudioTM versions of the example programs posted on the web.
Austin also taught me how to run the CC3000 and CC3100 Wifi examples on the
LaunchPad.
Ramesh Yerraballi and I have created two MOOCs, which have had over 110,000
students, and delivered to 110 countries. The new material in this book was
developed under the watchful eye of Professor Yerraballi. It has been an honor and
privilege to work with such a skilled and dedicated educator.
Andreas Gerstlauer has taught a course based on this book multiple times, and I have
incorporated many of his ideas into this edition of the book. Furthermore, you will
find a rich set of material if you search with these keywords Gerstlauer RTOS
utexas.
Sincerely, I appreciate the valuable lessons of character and commitment taught to me
by my parents and grandparents. I recall how hard my parents and grandparents
worked to make the world a better place for the next generation. Most significantly, I
acknowledge the love, patience and support of my wife, Barbara, and my children,
Ben Dan and Liz. In particular, Dan designed and tested most of the MSP432 and
TM4C software presented in this book.
By the grace of God, I am truly the happiest man on the planet, because I am
surrounded by these fine people.
Jonathan W. Valvano
Good luck
1. Computer Architecture

Chapter 1 objectives are to:


• Present a brief review of computer architecture
• Overview the ARM ® Cortex ™ -M processor including assembly
language
• Introduce the Texas Instruments MSP432/TM4C family of
microcontrollers

The overall objective of this book is to teach the design of real-time operating
systems for embedded systems. We define a system as real time if there is a
small and bounded delay between the time when a task should be completed
and when it is actually completed. We will present both fundamental principles
and practical solutions. Interfacing to the microcontroller was presented in
detail in Volume 2 and reviewed in the first two chapters of this book. The
overlap allows this book to stand alone as a text to teach embedded real time
operating systems. This first chapter will review the architecture of the Texas
Instruments MSP432/TM4C family of microcontrollers. When designing
operating systems, we need to understand the details of the architecture. In
particular, we must perform many functions in assembly language. Furthermore,
managing memory will require an intimate understanding of how the processor
accesses memory at the most basic level.
1.1. Introduction to Real-Time Operating Systems

1.1.1. Real-time operating systems


A computer system has many types of resources such as memory, I/O, data, and
processors. A real-time operating system (RTOS) is software that manages these
resources, guaranteeing all timing constraints are satisfied. Figure 1.1 illustrates the
relationship between hardware and software. On the left is a basic system without an
operating system. Software is written by a single vendor for a specific
microcontroller. As the system becomes more complex (middle figure), an operating
system facilitates the integration of software from multiple vendors. By providing a
hardware abstraction layer (HAL) an operating system simplifies porting
application code from one microcontroller to another. In order to provide additional
processing power, embedded systems of the future will require multiple
microcontrollers, processors with specialized coprocessors and/or a microcontroller
with multiple cores (right figure). Synchronization and assigning tasks across
distributed processors are important factors. As these systems become more
complex, the role of the operating system will be increasingly important.

Figure 1.1. An operating system is a software layer between the application


software and the hardware.

The RTOS must manage resources like memory, processor and I/O. The RTOS will
guarantee strict timing constraints and provide reliable operation. The RTOS will
support synchronization and communication between tasks. As complex systems are
built the RTOS manages the integration of components. Evolution is the notion of a
system changing to improve performance, features and reliability. The RTOS must
manage change. When designing a new system, it is good design practice to build a
new system by changing an existing system. The notion of portability is the ease at
which one system can be changed or adapted to create another system.
The response time or latency is the delay from a request to the beginning of the
service of that request. There are many definitions of bandwidth. In this book we
define bandwidth as the number of information bytes/sec that can be transferred or
processed. We can compare and contrast regular operating systems with real-time
operating systems.
Regular OS Real-time OS
Complex Simple
Best effort Guaranteed response
Fairness Strict timing constraints
Average bandwidth Minimum and maximum
limits
Unknown components Known components
Unpredictable behavior Predictable behavior
Plug and play Upgradable
Table 1.1. Comparison of regular and real-time operating systems.
From Table 1.1 we see that real-time operating systems have to be simple so they may be
predictable. While traditional operating systems gauge their performance in terms of
response time and fairness, real-time operating systems target strict timing constraints and
upper, lower bounds on bandwidth. One can expect to know all the components of the
system at design time and component changes happen much more infrequently.
Checkpoint 1.1: What does real time mean?

1.1.2. Embedded Systems


An embedded system is a smart device with a processor that has a special and
dedicated purpose. The user usually does not or cannot upgrade the
hardware/software or change what the system does. Real time means that the
embedded system must respond to critical events within a strictly defined time,
called the deadline. A guarantee to meet all deadlines can only be made if the
behavior of the operating system can be predicted. In other words the timing must be
deterministic. There are five types of software functions the processor can perform in
an embedded system. Similar to a general-purpose computer, it can perform
mathematical and/or data processing operations. It can analyze data and make
decisions based on the data. A second type involves handling and managing time: as
an input (e.g., measure period), an output (e.g., output waveforms), and a means to
synchronize tasks (e.g., run 1000 times a second). A third type involves real-time
input/output for the purpose of measurement or control. The fourth type involves
digital signal processing (DSP), which are mathematical calculations on data
streams. Examples include audio, video, radar, and sonar. The last type is
communication and networking. As embedded systems become more complex, how
the components are linked together will become increasingly important.
There are two classifications of embedded systems as shown in Figure 1.2. A
transformative system collects data from inputs, makes decisions, and affects its
environment by driving actuators. The robot systems presented in Chapter 10 are
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
examples of transformative systems. A reactive system collects data in a continuous
fashion and produce outputs also in a continuous fashion. Digital signal processing
algorithms presented in Chapter 6 are examples of reactive systems.

Figure 1.2. Embedded systems can transform or react to the environment.


Six constraints typify an embedded system. First, they are small size. For example,
many systems must be handheld. Second, they must have low weight. If the device is
deployed in a system that moves, e.g., attached to a human, aircraft or vehicle, then
weight incurs an energy cost. Third, they often must be low power. For example, they
might need to operate for a long time on battery power. Low power also impacts the
amount of heat they are allowed to generate. Fourth, embedded systems often must
operate in harsh environments, such as heat, pressure, vibrations, and shock. They
may be subject to noisy power, RF interference, water, and chemicals. Fifth,
embedded systems are often used in safety critical systems. Real-time behavior is
essential. For these systems they must function properly at extremely high levels of
reliability. Lastly, embedded systems are extremely sensitive to cost. Most
applications are profit-driven. For high-volume systems a difference in pennies can
significantly affect profit.
Checkpoint 1.2: What is an embedded system?
Checkpoint 1.3: List the six constraints typically found in an embedded system?
1.2. Computer Architecture

1.2.1. Computers, processors, and microcontrollers


Given that an operating system is a manager of resources provided by the underlying
architecture, it would serve the reader well to get acquainted with the architecture the
OS must manage. In this section we will delve into these details of the building
blocks of computer architecture, followed by the specifics of the ARM Cortex M4
processor architecture, in particular TI’s implementation of the ARM ISA found on
the TM4C and MSP432.
A computer combines a central processing unit (CPU), random access memory
(RAM), read only memory (ROM), and input/output (I/O) ports. The common bus in
Figure 1.3 defines the von Neumann architecture. Software is an ordered sequence
of very specific instructions that are stored in memory, defining exactly what and
when certain tasks are to be performed.

Figure 1.3. The basic components of a computer system include processor,


memory and I/O.
The CPU or processor executes the software by retrieving (from memory) and
interpreting these instructions one at a time. An ARM Cortex-M microcontroller
includes a processor, memory and input/output. The processor, memory and
peripherals are connected via multiple buses. Because instructions are fetched via
the ICode bus and data are fetched via the System bus, the Cortex M is classified as a
Harvard architecture. Having multiple busses allows the system to do several things
simultaneously. For example, the processor could be reading an instruction from
ROM using the ICode bus and writing data to RAM using the System bus.
The ARM Cortex-M processor has four major components, as illustrated in Figure
1.4. There are bus interface units (BIU) that read data from the bus during a read
cycle and write data onto the bus during a write cycle. The BIU always drives the
address bus and the control signals of the bus. The effective address register (EAR)
contains the memory address used to fetch the data needed for the current instruction.
Cortex-M microcontrollers execute Thumb instructions extended with Thumb-2
technology. An overview of these instructions will be presented in Section 1.5. Many
functions in an operating system will require detailed understanding of the
architecture and assembly language.
The control unit (CU) orchestrates the sequence of operations in the processor. The
CU issues commands to the other three components. The instruction register (IR)
contains the operation code (or op code) for the current instruction. When extended
with Thumb-2 technology, op codes are either 16 or 32 bits wide.
The arithmetic logic unit (ALU) performs arithmetic and logic operations. Addition,
subtraction, multiplication and division are examples of arithmetic operations.
Examples of logic operations are, and, or, exclusive-or, and shift. Many processors
used in embedded applications support specialized operations such as table lookup,
multiply and accumulate, and overflow detection.

Figure 1.4. The four basic components of a processor.


A very small microcomputer, called a microcontroller, contains all the components
of a computer (processor, memory, I/O) on a single chip. The Atmel ATtiny and the
TI TM4C123 are examples of microcontrollers. Because a microcomputer is a small
computer, this term can be confusing because it is used to describe a wide range of
systems from a 6-pin ATtiny4 running at 1 MHz with 512 bytes of program memory to
a personal computer with state-of-the-art 64-bit multi-core processor running at
multi-GHz speeds having terabytes of storage.
An application-specific integrated circuit (ASIC) is digital logic that solves a very
specific problem. See Figure 1.5. A field-programmable gate array (FPGA) is one
approach to ASIC prototyping, allowing you to program and reprogram the digital
logic. Verilog and VHDL are example FPGA programming environments. ASIC
design is appropriate for problems defined with logic and/or numerical equations.
On the other hand, microcontrollers are appropriate for problems solved with
algorithms or sequential processes. Mature problems with high volume can create
ASIC solutions directly as digital logic integrated circuits. On the other hand,
microcontrollers can be used for low-volume problems and have the advantage of
having a shorter time to market. Microcontrollers, because they are programmed with
software, allow a flexibility to upgrade features, provide user-tailored performance,
and solve problems with uncertain or changing requirements. Some systems have
both microcontrollers and ASICs.

Figure 1.5. A system implemented with an ASIC and I/O.


In an embedded system the software is converted to machine code, which is a list of
instructions, and stored in nonvolatile flash ROM. As instructions are fetched, they
are placed in a pipeline. This allows instruction fetching to run ahead of execution.
Instructions on the Cortex-M processor are fetched in order and executed in order.
However, it can execute one instruction while fetching the next. Many high-speed
processors allow out of order execution, support parallel execution on multiple
cores, and employ branch prediction.
On the ARM Cortex-M processor, an instruction may read memory or write memory,
but does not read and write memory in the same instruction. Each of the phases may
require one or more bus cycles to complete. Each bus cycle reads or writes one
piece of data. Because of the multiple bus architecture, most instructions execute in
one or two cycles. For more information on the time to execute instructions, see
Table 3.1 in the Cortex-M Technical Reference Manual.
Figure 1.6 shows a simplified block diagram of a microcontroller based on the ARM
Cortex-M processor. It is a Harvard architecture because it has separate data and
instruction buses.

Figure 1.6. Harvard architecture of an ARM Cortex-M-based


microcontroller.
The instruction set combines the high performance typical of a 32-bit processor with
high code density typical of 8-bit and 16-bit microcontrollers. Instructions are
fetched from flash ROM using the ICode bus. Data are exchanged with memory and
I/O via the system bus interface. There are many sophisticated debugging features
utilizing the DCode bus. An interrupt is a hardware-triggered software function,
which is extremely important for real-time embedded systems. The latency of an
interrupt service is the time between hardware trigger and software response. Some
internal peripherals, like the nested vectored interrupt controller (NVIC),
communicate directly with the processor via the private peripheral bus (PPB). The
tight integration of the processor and interrupt controller provides fast execution of
interrupt service routines (ISRs), dramatically reducing the interrupt latency.
Checkpoint 1.4: Why do you suppose the Cortex M has so many busses?
Checkpoint 1.5: Notice the debugger exists on the DCode bus. Why is this a good
idea?

1.2.2. Memory
One kibibyte (KiB) equals 1024 bytes of memory. The TM4C123 has 256 kibibytes
(218 bytes) of flash ROM and 32 kibibytes (215 bytes) of RAM. The MSP432 also has
256 kibibytes (218 bytes) of flash ROM but has 64 kibibytes (216 bytes) of RAM. We
view the memory as continuous virtual address space with the RAM beginning at
0x2000.0000, and the flash ROM beginning at 0x0000.0000.
The microcontrollers in the Cortex-M family differ by the amount of memory and by
the types of I/O modules. There are hundreds of members in this family; some of them
are listed in Table 1.2. The memory maps of TM4C123 and MSP432 are shown in
Figure 1.7. Although this course focuses on two microcontrollers from Texas
Instruments, all ARM Cortex-M microcontrollers have similar memory maps. In
general, Flash ROM begins at address 0x0000.0000, RAM begins at 0x2000.0000,
the peripheral I/O space is from 0x4000.0000 to 0x5FFF.FFFF, and I/O modules on
the private peripheral bus exist from 0xE000.0000 to 0xE00F.FFFF. In particular, the
only differences in the memory map for the various members of the Cortex-M family
are the ending addresses of the flash and RAM.
Part number RAM Flash I/O I/O modules
MSP432P401RIPZ 64 256 84 floating point, DMA
TM4C123GH6PM 32 256 43 floating point, CAN, DMA,
USB, PWM
TM4C1294NCPDT 256 1024 90 floating point, CAN, DMA,
USB, PWM, Ethernet
STM32F051R8T6 8 64 55 DAC, Touch sensor, DMA,
I2S, HDMI, PWM
MKE02Z64VQH2 4 64 53 PWM
KiB KiB pins
Table 1.2. Memory and I/O modules (all have SysTick, RTC, timers, UART, I2C, SSI, and
Random documents with unrelated
content Scribd suggests to you:
The Project Gutenberg eBook of Gay
gods and merry mortals: some
excursions in verse
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

Title: Gay gods and merry mortals: some excursions in verse

Author: Robert J. Shores

Release date: December 29, 2020 [eBook #64170]

Language: English

Credits: Charlene Taylor, Susan Carr and the Online Distributed


Proofreading Team at https://www.pgdp.net (This file
was produced from images generously made available
by The Internet Archive/American Libraries.)

*** START OF THE PROJECT GUTENBERG EBOOK GAY GODS AND


MERRY MORTALS: SOME EXCURSIONS IN VERSE ***
G AY G O D S
and
M E R RY M O RTA L S
GAY GODS AND
MERRY MORTALS

SOME EXCURSIONS IN VERSE


BY ROBERT J. SHORES

BROADWAY PUBLISHING CO.


NEW YORK
1910
COPYRIGHT, 1910,
BY
ROBERT J. SHORES
T I T L E S A N D PA G E S
Proem 7
Actæon 8
Adonis 10
Proserpina 13
Anaxarete 16
Penelope 18
Sappho 20
Syrinx 22
Tithonus 24
Ariadne 27
Io 29
Dido 32
Daphne 37
Gay Gods and Merry Mortals

PROEM.

S OME ancient tales of Pagan days


The author of this book relates
Explaining how in divers ways
The gods displayed their human traits;
And how they oft in other years
Set human beings by the ears.

Belike these rhymes recall to you


The jingles of the poet Saxe;
The poet here is Saxon, too,
And so must needs relate his facts
In such a way that they are clear
And suited to the Saxon ear.

Some anecdotes which Homer told


You’ll miss in this; but reader, pray
Consider, what was good of old
Would never pass the mails to-day.
And hence this history belated
Has been—well, slightly expurgated.
A C TÆ O N .
“He saw her charming,
but he saw not half
The charms her
downcast modesty
concealed.”

Thomson.
A CTÆON, with the winding horn,
Pursued the Chase in ardent youth
And what he wore when he was born;
(And little else, to tell the truth,
For in those days of which I speak
They just changed sandals once a week!)
And as he wandered from the path,
Chanced on Diana in her bath.

All trembling, like a startled fawn,


Upstarted then the Goddess chaste,
Sprang from the pool the bank upon
And donned her crescent in great haste,
(For, to her credit be it said,
She did wear something on her head,)
Then, the conventions satisfied
Gazed on Actæon, haughty-eyed.

Actæon tumbled in a trice


That he had got himself in Dutch,
But thought if quite polite and nice
She would not mind the thing so much.
So the poor fool in this fond hope
Said, “Tell me, did you use Pear’s Soap?”
Diana, vexed to hear the gag,
Forthwith made Actæon a stag.

The Moral is, if you should chance


Upon a lady in the nude,
Remember this sad circumstance,
For she’ll get even if you’re rude;
And conversation, if uncouth,
May cost you dear in naked truth!
A D O N I S.
D AN CUPID with a broken shaft
Had bent his grand-dad, Jove, quite double,
And then, to cap the climax, laughed;
And so he found himself in trouble;
Up on that august lap was yanked
And thoroughly and soundly spanked,
Till Cupid saddened, sobered, sore,
Wished that his wings had sprouted lower.

Dan Cupid then in rage and grief


Straightway set out to find his mother,
Who stitched upon her evening leaf,
(She swore she didn’t have another,
Or, if she had, she still would swear
She had none that was fit to wear.)
And so the naughty youngster found her
With leaves and sewing girls around her.

When Venus heard her infant’s wail,


In apprehension she besought him
To tell her all his angry tale;
Then to her breast she, breathless, caught him.
And, as his tear-stained face she kissed,
Upon an arrow scratched her wrist.
So in her veins in this strange fashion
Was introduced the germ of passion.

Indignant at the godlet’s tale,


She hastened to protest to Zeus,
Her lovely cheek with anger pale,
She was prepared to raise the deuce.
But as Olympus’ mount drew near,
She spied Adonis chasing deer.
And in a moment from her head
All thoughts of wrath and Cupid fled.
Straightway she hitched her gentle team
Of doves, and left her carriage standing,
For this fair youth to her doth seem
A hero, comely and commanding—
Although in fact and eke in truth
He was a simple country youth;
And so it happened that the Queen
Of Beauty found him shy and green

Now, Venus, veteran at the game


Of flirting, would not be denied;
As goddesses can feel no shame,
She soon was anchored to his side;
Do what he would, he could not shake her,
Go where he would, he had to take her;
Until one morn upon the plain
She found the fair Adonis slain.

This story should a warning be


To maidens bold who wish to woo,
For if you seek your lover, he
Most certainly will not seek you;
All men may love, but just the same
They would be hunters—not the game.
Adonis, so the story saith,
Was really simply boared to death!
PROSERPINA.
“Forth reaching to the
fruit, she pluk’d, she
eat;
Earth felt the wound,
and Nature from her
seat
Sighing through all her
works gave signs of woe
That all was lost.”

Milton.
O N Aetna’s isle Dis Pluto drove
His devil-wagon one fine day,
And passing through fair Enna’s grove
Beheld Proserpina at play;
He asked, “Will you not take a ride?”
“You’re very kind,” the maid replied,
And stepped into his turn-out swell;
And that was how she went to hell.

For Pluto, whipping up his team,


Sped on toward Tartarus in mirth,
And when opposed by Cyane’s stream,
He took a short-cut through the earth.
Nor paused, nor drew his rein before
He heard Cerberus’ welcome roar,
And sniffed the smell of singeing soul
By which he knew he’d reached his goal.

Ceres, Proserpina’s mamma,


Was almost crazed with grief and fear;
(As to Proserpina’s papa,
His name I never chanced to hear),
She cursed for all that she was worth
The crops and fruits of Mother Earth;
“You’ll bear no fruit,” she told the Ground,
“Until my Prossie has been found!”

Jove, who beheld the farmer’s need,


And saw the season’s crops all fail,
Said, “This is Cereous, indeed,
That fellow Dis should be in jail!”
“I think,” said Juno, “’twere as well—
It does no good to give him hell;”
And so it might have been decreed
But for one small pomegranate seed.
In Hades Ceres’ daughter sweet
Was offered luscious bread and jam,
But she was much too cross to eat
And even scorned the deviled ham;
Until at last she made a slip
And swallowed a pomegranate pip;
Now, they who eat in hell—alack!
To earth may never more come back.

The Moral is—don’t take a chance


Joy-riding with a strange chauffeur,
Remember this sad circumstance
Or you will get in trouble sure.
If you must go—don’t go alone,
The devil hates a chaperone.
So mind the pips and look alive—
Dis Pluto often goes to drive!
ANAXARETE.
I N Cyprus dwelt Anaxarete,
A maiden famous for her beauty,
With disposition far from sweet,
Who looked on flirting as a duty.
’Tis said she scarcely would despise
At slaves and such to roll her eyes,
’Till most the men of Cyprus were
In love, or half in love with her.

Young Iphis was a worthy lad


And born of parents poor but proud;
He was a credit to his dad,
Until one day while in a crowd
He chanced a college chum to meet
Out walking with Anaxarete;
And when she rolled her lovely eyes
Poor Iphis gasped in glad surprise.

One glance, and Iphis was her slave,


All other interests he forgot;
Forgot to eat, forgot to shave,
And wrote in rhyme a deal of rot
To prove his heart was at the feet
Of stony-cold Anaxarete;
Who met his protests and his tears
With cutting jests and crushing sneers.

For Ana, as do all coquettes,


So soon grew aweary of his wooing,
And Iphis took to cigarettes,
But still she answered “Nothing doing!”
And added—insult ne’er forgotten!
She thought his poetry was rotten;
And finally to fix his place
She slammed the door in Iphis’ face.
When Iphis saw that all was past,
And knew that he could call no more,
He took a rope and made it fast
And hanged himself before her door.
And, when his funeral passed her place,
She thought to mock his pallid face;
But Venus, leaning from her throne,
Had seen, and turned the maid to stone.

At Salamis, her statue still


Points to the Moral of this tale—
That any maid who flirts to kill
Is really quite beyond the pale.
And as for lovers; let me say
If she is bored, just go away;
No gentleman, and this I know,
Will hang about when he’sde trop!
P E N E LO P E .
“Good-nature and good-
sense must ever join;
To err is human, to
forgive, divine.”
—Pope.
P ENELOPE, a Spartan maid,
The brave Ulysses wooed and wed,
She in a modest blush arrayed,
He with a crown upon his head.
Two hearts that beat as one—no tear
Bedimmed their bliss for one whole year;
At Ithaca they dwelt in peace—
Not Ithaca, New York—but Greece.

Alas! Scarce had been born their boy,


An infant very fair and bright,
When came a horrid war in Troy
And papa had to go and fight.
He left Penelope in tears—
He went and stayed for years and years;
And while away, I am afraid,
He sometimes wooed another maid.

In many lands he dwelt as guest


Of ladies of exceeding beauty;
Ulysses, it must be confessed,
In flirting quite forgot his duty.
He flirted here, he flirted there,
In fact he flirted everywhere—
With Calypso, Nausicaa, Circe—
And he a man of family—Mercy!

Penelope, dissolved in tears,


Bewailed her spouse—the faithless Turk!
And stood off suitors twenty years
By doing endless fancy work.
By day she made her stitches right,
But pulled them out again by night,
Until her husband, tired of larks,
Came home and slew that bunch of sparks.
The husband, even though he err
And lead abroad a lively life,
Dislikes, when he comes back to her,
To find that others woo his wife.
Ulysses lacked in morals—true,
But she had quite enough for two—
May Eros grant a wife to me
As patient as Penelope!
SA P P H O.
S APPHO was pretty all agree,
Some say that she was stately,
You cannot prove it, though, by me—
I haven’t seen her lately.
In fact, I do not now recall
I ever saw the girl at all.
So we must take Dame Rumor’s word
That Sappho was, indeed, a bird.

Now, Sappho in her younger years,


Was wooed by men a-plenty,
And setting suitors by the ears
Amused her much at twenty.
She swore she’d not, at twenty-five,
Accept the nicest man alive,
And laughed to scorn the ardent Greek
Who sought to kiss her damask cheek.

But Sappho finds as years roll on,


As oft a maid discovers,
That when a maiden’s youth is gone,
Gone also are her lovers.
No suitor hangs about her door
To wait her coming as of yore;
And what is worse than all above—
Just at this stage she falls in love.

Just what she does, if tales are truth,


(Fie on that rascal Cupid!)
Is to select a verdant youth,
A handsome boy, but stupid!
She tries her best to win his heart
With all her once unfailing art,
But finds—ah, Eros! think of that!
That Phaon thinks her old and fat.
Poor Sappho keenly feels the shame
Of love quite unrequited,
And though she knows herself to blame,
She feels her life is blighted.
And so when some one tells her if
She will jump off a handy cliff
’Twill cure her of her love and dumps—
She rushes out—ah! ah—she jumps!

Ah, reader, let us pause right here


To drop a tiny, briny tear;
Alas! Alack! Oh, woeful sight—
It cured her of her love, all right!
Fair maidens, heed this circumstance—
Don’t jump off cliffs—jump at your chance!
SYRINX.
“Poor nymph—poor Pan—
how he did weep to find
Naught but a lovely sighing
of the wind
Along the reedy stream; a
half-heard strain,
Full of sweet desolation,
balmy pain.”
—Keats.
I N Greece there dwelt in days gone by
A maiden huntress, passing fair,
Who lived beneath the open sky
And dearly loved the open air.
Although it really seems a shame
To call a lady such a name,
This lovely nymph was called, methinks,
S-y-r-i-n-x, Syrinx.

Syrinx, while following the Chase,


Was seen one day by ardent Pan,
A god of most repulsive face,
A sort of burlesque on a man.
If we can trust what ancients wrote,
Poor Pan was really half a goat—
Not like the Peter Pan to-day
The Misses Chase and Adams play.

When Pan began swift to pursue,


The maiden in her terror fled,
(I cannot blame her much, can you?)
And ran ’till she was almost dead;
But friendly spirits in a stream
Had heard and understood her scream,
And they had changed her in a wink
To reeds upon the river’s brink.

The god, though thwarted in his scheme


To win the nymph, was not dismayed.
He plucked the reeds beside the stream
And from them a “Syrinx” he made.
The shepherd’s pipes—so came to man
The music of the Pipes o’ Pan.

The Moral? There is none; you see


Pan was, as poets all agree,

You might also like