Optimizing C for Microcontrollers - Best Practices
Talkat Embedded Linux Conference + OpenIoT Summit North America 2017 · on Wednesday, 2017-02-22· at 17:20· Galleria South·
summary
Walks through concrete GCC+Zephyr examples: compiles a Hello World at various -O levels and demonstrates -Og for debuggable optimization, uses objdump -dS and size and linker maps to inspect output, and targets Cortex-M3 assembly showing the added sign‑extension when using 16‑bit types. Shows that Zephyr and GCC reveal tradeoffs: objdump -dS and size for inspection, that globals cost extra loads whereas const regenerates values and static improves locality, that loop decrement beats increment and misaligned parameter order can spill registers.
AI-written summary · about
chapters (21)
- 0:00Intro
- 4:14Knowing Tools - Compiler Switches
- 7:46Linker Script (Memory Map)
- 11:21Linker Map
- 13:51Binutils Tools
- 17:48Data Types
- 19:22Slow and fast integers
- 21:58Portable Datatypes
- 23:40const' qualifier for variables and function parameters
- 26:36Const volatile variables
- 27:18Global variables
- 27:53Global Vs Local
- 29:14Static Variable/Functions
- 35:34Array subscript Vs Pointer Access
- 39:15Loops (Increment Vs Decrement)
- 40:41Loops (post Vs Pre Decrement)
- 43:01Order of Function Parameters
- 44:29Inline Assembly
- 45:55Optimizing for DRAM
- 48:07Help the compiler out!
- 49:18Optimizing your code
related talks
41mLeveraging Compiler Code Instrumentation for Zephyr Tracing &...
47mSponsored Session: Does Zephyr Scare the Bare Metal Embedded Developer World?
40mOptimizing Zephyr for Peak Performance
23mPorting Zephyr OS for a SoC (Cortex-R5)
46mWhat C and C++ can do and when do you need Assembly?
45mA Case for Frontend Optimization
54mCost of Abstractions in Embedded Systems
01h 30mDangerous Optimizations in C and C++ Programming Languages
