Relocating code with CodeWarrior

Document created by Monica Arvizu Employee on Sep 9, 2012Last modified by Diana Torres on Feb 28, 2017
Version 2Show Document
  • View in full screen mode

564345_374673772602333_669757692_n_largeWorking with ColdFire Architectures for CodeWarrior is really simple and very useful. One little problem that many people has run into, is the relocation of code and data within the MCUs that are being used.


Maybe this will help those who have that issue, the Document I recently found explains the solution I now present.


It provides guidance for relocating code and data within the Microcontroller memory map. It also explains how to create new memory segments and sections by editing the CodeWarrior Linker Command File (LCF) for ColdFire Architectures.


The Linker Command File (LCF) along with other compiler directives, places pieces of code and data into RAM and ROM. You can do this by creating specific sections in the LCF and then matching them to the source code using pragma directives.


Other than making a program file from your project's object files, the linker has several extended functions for manipulating program code in different ways. You can access these functions through commands in the linker command file (LCF).


Linker command files consist of three kinds of segments, which must be in this order:

• A memory segment, which begins with the MEMORY{} directive,

• An optional closure segment, which begins with the FORCE_ACTIVE{}, KEEP_SECTION{}, or

REF_INCLUDE{} directives, and

• A sections segment, which begins with the SECTIONS{} directive.


LCF only gets more interesting, so get the Document read now!