top of page


How to Master Memory Linking for STM32 Boards: Creating a Comprehensive Linker Script
When delving into the intricate world of STM32 board development, one aspect that often perplexes many developers is memory linking. Properly managing memory and creating an efficient linker script is crucial for optimizing the performance of your STM32 board or any board. In this blog post, we will explore the detailed process of creating a linker script for an STM32 board and unravel the mysteries of memory linking control. Unveiling the Magic of Memory Linking Memory linki
Ashok Kumar Kumawat
May 118 min read
CPP: Decorator
The Decorator Pattern The Decorator is a Structural design pattern. It allows you to dynamically attach new behaviors or responsibilities to an object by placing it inside a special wrapper object that contains these new behaviors. The Problem It Solves Imagine you are writing a system for a coffee shop. You start with a base Coffee class. Then, customers want variations: Coffee with Milk, Coffee with Sugar, Coffee with Vanilla, Coffee with Milk AND Sugar... If you use standa
Ashok Kumar Kumawat
May 114 min read
CPP: Lambda function
What is a Lambda Function in C++? A lambda function (often just called a "lambda") is an anonymous function—a function without a name. Introduced in C++11, lambdas allow you to write quick, throwaway functions directly inline inside your code, exactly where you need them. They are incredibly useful when you need to pass a short snippet of code to another function, such as when using C++ Standard Library (STL) algorithms like std::sort, std::find_if, or std::for_each. The Synt
Ashok Kumar Kumawat
May 113 min read
Q&A: C Code
Q1: How do you find the size of an array in C? Q2: What is an array of pointers in C, and why is it useful? Q3: How can function pointers be used to trigger callbacks in C? Q4: How can we determine the size of a struct in C without using sizeof or any library macros? Q1: How do you find the size of an array in C? Use sizeof(arr) / sizeof(arr[0]), which divides the total memory by the size of one element to get the number of elements. #include <stdio.h> int main() { int arr[]
Ashok Kumar Kumawat
Apr 256 min read
Bubble Sort Concept
Bubble Sort repeatedly compares adjacent elements and swaps them if they are in the wrong order. After each pass, the largest element "bubbles up" to its correct position at the end. C Code Example #include <stdio.h> int main() { int arr[5] = {5, 3, 8, 4, 2}; // Example array int i, j, temp; int n = sizeof(array) / sizeof(array[0]); printf("Original array: "); for(i = 0; i < n; i++) { printf("%d ", arr[i]); } // Bubble Sort for(i = 0; i < n-1; i++) { for(j = 0; j < n-i-
Ashok Kumar Kumawat
Apr 252 min read
Static vs Dynamic Libraries in Linux and Linking Executables
Prerequisites Before diving in, make sure you have: A Linux environment (Ubuntu, Fedora, etc.) GCC compiler (sudo apt install build-essential on Ubuntu) Basic knowledge of C programming (printf, scanf, functions) Familiarity with terminal commands (ls, nm, ldd) Terminal commands 1. ls Purpose: Lists files in a directory. Usage for libraries: Helps you see whether .a (static) or .so (dynamic) files exist. Command: bash ls --color=auto /usr/lib | grep libc Output example: Code
Ashok Kumar Kumawat
Apr 57 min read
Macros — Complete Guide for Embedded C
What is a Macro and How It Works at Compilation Stage Macros are handled by the C Preprocessor, which runs before the actual compilation begins. The compilation pipeline looks like this: Source.c → [Preprocessor] → Expanded.i → [Compiler] → object.o → [Linker] → final.elf The preprocessor performs textual substitution — it finds every macro usage and replaces it with the defined text, literally copy-pasting the expansion into the source before the compiler ever se
Ashok Kumar Kumawat
Feb 226 min read
Data Type Qualifiers + Storage Class Interactions
Perfect, let’s extend our revision into Data Type Qualifiers + Storage Class Interactions. This is where embedded C really differs from desktop C, because qualifiers directly affect how the compiler generates code for hardware registers, ISRs, and memory-constrained systems. 1. Concept Overview Data type qualifiers: const, volatile, signed, unsigned, restrict (rare in embedded). Storage classes: static, extern, register, auto (default). Together, they define scope, lifetime,
Ashok Kumar Kumawat
Feb 82 min read
Data Type Qualifiers in Embedded C
1. Concept Overview Data type qualifiers modify the behavior of variables beyond their base type (int, char, etc.).Common qualifiers in C (and Embedded C) are: const → Read-only, cannot be modified after initialization. volatile → Tells the compiler the variable may change unexpectedly (e.g., hardware register, ISR). restrict (C99) → Optimizes pointer usage, rarely used in embedded. signed / unsigned → Defines whether a type can represent negative values. Default qualifiers:
Ashok Kumar Kumawat
Feb 82 min read
Data type in c
Alright Ashok, let’s dive into Data Types in Embedded C with the structured breakdown you asked for. I’ll keep this focused on embedded industry applications, resource-constrained environments, and safety-critical practices. 1. Concept Overview Data types define how the compiler interprets and allocates memory for variables. Common C types: char, int, short, long, float, double. In embedded systems, sizes are implementation-dependent (e.g., int may be 16-bit on some MCUs, 32-
Ashok Kumar Kumawat
Feb 82 min read
bottom of page