Slide 1

Slide 1 text

AUTSat MicroSatellite Software and Operating System Morteza Ansarinia Mostafa Salarirad

Slide 2

Slide 2 text

• Separated functionality into multiple physically independent hardware subsystems • Single integrated hardware. Softwares control subsystems

Slide 3

Slide 3 text

• Multitasking • Resource allocation • Reliability, safety and software recovery

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Application Layer Operating System Hardware Abstract Layer Hardware

Slide 7

Slide 7 text

Processor Reset Initialize Hardware Initialize C/C++ Runtime. Jump to main() Initialize and Start Kernel Create Default Threads (Supervisor, ...) Power Thread Thermal Thread Health Checker Thread ACDS Thread Payload Thread Supervisor Thread Telecommand Thread Telemetry Thread Hardware Abstract Layer

Slide 8

Slide 8 text

Operating System MicroC/OS-II Pros ANSI C Preemptive Multitasking Semaphore, Mutex, Timer, Message Management Fixed Sized Memory Management Low Cost (Free), Low Size Reliable, Low Interrupt Latency

Slide 9

Slide 9 text

Operating System MicroC/OS-II Cons No Object Oriented Support Complicated Message and IO Management No Error Recovery Fixed Sized Memory Management ...

Slide 10

Slide 10 text

Operating System Improvements • Object Oriented Kernel • Integrate Interrupts, IO, Message, ... into “Message” • Hardware Abstract Layer • Filesystem • Exception Handling • Error Recovery • Bootloader • ...

Slide 11

Slide 11 text

Operating System AnytimeOS Kernel namespace OS { } Thread Timer Queue Event Message Mutex List Priority Queue Semaphore Scheduler Port

Slide 12

Slide 12 text

Operating System Filesystem • saveBool ( “power.health” , true ) ; • saveInt ( “thermal.sensors.count” , 50 ) ; • saveDouble ( “power.temp” , 24.2 ) ; • saveString ( “error.module.name” , “c&dh” ) ; • bool health = getBool ( “c&dh.health” , true ) ;

Slide 13

Slide 13 text

Operating System Thread Structure • Main() • init() • halt() • Thread Workspace • newInt() • newDouble() • newBool()

Slide 14

Slide 14 text

Operating System Scheduler • Unlimited number of threads • Round Robin Thread Scheduling • Same Priority • Avoid Priority Inversion • Dynamic Priority

Slide 15

Slide 15 text

Operating System Mars Pathfinder (1997) • A few days into the mission, the spacecraft began experiencing system resets. • Official Report: • software glitches • the computer was trying to do too many things at once

Slide 16

Slide 16 text

Operating System Mars Pathfinder (1997) ... The failure was identified by the spacecraft as a failure of the bc_dist task to complete its execution before the bc_sched task started. The reaction to this by the spacecraft was to reset the computer. This reset reinitializes all of the hardware and software. It also terminates the execution of the current ground commanded activities. No science or engineering data is lost that has already been collected (the data in RAM is recovered so long as power is not lost). However, the remainder of the activities for that day were not accomplished until the next day. The failure turned out to be a case of priority inversion. ... Glenn E Reeves Software Team Leader

Slide 17

Slide 17 text

Operating System Priority Inversion a low priority task holds a shared resource that is required by a high priority task

Slide 18

Slide 18 text

Operating System Priority Inversion Solutions 1. Disable all interrupts to protect critical section • Keep critical sections very brief, under 100uS in practical systems • Core::lock() • Core::unlock()

Slide 19

Slide 19 text

Operating System Priority Inversion Solutions 2. Priority Ceiling

Slide 20

Slide 20 text

Operating System Priority Inversion Solutions 3. Priority Inheritance • Keep medium priority threads from preempting the low priority thread • Scheduler::doSchedule() • Thread::waitOnSemaphore() • Thread::waitOnMutex()

Slide 21

Slide 21 text

Operating System Self Healing and Recovery 1. Exception Handling 2. Component Micro Rebooting 3. Watchdog-Based Recovery

Slide 22

Slide 22 text

Operating System Self Healing and Recovery 1. Exception Handling - Commonly used to signal error conditions in application codes. - Allows system developers to write code to handle errors like illegal opcodes in the OS using C++ “catch”.

Slide 23

Slide 23 text

Operating System Self Healing and Recovery 1. Software Watchdog Recover Livelocks (can’t prevent infinite loops)

Slide 24

Slide 24 text

Operating System Self Healing and Recovery 2. Component Micro-Rebooting - Most of OS components supports init(), reset() and stop()

Slide 25

Slide 25 text

Simple Application

Slide 26

Slide 26 text

Simple Application simple.hpp #include using namespace OS; Workspace workspace (1024); Class SimpleThread : Thread { public: SimpleThread() : Thread(“SimpleThread”, 100, workspace); protected: virtual void Main(); } SimpleThread simpleThread1(); SimpleThread simpleThread2(); SimpleThread simpleThread3();

Slide 27

Slide 27 text

Simple Application simple.cpp #include virtual void SimpleThread::Main(){ printf(“Hello World!”); }

Slide 28

Slide 28 text

Operating System Bootloader - Two Operating System (Simple, Normal) - Download OS image from the ground station