SPRAAU8A March   2008  – August 2017 TMS320F2801 , TMS320F2801 , TMS320F2801-Q1 , TMS320F2801-Q1 , TMS320F28015 , TMS320F28015 , TMS320F28016 , TMS320F28016 , TMS320F28016-Q1 , TMS320F28016-Q1 , TMS320F2802 , TMS320F2802 , TMS320F2802-Q1 , TMS320F2802-Q1 , TMS320F28044 , TMS320F28044 , TMS320F2806 , TMS320F2806 , TMS320F2806-Q1 , TMS320F2806-Q1 , TMS320F28062 , TMS320F28062 , TMS320F28062-Q1 , TMS320F28062-Q1 , TMS320F28062F , TMS320F28062F , TMS320F28062F-Q1 , TMS320F28062F-Q1 , TMS320F28063 , TMS320F28063 , TMS320F28064 , TMS320F28064 , TMS320F28065 , TMS320F28065 , TMS320F28066 , TMS320F28066 , TMS320F28066-Q1 , TMS320F28066-Q1 , TMS320F28067 , TMS320F28067 , TMS320F28067-Q1 , TMS320F28067-Q1 , TMS320F28068F , TMS320F28068F , TMS320F28068M , TMS320F28068M , TMS320F28069 , TMS320F28069 , TMS320F28069-Q1 , TMS320F28069-Q1 , TMS320F28069F , TMS320F28069F , TMS320F28069F-Q1 , TMS320F28069F-Q1 , TMS320F28069M , TMS320F28069M , TMS320F28069M-Q1 , TMS320F28069M-Q1 , TMS320F2808 , TMS320F2808 , TMS320F2808-Q1 , TMS320F2808-Q1 , TMS320F2809 , TMS320F2809 , TMS320F2810 , TMS320F2810 , TMS320F2810-Q1 , TMS320F2810-Q1 , TMS320F2811 , TMS320F2811 , TMS320F2811-Q1 , TMS320F2811-Q1 , TMS320F2812 , TMS320F2812 , TMS320F2812-Q1 , TMS320F2812-Q1 , TMS320F28232 , TMS320F28232 , TMS320F28232-Q1 , TMS320F28232-Q1 , TMS320F28234 , TMS320F28234 , TMS320F28234-Q1 , TMS320F28234-Q1 , TMS320F28235 , TMS320F28235 , TMS320F28235-Q1 , TMS320F28235-Q1 , TMS320F28332 , TMS320F28332 , TMS320F28333 , TMS320F28333 , TMS320F28334 , TMS320F28334 , TMS320F28335 , TMS320F28335 , TMS320F28335-Q1 , TMS320F28335-Q1

 

  1.   Copying Compiler Sections From Flash to RAM on the TMS320F28xxx DSCs
    1.     Trademarks
    2. 1 Introduction
    3. 2 Compiler Sections
    4. 3 Software
      1. 3.1 Description
        1. 3.1.1 Code_start and wd_disable
        2. 3.1.2 Copy_sections
        3. 3.1.3 Memory Allocation – Linker Command Files
      2. 3.2 Testing Example
        1. 3.2.1 Code Composer Studio Environment
        2. 3.2.2 Standalone Operation
      3. 3.3 Application Integration
        1. 3.3.1 Example Integration
    5. 4 Benchmarks, Limitations, and Suggestions
      1. 4.1 Memory Usage
      2. 4.2 Benchmarks
      3. 4.3 Limitations
      4. 4.4 Suggestions
    6. 5 Conclusion
    7. 6 References
  2.   Revision History

Compiler Sections

The compiler creates multiple portions of code and data called sections. These sections are categorized into two different groups: initialized and uninitialized. The initialized group of sections is composed of all code, constants, and initialization tables. Table 1 shows the initialized sections produced by the compiler.

Table 1. Initialized Sections

Name Contents Restrictions
.cinit Tables for explicitly initialized global and static variables Program
.const Global and static const variables that are explicitly initialized and string literals Low 64K data
.econst Far constant variables Anywhere in data
.pinit Tables for global object constructors Program
.switch Tables for implementing switch statements Program (with -mt option)
Data (without -mt option)
.text Executable code and constants Program

The uninitialized group of sections is composed of variables, the stack, and malloc memory. Table 2 shows the uninitialized sections produced by the compiler.

Table 2. Uninitialized Sections

Name Contents Restrictions
.bss Global and static variables Low 64K data
.ebss Far global/static variables Anywhere in data
.stack Stack space Low 64K data
.sysmem Memory for malloc functions Low 64K data
.esysmem Memory for far_malloc functions Anywhere in data

Once the compiler has generated these sections the linker takes the individual sections from each source file and combines them to create an output section. The linker command file (.cmd) is used to tell the linker where to allocate these sections. Initialized sections must be assigned to a non volatile memory like Flash/ROM so the application is not erased when power is removed from the target. Uninitialized sections can be allocated to RAM as they are initialized during code execution.

For more information regarding compiler sections and linking, see the TMS320C28x Assembly Language Tools User’s Guide (SPRU513) and the TMS320C28x Optimizing C/C++ Compiler User’s Guide (SPRU514).

Texas Instruments has multiple examples available that show the use of the linker command file to allocate compiler sections. One such example is the Running an Application from Internal Flash Memory on the TMS320F28xx DSP (SPRA958). This application report provides examples that demonstrate the use of the linker command file for both RAM based and Flash based projects.

The C/C++ Header Files and Peripheral Examples for each C28x™ DSP generation also provides examples for RAM and Flash based examples. For more information, see C281x C/C++ Header Files and Peripheral Examples (SPRC097), C280x, C2801x C/C++ Header Files and Peripheral Examples Software Tools (SPRC191), and C2833x/C2823x C/C++ Header Files and Peripheral Examples Application Software (SPRC530).