File uploaded by Derek Snell Employee on May 12, 2016Last modified by Diana Torres on Feb 28, 2017
Version 2Show Document
  • View in full screen mode

This project is an example of using the DSC CodeWarrior linker to place code

in a different area of memory.  In this case, the FlexNVM flash block is used.

The example uses three different methods in the linker command file to force

specific code to a different memory segment, see examples below.  For more

information on the linker syntax, see the manual installed with CodeWarrior

at \CW MCU v10.6.x\MCU\Help\PDF\MCU_DSC_Compiler.pdf



This project was developed for the TWR-56F8400 Tower development board, using

CodeWarrior for Microcontrollers v10.6.6.  The project was created using

Processor Expert, and blinks an LED using the PIT timer interrupt.



The linker command file is located at

\Project_Settings\Linker_Files\FLASH_SDM.cmd.Here are the key changes to the





        # Added .p_FlexNVM memory segment

        .p_FlexNVM(RWX) : ORIGIN = 0x00068000, LENGTH = 0x00004000




# Added .FlexNVM_Code memory section

.FlexNVM_Code :


  TI1_c.obj (.text) # Place whole source file in this section

  OBJECT (FPE_low_level_init, cpu_c.obj) # Place individual function in this section

  * (FlexNVM_code.text) # Place from section defined in source code, see main.c



} > .p_FlexNVM



and in main.c:

#pragma define_section FlexNVM_code "FlexNVM_code.text"  RX

#pragma section FlexNVM_code begin

void main(void)


  /* Write your code here */


#pragma section FlexNVM_code end