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)

Interrupt Processing in ARM

An interrupt is the automatic transfer of software execution in response to a hardware event that is asynchronous with the current software execution. This hardware event is called a trigger. The hardware event can either be a busy to ready transition in an external I/O device (like the UART input/output) or an internal event (like bus fault, memory fault, or a periodic timer). When the hardware needs service, signified by a busy to ready state transition, it will request an interrupt by setting its trigger flag. A thread is defined as the path of action of software as it executes. The execution of the interrupt … Continue reading Interrupt Processing in ARM

Introduction to RTOS Part-1

What is an RTOS? An Operating System (OS) is in charge of managing the resources of your computer. It will put tasks on the CPU and take tasks off the CPU, giving each task the illusion that it owns the entire processor. It will implement some kind of scheduling policy, which dictates when a task should be given time to run on the CPU and for how long. It will also manage the memory in the system and the various bits of hardware attached. A general OS, such as Windows or Linux, is normally designed for throughput and fairness, with … Continue reading Introduction to RTOS Part-1

Linux vim Editor command

About vim : vim, which stands for “Vi Improved“, is a Text Editor. It can be used for editing any kind of text and is especially suited for editing computer program. Description vim is a text editor that is upwards compatible with Vi. There are a lot of enhancements above Vi: multi-level undo, multiple windows and buffers, syntax highlighting,  command line editing, filename completion, a complete help system, visual selection, and others. Vim has a particular working method, there are two main modes: the command mode and the other modes. The command mode lets you select the working mode that you want to … Continue reading Linux vim Editor command