Segmentation

The Linker memory space may be partitioned into several segments. The Compiler allows attributing a certain segment name to certain global variables or functions which then are allocated into that segment by the Linker. Where that segment actually lies is determined by an entry in the Linker parameter file.

There are two basic types of segments, code and data segments, each with a matching pragma:

  
  #pragma CODE_SEG  <name>
  
  
  #pragma DATA_SEG  <name>
  
  

Both are valid until the next pragma of the same kind is encountered. If no segment is specified, the Compiler assumes two default segments named DEFAULT_ROM (the default code segment) and DEFAULT_RAM (the default data segment). To explicitly make these default segments the current ones, use the segment name DEFAULT:

  #pragma CODE_SEG DEFAULT
  
  
  #pragma DATA_SEG DEFAULT