Overview
Explore best practices for optimizing C code on microcontrollers in this 53-minute conference talk by Khem Raj from Comcast RDK. Discover tips and techniques for writing efficient C programs, using Zephyr as a case study to demonstrate size and performance optimizations. Learn about leveraging GCC for microcontrollers and RTOSes like Zephyr, covering topics such as compiler switches, linker scripts, data types, variable usage, loop optimization, and inline assembly. Gain insights into memory management, code organization, and compiler-friendly practices to squeeze the most out of your microcontroller projects.
Syllabus
Intro
Knowing Tools - Compiler Switches
Linker Script (Memory Map)
Linker Map
Binutils Tools
Data Types
Slow and fast integers
Portable Datatypes
const' qualifier for variables and function parameters
Const volatile variables
Global variables
Global Vs Local
Static Variable/Functions
Array subscript Vs Pointer Access
Loops (Increment Vs Decrement)
Loops (post Vs Pre Decrement)
Order of Function Parameters
Inline Assembly
Optimizing for DRAM
Help the compiler out!
Optimizing your code
Taught by
Linux Foundation