|
|
@@ -1,3 +1,86 @@
|
|
|
|
# Embedded-C-Fundamentals
|
|
|
|
# Embedded C Fundamentals
|
|
|
|
|
|
|
|
|
|
|
|
Fundamental C concepts, memory model, pointers, data structures, and embedded programming examples.
|
|
|
|
Fundamental C concepts, memory model, pointers, data structures, and embedded programming examples.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Overview
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This repository contains notes, explanations, and runnable examples covering fundamental concepts of the C programming language commonly encountered in embedded software development.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The goal is not to teach C from scratch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Instead, the focus is on understanding how things work under the hood and revisiting language features that are often hidden behind modern C++ abstractions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Topics are explored through small, self-contained examples that can be compiled, executed, modified, and studied.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Topics
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Planned topics include:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* Memory layout
|
|
|
|
|
|
|
|
* Variables and storage duration
|
|
|
|
|
|
|
|
* Pointers
|
|
|
|
|
|
|
|
* Arrays
|
|
|
|
|
|
|
|
* Strings
|
|
|
|
|
|
|
|
* Structures
|
|
|
|
|
|
|
|
* Dynamic memory allocation
|
|
|
|
|
|
|
|
* Function pointers
|
|
|
|
|
|
|
|
* Linked lists
|
|
|
|
|
|
|
|
* Bit manipulation
|
|
|
|
|
|
|
|
* Volatile
|
|
|
|
|
|
|
|
* Const correctness
|
|
|
|
|
|
|
|
* Undefined behaviour
|
|
|
|
|
|
|
|
* Memory-mapped I/O concepts
|
|
|
|
|
|
|
|
* Common embedded programming patterns
|
|
|
|
|
|
|
|
* Common interview questions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Repository Structure
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```text
|
|
|
|
|
|
|
|
examples/
|
|
|
|
|
|
|
|
notes/
|
|
|
|
|
|
|
|
diagrams/
|
|
|
|
|
|
|
|
interview_questions/
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The structure may evolve as additional material is added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Philosophy
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Understanding C is not about memorizing syntax.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
It is about understanding:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* where data is stored
|
|
|
|
|
|
|
|
* who owns memory
|
|
|
|
|
|
|
|
* how pointers behave
|
|
|
|
|
|
|
|
* what the compiler is allowed to do
|
|
|
|
|
|
|
|
* where undefined behaviour begins
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Every topic should be supported by practical examples whenever possible.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Intended Audience
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This repository may be useful for:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* Embedded software engineers
|
|
|
|
|
|
|
|
* Firmware developers
|
|
|
|
|
|
|
|
* C++ developers refreshing C fundamentals
|
|
|
|
|
|
|
|
* Engineers preparing for technical interviews
|
|
|
|
|
|
|
|
* Students interested in low-level programming
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Building Examples
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Examples are intended to be compiled using standard toolchains available on Linux systems.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
|
|
gcc example.c -o example
|
|
|
|
|
|
|
|
./example
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Individual examples may provide additional build instructions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MIT License
|