Extended inline assembly with GCC in CodeWarrior

Document created by Jorge_Gonzalez Employee on Sep 30, 2014Last modified by Diana Torres on Feb 28, 2017
Version 4Show Document
  • View in full screen mode

Hello community!


Nowadays assembly language is being eradicated for embedded systems, and other alternatives such as C/C++ are widely used.


However we know sometimes it becomes necessary to get to "the bones" of our MCU, even from a C project, and play directly with its registers and status flags. Some use cases are:


- Startup code

- Bootloaders

- Time critical routines

- Benchmarking


It is common to include assembly code using the "asm()" style. But what if I want to use my C variables in the assembly code? or if I want to call an assembly subroutine from a C project? The GCC toolchain integrated with CodeWarrior brings this flexibility.


In the attached pdf document you can find an overview and explanation of this extended assembly feature. Also attached a pair of example projects tested with CW v10.6 using KL25Z128 and K60DN512.


Thanks to Abigail Inzunza Lopez for helping with this.


I hope you like it !