First Session
Analyzing the different toolchain elements
- Using cross compilation
- Compiler, Assembler and Linker Purpose
- C source program structure
- Preprocessor
- Using cross compilation
- Compiler, Assembler and Linker Purpose
- C source program structure
- Preprocessor
- Reviewing the different object file sections
- Library inclusion
- Startup file
- GCC compiler options
- Configuring the linker to place code and data in the memory, executing code from RAM
- Makefile
Exercise: |
Following the different build steps of a simple program |
Exercise: |
Working with Conditional Compilation |
Exercise: |
Working with the linker, placing code and data in the memory |
Lab Environment
- Creating a project from scratch
- Communicating with the Target
- Debugger Windows : Source (C and Disassembly), Memory, Stack, Variables, Registers
- Breakpoints
Types and Operators (1st part)
- Variable storage class (static, automatic, register et extern) with their location and lifetime
- Local and global variable declaration
- Scalar types (char, halfword, int, float and double)
- Constants
- Strings
Second Session
Types and Operators (2nd part)
- Variable storage class (static, automatic, register et extern) with their location and lifetime
- Type conversion, casting
- The volatile attribute
- C operators (logical, arithmetical and relational)
- Operator priority
Exercise: |
Working with types and operators |
Control structures
- If/else structure
- Switch/case structure
- While, do/while and for loopf
- Break, continue and go instruction
Exercise: |
Working with pointers |
Pointers and Arrays
- Pointer definition
- Pointer Initialization, pointer access, pointer operations
- Constant and volatile pointer
- The restrict attribute
- One- and Multi-dimensional arrays
- Array initialization, array access, array operations
- Pointer array
Exercise: |
Working with pointers |
Exercise: |
Working with arrays |
Structures and unions
- Structure variable declaration
- Structure variable pointer declaration
- Structure field access
- Padding, #pragma pack compilation directive
- Big and little endian format
- Bit field structure declaration
- Modeling peripheral register
- Structure array
- Typedef type
- Enum type
- Union declaration
- Union intitialization and operation
Third Session
Functions
- Function prototype (arguments, return value)
- Function definition and declaration
- Function visibility
- Function pointer
- Function call
- Passing parameter
- Stack operation
- Stack frame, call stack
- The recursivity and the stack
- Macro vs function
- Pipeline and branch
- Function inlining
- Interfacing C and Assembler
Exercise: |
Passing parameter to function |
Exercise: |
Analyzing the stack utilization |
Standard library Overview
- Stdio library
- Getchar and putchar functions
- Memcpy function
- Printf and scanf functions
- File access function review
Data structures
- Programming FIFOs
- Programming Linked list (simple and double)
Exercise: |
Working with linked list |
Dynamic allocation
- Dynamic allocation functions: malloc, free function
- Sizeof operator
- Dynamic memory allocation vs static memory allocation
- Stack vs Heap
- Memory management algorithms overview
- Buddy System
- Best fit / First Fit
- Pools Management
- Memory management errors
Exercise: |
Using dynamic allocation |
Fourth Session
Embedded Context
- Peripheral Programming
- Peripheral register access and Memory access
- Signed vs unsigned
- Memory latency
- Cache
- Synchronization
- Interruption necessity in an embedded context
- Tail-Chaining
- Pre-emption (Nesting)
- NVIC Integrated Interrupt Controller
- Exception Priority Management
- Level and pulse triggered interrupts
- Interrupt clearance
- Interrupt handler writing
- Vector table
- Vector installation
- System Timer (Systick Timer)
- Clarifying the boot sequence
- Debug Interface Ovevriew
Exercise: |
Interrupt Management |
Compiler Hints and Tips for Cortex-M
- Compiler optimizations
- Mixing C and Assembly
- AAPCS
- Function inlining
- Unaligned Accesses, padding
- Local and global data issues, alignment, Structure