EasyManuals Logo

Texas Instruments C28 Series Student Guide

Texas Instruments C28 Series
342 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #330 background imageLoading...
Page #330 background image
Using Pragma
Using Pragma
Pragma is a preprocessor directive that provides directions to the compiler about how to treat a
particular statement. The following example shows how the DATA_SECTION pragma is used
to put a specific buffer into a different section of RAM than other buffers.
The example shows two buffers, bufferA and bufferB. The first buffer, bufferA is treated
normally by the C compiler by placing the buffer (512 words) into the ".bss" section. The second,
bufferB is specifically directed to go into the “my_sect” portion of data memory. Global
variables, normally ".bss", can be redirected as desired.
When using CODE_SECTION, code that is normally linked as ".text", can be identified
otherwise by using the code section pragma (like .sect in assembly).
#
#
pragma
pragma
CODE_SECTION (
CODE_SECTION (
func
func
, ”section name”)
, ”section name”)
#
#
pragma
pragma
DATA_SECTION (symbol, “section name”)
DATA_SECTION (symbol, “section name”)
User defined sections from C :
User defined sections from C :
Pragma
Pragma
Examples
Examples
.global _
.global _
bufferA
bufferA
, _
, _
bufferB
bufferB
.
.
bss
bss
_bufferA,512
_bufferA,512
_
_
bufferB
bufferB
:
:
.
.
usect
usect
“my_sect”,512
“my_sect”,512
Resulting assembly file
Resulting assembly file
char bufferA[512];
char bufferA[512];
#
#
pragma
pragma
DATA_SECTION(
DATA_SECTION(
bufferB
bufferB
, ”my_sect”)
, ”my_sect”)
char bufferB[512];
char bufferB[512];
C source file
C source file
Example
Example
-
-
using the DATA_SECTION
using the DATA_SECTION
Pragma
Pragma
More #
More #
pragma
pragma
are defined in the C compiler UG
are defined in the C compiler UG
D- 8 C28x – C Programming

Table of Contents

Other manuals for Texas Instruments C28 Series

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments C28 Series and is the answer not in the manual?

Texas Instruments C28 Series Specifications

General IconGeneral
BrandTexas Instruments
ModelC28 Series
CategoryComputer Hardware
LanguageEnglish

Related product manuals