Skip to main content

Posts

Showing posts from September, 2008

Tasks, Process and Threads

Process
Sequential Execution of Instructions

Tasks
Each task is independent since it is controlled by a scheduler or kernel of an Operating SystemNo task can call other tasks. since the Scheduler schedules the tasksEach task is associated with an ID. Each task has priority. for a 1 byte priority assignment, values 0 to 255 is used. higher the value higher the priorityEach task should coded in such a way that, they are waiting for a endless - event waiting loop.Each task has a Task Control Block (TCB)Each task will be having its own context and values at an instant. it is having its own Program counter(PC) and stack pointer (SP.Each task will be in any one of the following 4 statesidle - After the completion of one cycle of execution, a task will be in idle state until an event is firedready - the task is ready to execute on the CPU, but the CPU is busy with executing higher priority tasksRunning - currently the task is executing on the CPU - only one task can be in this state at any poin…

Software Maintenance

There are five types of software maintenance
Preventive Maintenance - A system may be checked and maintained periodicallyCorrectiveMaintenance - Correct the deviation noticed under certain conditions of field use of the systemPerfectionorEnhancementMaintenance - development team delivers a system on schedule and then finds another design capable of working more accurately and effectivelyAdaptiveMaintenance - Adapt the software to new conditionsSystemReengineering - previously developed system is reengineered.

Software Project Management

People
People Senior Manager
1. Responsible for creating environment,
2. Organising, coordinating and managing all communications

Project Technical Manager or Team Leader
1. Selecting the language and tools
2. reorganize available software specification
3. Maintain activity graph for starting
4. motivates and encourage implementors

Implementors
1. Implements the software and hardware development process
2. uses modeling, source code engineering, testing

Customer or End User
1. Specifies the product and its quality requirements


Product
Embedded System product

Process
1. Product Development partitioned into smaller components and modules so that activities defined in the graph for activity are finished

Project
1. Design
2. Planning
3. Implementing and testing
4. Debugging and Maintaining

Square Wave Generation using Delay

Delay Calculation
Crystal frequency = 11.059MHz.
1 machine cycle = 1 / (11.059/12) = 1.085μ s
For 1second delay1.085μ s * 921660 = 1 sec (approx)


#include <reg51.h>
main()
{
int i,j;
P0=0xff;
for(i=0;i<=1000;i++)
{
for(j=0;j<=490;j++);
}
P0=0x00;
for(i=0;i<=1000;i++)
{
for(j=0;j<=458;j++);
}
}

Sine Wave Generation

#include reg51.h>
at 0x2000 xdata char sinetable[13];
at 0x80 sfr sineout;
char dacout;
char i;
void timer_isr(void) interrupt 1
{
TF0=0;
dacout = sinetable[i++];
TH0= 0xff;
TL0=0xfb;
TR0=1;
if(i>13)
{
dacout = sinetable[0];
i=1;
}
}
void main()
{
sinetable [0] = 128; //0
sinetable [1] =192; //30
sinetable [2] =238; //60
sinetable [3] =255; //90
sinetable [4] =238;
sinetable [5] =192;
sinetable [6] =128;
sinetable [7] =64;
sinetable [8] =17;
sinetable [9] =0;
sinetable [10] =17;
sinetable [11] =64;
sinetable [12] =128;
i=0;
IE=0x82;
TMOD=0x01;
TCON = 0x01;
TH0 = 0xff;
TL0 = 0xFb;
TR0=1;
dacout = sinetable [i++];
for (;;);
}

Issues in Real Time Software Development

Issues in Requirement Analysis and Design
Inter Process Communication Fault Tolerance and ReliabilityEvent LatenciesMaximum Latencies of ISRsMaximum response TimeIssues in Implementation
Selection of OS (RTOS)Selection of Processors, Hardware, Memory and its SizeSelection of Programming LanguagePower Management using wait and sleep modeCaches to be used or notIssues in Testing
Testing the Inter Process Communication (IPC)Testing Parallelism and ConcurrencyTesting Memory and Stack OverflowTesting Software Portability in HardwareTesting Software Hardware IntegrationTesting the program flow in critical regions for shared dataTesting the throughput from the tasks and ISRs

Software Testing, Verifiying and Validating

Verification- to ensure that all the specific functions are correctly implemented
Validation- to ensure that the software that has been created is as per the requirments agreed upon at the analysis phase and to ensure its quality
Testing
White Box Testing (also called as Glass Box) Testing the program flowTesting the conditionstesting all the loop indices (start to last)all logical pathstesting the function control structures and looping structureBlack Box Testing (Behavioral testing) testing in done with set of input conditions and eventsperformance testingSpecific Environment Testing Testing GUI and User InterfaceClient Server TestingTest the display and keypadTesting the help utilities and DocumentsComparison Testing Several available versions are running in parallel and the functions and behavior comparedDebugging
Laboratory tools like Simulator, IDE, etcProgram Break PointsMacrosOutput files for InputsScopes (CRO, Storage Oscilloscopes, Logic Analyzer,etc)

Software Implementation

Use of language in which the software team has expertise and experienceUse an Operating System or RTOS that is more appropriate. (Small scale does not need RTOS, so code size will be reduced much)Simpliciyt to be maintained. Each function should perform a single task and have simple designComments must be added before control statementsProgram implementation should be as per design specification.Make function implementation general, not tied to specific input conditions or events. This makes reuse earlier.Redesigning might be needed to solve software implementation difficulties

Software Development Life Cycle (SDLC)

Phases in Software Development
Definition and Analysis of System Requirements
Clarity of the Specifications
Specifications are obtained for
Required processing of data
Necessary functions & tasks and their expected performance
Expected system behavior
Design constraints
Life cycle of the product
Development
Software design, coding and testing are the main activities in the development process.
Support
Software should need little support for software reengineering by changing environment
Models for process Life Cycle
Linear Sequential Life cycle model
Model/ Analyze
Design of data structures, software architecture, Interfaces and Algorithms
Testing the internal logic and external functions
Rapid Development Model (RAD)
Each software component of Linear Model developed by a team
Stage 1 – Business modeling
Stage 2 – Characteristics and attributes of sets of Data Structures and objects, data modeling, software architecture
Stage 3 – Description of adding, deleting, modifying and retrieving data objects
Sta…

Use of Graphs in Multiprocessor Systems

Each task or function executed in an assigned processor
PA, PB – are two processors A and BV1’,V2’,V3’ – three threads of task 1V12 ,V22 ,V32 – Three threads of task 2 Each task or function is executed on different processors at different periods


Instructions of four different tasks partitioned on two processors

Instructions of four different tasks partitioned and scheduled on two processors differently at different periods
PA, PB – are two processors A and BV1’,V2’,V3’ – three threads of task 1V12 ,V22 ,V32 – Three threads of task 2 C11,C12 - Instructions for Task 1C21, C22 - Instructions for Task 2C31, C32 - Instructions for Task 3