Working 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!
Hello,
thanks for this article.
According to "the D
ocument" (AN4329), there are two ways to place a function into a certain memory section:
Neither of them works.
I copied and pasted the code snippets into my project.
With the __declspec version, I get compiler error saying "illegal type qualifier(s)".
With the pragma-version I do not get an error or a warning but the code is placed in the .text section as usual, ignoring my directives.
Please help.
Regards, Martin
Hi Martin,
What architecture are you working with? (Kinetis, ColdFire, etc..)
also Copy-pasting code in CodeWarrior usually causes problems with quotes (“ ”). Deleting and rewriting quotes solves these problems.
Regards,