Introduction to Rtos (Real Time OS)

Rtos (Real time operating system) is a piece of software that switches between tasks, giving the impression that multiple programs are being executed at the same time on a single processing core. In actual fact the processing core can only execute one program at any one time, and what the RTOS is actually doing is rapidly switching between individual programming threads (or Tasks) to give the impression that multiple programs are executing simultaneously. What is difference between OS and RTOS? The difference between an OS (Operating System) such as Windows/Linux and an RTOS (Real Time Operating System), is the response … Continue reading Introduction to Rtos (Real Time OS)

The C Runtime Initialization

crt0 (also known as c0) is a set of execution startup routines linked into a C program that performs any initialization work required before calling the program’s main function. crt stands for C runtime. crt is a set of execution startup routines compiled into a program which performs any initialization work required before calling the program’s main function. It is a basic runtime library/system. The work performed by crt depends on the ABI, machine, compiler, operating system and C standard library implementation. The C Runtime system must carry out the following tasks. Set up the target platform in a consistent state. For example setting up appropriate exception … Continue reading The C Runtime Initialization

Introduction of Make

* Introduction Building a program from source code typically involves a few common steps: – Writing the source code – Process the code to expand all *#include* files, macros, etc. – Compiling the expanded source code to machine assembly language – Compiling assembly language to machine  binary code – Linking binary code in multiple files or libraries into   an executable binary program Executing these steps on a small set of source code may be manageable, but as the source code gets larger, the  process becomes more complex. * The Make System The *make* command looks for a file called … Continue reading Introduction of Make

All Stages of Linux Booting Process

This article describes linux booting process in detail, what are the steps involved, which scripts are run, what configuration files are read and their order, from turning on the system till getting the login prompt. Although this article projects a general view of booting a Linux system ~ 1. BIOS Initialisation BIOS, the Basic Input Output System is a firmware program that performs a very basic level of interaction with hardware. This is the first program that takes control when the computer is powered on.The BIOS performs a test on all the hardware component and peripherals called POST, the “Power … Continue reading All Stages of Linux Booting Process

Micro Processor(x86 Basic)

8085 Microprocessor: The salient features of 8085 μp are : It is a 8 bit microprocessor. It is manufactured with N-MOS technology. It has 16 bit address bus and hence can address up-to 216 = 65536 bytes (64KB) memory locations through A0-A15. The first 8 lines of address bus and 8 lines of data-bus are multiplexed AD0 – AD7. Data bus is a group of 8 lines D0 – D7. It supports external interrupt request. A 16 bit program counter (PC). A 16 bit stack pointer (SP). Six 8-bit general purpose register arranged in pairs: BC,DE, HL. It requires a … Continue reading Micro Processor(x86 Basic)

Introduction to gdb (Gnu Debugger)

Write a sample C program with errors for debugging purpose To learn C program debugging, let us create the following C program that calculates and prints the factorial of a number. However, this C program contains some errors in it for our debugging purpose. $ vim factorial.c # include <stdio.h> int main() { int i, num, j; printf (“Enter the number: “); scanf (“%d”, &num ); for (i=1; i<num; i++) j=j*i; printf(“The factorial of %d is %d\n”,num,j); } $ cc factorial.c $ ./a.out Enter the number: 3 The factorial of 3 is 12548672 Continue reading Introduction to gdb (Gnu Debugger)

Dynamic Memory Allocation & Heap Management

Heap management is an important component that affects program performance. Need to balance: – Speed & performance of allocation/deallocation Memory utilization (reduce wasted areas) Ease of usage by the programmer C Dynamic Memory Allocation Functions from stdlib.h • void *malloc(size_t size) – Allocates size bytes and returns a pointer to the block. • void *calloc(size_t nmemb, size_t size) – Allocates nmemb*size bytes, sets the memory to 0, returns a pointer to the block. • void free(void *ptr) function – Frees the block at address ptr (returned by malloc/calloc), returns it to the system for re-use by subsequent malloc calls. Source … Continue reading Dynamic Memory Allocation & Heap Management

MMU (Memory Management Unit)

What Is A Memory Management Unit? The memory management unit (MMU) is a hardware component that is part of the CPU. The task of the MMU is to abstract the physical memory addresses to one or more virtual address spaces. When the MMU is enabled, the CPU accesses memory via virtual addresses which will be translated by the MMU to physical addresses before sending them on the memory bus. Every CPU core has its own MMU. Why Memory Abstraction? Memory abstraction has three big advantages: In a multi-tasking environment, an OS can assign a dedicated virtual address space to every … Continue reading MMU (Memory Management Unit)

Compilation Process

=====> COMPILATION PROCESS <====== | |—-> Input is Source file(.c) | V +=================+ | | | C Preprocessor | | | +=================+ | | —> Pure C file ( comd:cc -E <> ) | V +=================+ | | | Lexical Analyzer| | | +—————–+ | | | Syntax Analyzer | | | +—————–+ | | | Semantic Analyze| | | +—————–+ | | | Pre Optimization| | | +—————–+ | | | Code generation | | | +—————–+ | | | Post Optimize | | | +=================+ | |—> Assembly code (comd: cc -S <> ) | V +=================+ | … Continue reading Compilation Process

Mixed C and Assembly Programming (Embedded Systems)

C and Assembly: Many of us ( system/Embedded programmers) Who use C/Cpp for Firmware/Software Development is more comfortable writing in C/Cpp, and C is a mid-level language and Cpp being High-Level Language (in comparison to Assembly, which is a low-level language), and spares the programmers some of the details of the actual implementation. However, some of the low-level tasks can only be implemented in assembly (e.g. StartUp Code).Also, it is frequently useful for the programmer to look at the assembly output of the C compiler, and hand-edit or hand optimize the assembly code in ways that the compiler cannot. Assembly is also … Continue reading Mixed C and Assembly Programming (Embedded Systems)