~/talk

Optimizing C for Microcontrollers - Best Practices

slides:none on file

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

  1. 0:00Intro
  2. 4:14Knowing Tools - Compiler Switches
  3. 7:46Linker Script (Memory Map)
  4. 11:21Linker Map
  5. 13:51Binutils Tools
  6. 17:48Data Types
  7. 19:22Slow and fast integers
  8. 21:58Portable Datatypes
  9. 23:40const' qualifier for variables and function parameters
  10. 26:36Const volatile variables
  11. 27:18Global variables
  12. 27:53Global Vs Local
  13. 29:14Static Variable/Functions
  14. 35:34Array subscript Vs Pointer Access
  15. 39:15Loops (Increment Vs Decrement)
  16. 40:41Loops (post Vs Pre Decrement)
  17. 43:01Order of Function Parameters
  18. 44:29Inline Assembly
  19. 45:55Optimizing for DRAM
  20. 48:07Help the compiler out!
  21. 49:18Optimizing your code
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.