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
Содержание C28 Series
Страница 64: ...Summary 3 16 C28x Peripheral Registers Header Files ...
Страница 78: ...Interrupt Sources 4 14 C28x Reset and Interrupts ...
Страница 218: ...Lab 9 DSP BIOS 9 22 C28x Using DSP BIOS ...
Страница 244: ...Lab 10 Programming the Flash 10 26 C28x System Design ...
Страница 273: ...Appendix A eZdsp F2812 C28x Appendix A eZdsp F2812 A 1 ...
Страница 275: ...Appendix eZdsp F2812 eZdsp F2812 Connector Header and Pin Diagram C28x Appendix A eZdsp F2812 A 3 ...
Страница 276: ...Appendix P2 Expansion Interface A 4 C28x Appendix A eZdsp F2812 ...
Страница 277: ...Appendix P4 P8 P7 I O Interface C28x Appendix A eZdsp F2812 A 5 ...
Страница 278: ...Appendix A 6 C28x Appendix A eZdsp F2812 ...
Страница 279: ...Appendix P5 P9 Analog Interface C28x Appendix A eZdsp F2812 A 7 ...
Страница 281: ...Appendix JP7 JP8 JP11 JP12 Boot Mode Select JP9 PLL Disable DS1 DS2 LEDs C28x Appendix A eZdsp F2812 A 9 ...
Страница 282: ...Appendix A 10 C28x Appendix A eZdsp F2812 TP1 TP2 Test Points ...