CODE_SEG

Specifies the addressing mode and location of object code for functions.

Syntax
  #pragma CODE_SEG [ modifier ] [ name ]   
  #pragma CODE_SEG DEFAULT   
Parameters

modifier

This optional parameter specifies the addressing mode to use:

name

A section name. You must use a section name defined in your project's linker command file.

Description

To specify the section in which a function is to be stored and the addressing mode to refer to it, place this pragma before the function definition. Use this pragma when porting source code from HC08 architectures to Kinetis architectures.

Use DEFAULT to use the parameters specified by the previous use of this pragma.

The following listing shows an example.

Listing: CODE_SEG example
void f(void); 
void h(void); 
/* Use far addressing to refer to this function. */ 
/* Store function in section "text". */ 
#pragma CODE_SEG __FAR_SEG text 
void f(void){ 
h(); 
} 
/* Use near addressing to refer to this function. */ 
/* Store function in section "MYCODE2". */ 
#pragma CODE_SEG __NEAR_SEG MYCODE2 
void h(void){ 
f(); 
} 
/* Use previous pragma CODE_SEG parameters: */ 
/* __FAR_SEG text */ 
#pragma CODE_SEG DEFAULT