Using Embedded Assembly
Using Embedded Assembly
Embedding Assembly in C
Embedding Assembly in C
Allows direct access to assembly language from C
Allows direct access to assembly language from C
Useful for operating on components not used by C, ex:
Useful for operating on components not used by C, ex:
asm ( “ CLRC INTM ; enable global interrupt” );
asm ( “ CLRC INTM ; enable global interrupt” );
Note: first column after leading quote is
Note: first column after leading quote is
label
label
field
field
-
-
if no label,
if no label,
should be blank space.
should be blank space.
Avoid modifying registers used by C
Avoid modifying registers used by C
Lengthy code should be written in ASM and called from C
Lengthy code should be written in ASM and called from C
main C file retains portability
main C file retains portability
yields more easily maintained structures
yields more easily maintained structures
eliminates risk of interfering with registers in use by C
eliminates risk of interfering with registers in use by C
#define EINT
#define EINT
asm
asm
( “ CLRC INTM”)
( “ CLRC INTM”)
The assembly function allows for C files to contain 28x assembly code. Care should be taken not
to modify registers in use by C, and to consider the label field with the assembly function. Also,
any significant amounts of assembly code should be written in an assembly file and called from
C.
There are two examples in this slide – the first one shows how to embed a single assembly
language instruction into the C code flow. The second example shows how to define a C term that
will invoke the assembly language instruction.
C28x – C Programming
D - 7
Summary of Contents for C28 Series
Page 64: ...Summary 3 16 C28x Peripheral Registers Header Files ...
Page 78: ...Interrupt Sources 4 14 C28x Reset and Interrupts ...
Page 218: ...Lab 9 DSP BIOS 9 22 C28x Using DSP BIOS ...
Page 244: ...Lab 10 Programming the Flash 10 26 C28x System Design ...
Page 273: ...Appendix A eZdsp F2812 C28x Appendix A eZdsp F2812 A 1 ...
Page 276: ...Appendix P2 Expansion Interface A 4 C28x Appendix A eZdsp F2812 ...
Page 277: ...Appendix P4 P8 P7 I O Interface C28x Appendix A eZdsp F2812 A 5 ...
Page 278: ...Appendix A 6 C28x Appendix A eZdsp F2812 ...
Page 279: ...Appendix P5 P9 Analog Interface C28x Appendix A eZdsp F2812 A 7 ...
Page 282: ...Appendix A 10 C28x Appendix A eZdsp F2812 TP1 TP2 Test Points ...