embedded system unit5
embedded system unit5
Firmware development involves low-level programming to interact with hardware. Commonly used languages include:
• Used in high-level embedded applications like IoT, AI, and ML-based embedded systems.
• Advantages:
Conclusion
• C and C++ are the most common languages due to efficiency and portability.
• Python and Rust are emerging for specific use cases in modern embedded systems.
Unit-6 Real-Time Operating System (RTOS) Based Embedded System Design
An Operating System (OS) is software that manages hardware and software resources in a computer system. It
provides a stable environment for running applications and facilitates user interaction with hardware devices.
• Process management
• Memory management
• File system management
• Input/Output (I/O) management
• Security and error detection
2. Types of OS
There are different types of operating systems based on their application and characteristics:
• Batch OS: Executes jobs without user interaction. Examples: Early mainframe systems.
• Time-sharing OS: Allows multiple users to share system resources. Examples: UNIX, Linux.
• Real-Time OS (RTOS): Designed for applications requiring timely and predictable responses. It manages real-time
tasks within strict time constraints.
• Distributed OS: Manages multiple interconnected systems, appearing as a single entity to users.
• Network OS: Facilitates communication between systems over a network. Examples: Windows Server.
• Task: A unit of work that the RTOS manages. In embedded systems, tasks are often used interchangeably with
processes.
• Process: An independent program that runs in its own memory space. Each process is isolated from others.
• Thread: A lightweight process that shares memory and resources with other threads within the same process.
Threads help achieve concurrency.
Key Differences:
• A process has its own memory space; a thread shares the same memory space with other threads in the same
process.
• Threads are more lightweight compared to processes and involve less overhead.
• Multiprocessing: Refers to using two or more processors (CPUs) in a system to execute tasks simultaneously,
improving performance and processing speed.
• Multitasking: The OS’s ability to run multiple tasks (or processes) simultaneously by switching between them
quickly. This gives the illusion that all tasks are running concurrently.
5. Task Scheduling
Task scheduling is the method used by an RTOS to determine which task will run next, and for how long, based on
certain criteria such as priority, timing, and deadlines.
Types of Scheduling Algorithms:
• Preemptive Scheduling: Allows tasks to be interrupted and resumed later, ensuring that higher-priority tasks are
executed first.
• Non-preemptive Scheduling: Tasks run to completion before another task is scheduled, often used in less
complex systems.
• Round-Robin Scheduling: Each task is allocated a fixed time slot in turn.
• Priority Scheduling: Tasks are assigned priorities, and higher-priority tasks are scheduled first.
In RTOS, managing threads and processes efficiently is crucial to meeting the real-time deadlines of applications.
Scheduling algorithms need to ensure:
• Threads that need to be executed are scheduled in a way that their deadlines are met.
• Synchronization mechanisms are used to manage shared resources.
• Task dependencies are handled in a way that ensures smooth execution.
7. Task Communication
Task communication is essential in RTOS-based systems to allow tasks to share data and synchronize actions.
8. Task Synchronization
Synchronization ensures that tasks and threads do not conflict when accessing shared resources, which can lead
to data inconsistency or errors.
Synchronization Mechanisms:
• Semaphores: Used to manage access to shared resources by controlling the execution sequence of tasks.
• Mutexes: A specialized form of semaphore, used for mutual exclusion to ensure only one task accesses a resource
at a time.
• Event Flags: Signals sent between tasks to indicate state changes or task readiness.
• Critical Sections: Code sections that need to be executed without interruption, ensuring exclusive access to
shared resources.
9. Device Drivers
Device drivers are software components that allow the operating system to interact with hardware devices. They
act as a bridge between the hardware and higher-level software, abstracting hardware details from the user.
• Character Drivers: Manage devices that deal with data as a stream of bytes (e.g., keyboards, serial ports).
• Block Drivers: Manage devices that store data in blocks (e.g., hard drives, flash drives).
• Network Drivers: Facilitate communication between a computer system and networking devices (e.g., Ethernet).
Choosing the right RTOS for an embedded system is critical to meeting real-time constraints and achieving system
reliability.
Factors to consider:
• Real-Time Requirements: The RTOS must guarantee that tasks meet their deadlines with predictable behavior.
• System Resources: Consider the available CPU power, memory, and I/O capabilities.
• Scalability: The RTOS should be able to handle system growth and evolving needs.
• Support for Multitasking: Evaluate the support for task scheduling and communication.
• Security Features: For systems handling sensitive data, security features are essential.
• Developer Support: Consider the availability of documentation, support forums, and community engagement.
• Cost and Licensing: Some RTOS options are free (open-source), while others require commercial licensing.
Conclusion
The use of RTOS-based embedded system design is fundamental for real-time applications where timing is critical.
It involves understanding concepts like task management, scheduling, synchronization, and communication. The
selection of an RTOS plays a significant role in ensuring that embedded systems meet performance and reliability
requirements.
Embedded system development ka environment kaafi complex hota hai aur isme kai tools aur techniques involved hote
hain. IDEs, crosscompilation, simulators, emulators, debugging tools, target hardware debugging, aur boundary scan ka use
karna important hai taaki embedded software ko hardware ke saath efficiently design, test, aur debug kiya ja sake. Har ek
tool ka apna role hai jo embedded systems ke development ko smooth banata hai aur errors ko minimize karta hai.
Unit-7 The Embedded System Development Environment
IDE (Integrated Development Environment) ek software tool hota hai jo embedded systems ke development ke liye use
hota hai. Ye developers ko code likhne, test karne, aur debug karne mein madad karta hai. IDE me kai important tools
integrated hote hain, jise use karke software development process ko streamline kiya jata hai.
• Code Editor: Ye wo jagah hoti hai jahan aap source code likhte ho. Code editor mein features like syntax
highlighting, auto-completion etc. hote hain jo code likhne mein madad karte hain.
• Compiler: Ye source code ko machine code (binary) mein convert karta hai jo embedded system pe run hota hai.
• Debugger: Ye tool code mein bugs ya errors ko identify karne aur fix karne ke liye use hota hai.
• Build System: Ye software ko compile karne aur link karne ka process manage karta hai.
• Simulator/Emulator: Code ko hardware par deploy karne se pehle test karne ke liye ye tools use kiye jaate hain.
• Version Control: Ye tool aapke code ki history track karta hai, taaki aap changes ka pata laga sakein.
• Cross Compiler: Ye tool ek architecture (jaise PC) par likha gaya code dusre architecture (embedded system) ke
liye compile karta hai.
Examples:
Embedded systems development mein, code generally host machine (jaise PC) pe likha jata hai, lekin wo target machine
(jaise microcontroller) pe run hota hai. Crosscompilation ka matlab hai ki aap ek platform pe code likh kar dusre platform
pe usse run karwana.
• Source Code Files (.c, .cpp, .h): Ye wo original files hoti hain jo developer likhta hai.
• Object Files (.o, .obj): Ye files source code ko compile karke banayi jati hain. Inme machine-level code hota hai,
lekin ye executable nahi hoti.
• Executable File (.elf, .out): Ye final compiled output file hoti hai jo target system pe run hoti hai. ELF ek standard
format hai.
• Hex File (.hex, .bin): Ye files microcontroller ke memory mein directly load karne ke liye use hoti hain.
• Map File (.map): Ye file memory map ko dikhati hai, jisme bataya jata hai ki code aur data kis memory location pe
stored hain.
• Debugging Information Files (.dmp, .sym): Ye files debugging ke liye use hoti hain, jisme symbol information hoti
hai jo aapko program ko debug karne mein madad deti hai.
3. Disassembler/ELDompiler
• Disassembler: Ye tool machine code ko assembly language mein convert karta hai. Ye mainly debugging ya
reverse engineering ke liye use hota hai, jisme aap machine code ka analysis karte hain aur samajhne ki koshish
karte hain ki wo kaise kaam karta hai.
• ELDompiler: Ye disassembler aur decompiler ka combined tool hota hai. Ye machine code ko assembly se high-
level programming language mein convert karne ki koshish karta hai, jise samajhna zyada asaan hota hai.
4. Simulators, Emulators, and Debugging
• Simulators: Ye ek software tool hota hai jo target hardware ke behavior ko mimic karta hai. Isse aap apne code ko
target hardware pe deploy karne se pehle test kar sakte hain. Simulators ka use mainly software testing ke liye
hota hai, jisme aap hardware ka virtual model banate ho.
• Emulators: Ye simulators se zyada accurate hote hain, kyunki ye real-time mein target hardware ka behavior
replicate karte hain. Emulators ka use system ko real hardware ki tarah test karne ke liye kiya jata hai.
• Debugging: Ye process hai jisme code mein bugs ya errors ko identify aur fix kiya jata hai.
o Techniques:
▪ Breakpoints: Specific line pe execution ko pause karke code ke state ko examine karna.
▪ Watchpoints: Specific variables ki value ko execution ke dauraan monitor karna.
▪ Step-through: Code ko line-by-line execute karke bugs ko trace karna.
▪ Call Stack Analysis: Ye function calls ke sequence ko samajhne mein madad karta hai, aur
errors ko identify karta hai.
Target hardware debugging ka matlab hai ki aap apne embedded system ke hardware par directly software ko test aur
troubleshoot karte hain. Ye method specially useful hai jab real-time systems ya precise hardware behavior ki zarurat hoti
hai.
• JTAG (Joint Test Action Group): Ek standard interface hai jo embedded systems ko debug aur program karne ke
liye use hota hai. JTAG se aap system ke internals (memory, registers) ko access kar sakte hain aur real-time
debugging kar sakte hain.
• SWD (Serial Wire Debug): Ye ek ARM processor ka debugging interface hai jo JTAG ki tarah kaam karta hai, lekin
ye kam pins use karta hai.
• In-Circuit Debugger (ICD): Ye tool development environment ko target hardware se connect karta hai taaki
software ko test aur debug kiya ja sake.
6. Boundary Scan
Boundary scan ek testing technique hai jisme IC pins ke electrical characteristics ko bina unhe physically probe kiye test kiya
jata hai. Ye process JTAG interface ke through implement hoti hai.
• Applications:
o PCB Testing: Ye ensure karta hai ki PCB ke physical connections sahi hain.
o Component Testing: Complex systems mein boundary scan component level pe issues detect karta hai.
o Manufacturing: Boundary scan ko manufacturing process mein use karke hardware ko jaldi aur
accurately test kiya jata hai.
Unit-3 Embedded Hardware Design and Development - Hinglish Notes
EDA tools wo software hote hain jo embedded hardware design ko automate karte hain, jaise ki circuit design, simulation,
aur PCB layout. Yeh tools hardware design ko simple aur efficient banate hain.
• Altium Designer: High-end software jo PCB design, schematic capture, aur simulation ko support karta hai.
• KiCAD: Open-source tool jo PCB design aur schematic capture ke liye use hota hai.
• Cadence OrCAD: PCB design aur simulation ke liye industry mein widely used hai.
• Mentor Graphics PADS: Complex PCB designs ke liye use hota hai, especially large systems ke liye.
In tools ke through hum circuit ka design, components ko arrange, aur design ko validate karte hain.
1. Speed: EDA tools design process ko fast aur efficient banate hain. Manual design errors ko reduce karte hain aur
design ko quickly finalize karte hain.
2. Accuracy: Automatic rule checks aur simulations se design mein errors minimize hote hain.
3. Cost Efficiency: Designs ko virtual environment mein simulate karne se prototype cost kam ho jati hai.
4. Ease of Modification: Agar design mein kuch change karna ho, toh EDA tools mein easily components ko modify
kiya ja sakta hai bina entire design ko redo kiye.
5. Advanced Analysis: Signal integrity, power analysis, and thermal simulations jaise features, jo design ko optimize
karne mein madad karte hain.
EDA tool ko use karte waqt ek systematic process follow kiya jata hai. Steps ye hain:
3. Schematic Design
Schematic design circuit ka diagram hota hai jisme components aur unke connections dikhaye jate hain.
• Place Wire: Wire components ko connect karne ke liye use hoti hai. Aap wire tool use karke components ke pins
ke beech connection banate ho.
• Bus: Bus multiple wires ko represent karta hai. Agar multiple signals ko ek hi line mein connect karna ho toh bus
ka use karte hain. Yeh circuit ko simplify karta hai.
• Port: Port wo interface points hote hain jahan signals input/output hote hain. Yeh communication ke liye use kiye
jaate hain, jese ki external devices ko connect karna.
• Junction: Junction wo point hota hai jahan multiple wires ek doosre se connect hoti hain. Junction ko dot ke
through represent kiya jata hai schematic mein.
• Creating Part Numbers: Har component ka unique part number hota hai. Yeh part number ek identifier ki tarah
kaam karta hai jo component ko track karne mein madad karta hai. BoM (Bill of Materials) mein yeh part numbers
zaroori hote hain.
• Design Rules Check (DRC): Schematic design complete karne ke baad, DRC perform karna zaroori hota hai. Yeh
tool ensure karta hai ki design mein koi violation na ho, jaise unconnected pins, overlapping connections, etc.
BoM ek list hoti hai jo design mein use hone wale saare components ko specify karti hai. Har component ka naam, part
number, quantity, aur specifications mention hoti hain.
• Purpose:
•
o Example Tools:
▪ Altium Designer
▪ KiCAD
o Features: Automatically generates a list of all components used in the design, making it easier to source
and manage components.
5. Netlist Creation
Netlist ek file hoti hai jo schematic design ke connections ko represent karti hai. Yeh list bataati hai ki kaunse components
ke pins kaise connected hain. Netlist PCB layout design ko assist karta hai, taaki connection correctly route ho sake.
Key Points:
• Netlist mein components aur unke connections ka detailed information hota hai.
• Netlist PCB layout tool ko diya jata hai, jo physical board par components ko correctly place aur connect karta hai.
• Netlist file ka extension commonly .net ya .xml hota hai.
Jab schematic design complete ho jata hai, tab PCB layout design kiya jata hai. PCB layout design mein physical board ke
upar components ko arrange aur connect kiya jata hai.
• Component Placement: Components ko board par strategically place karna padta hai. Placement efficient aur
space ke hisaab se hona chahiye.
o Factors to Consider:
▪ Signal Integrity: High-speed components ko appropriate jagah pe rakhna zaroori hota hai.
▪ Thermal Management: Heat generate karne wale components ko thoda door rakhna chahiye,
taaki overheating na ho.
▪ Ease of Manufacturing: PCB ko manufacture karne mein asaani ho, isliye components ko
easily accessible position mein rakhna padta hai.
• PCB Track Routing: Tracks (connections) ko route karna hota hai. Yeh traces board par components ke beech
signal aur power flow ko ensure karte hain.
o Types of Tracks:
▪ Signal Traces: Inka use signals ko transfer karne ke liye hota hai.
▪ Power Traces: Inka use power supply ko distribute karne ke liye hota hai.
▪ Ground Traces: Inka use ground signal ko establish karne ke liye hota hai.
• Via: Via ek small hole hoti hai jo alag layers ke beech connection establish karti hai. Agar aapko multi-layer PCB
bana rahe hain, toh vias ki zarurat padti hai.
• Traces ko short aur direct rakhna hota hai taaki signal loss na ho.
• Trace width ka dhyaan rakhna hota hai, power aur signal traces ke liye proper width decide karna padta hai based
on current carrying capacity.
Conclusion
Embedded hardware design ka process complex hai, lekin EDA tools ki madad se yeh kaafi simple ho jata hai. Sabse pehle
aap schematic design banate hain, phir netlist create karke PCB layout design karte hain. Har stage mein aapko design rules
ka dhyaan rakhte hue component placement aur track routing karna hota hai. In tools ka use karke aap efficient aur
accurate embedded hardware designs bana sakte hain jo manufacturing ke liye ready ho.