Motorola DSP56800 Betriebsanweisung Seite 122

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 446
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 121
C for DSP56800E
User Stack Allocation
122
Targeting MC56F83xx/DSP5685x Controllers
In cases where the SP is modified by a run-time dependent amount, a warning is
issued.
Listing 6.1 Example 1 – Legal modification of SP Using Inline Assembly
#define EnterCritical() { asm(adda #2,SP);\
asm(move.l SR,X:(SP)+); \
asm(bfset #0x0300,SR); \
asm(nop); \
asm(nop);}
#define ExitCritical() { asm(deca.l SP);\
a sm(m o v e.l x : (SP) - , SR) ; \
asm(nop);\
asm(nop);}
#pragma check_inline_sp_effects on
int func()
{
int a=1, b=1, c;
EnterCritical();
C = a+b;
ExitCritical();
}
This case will work because there are no control flow merge points. SP is modified
consistently along all paths from the beginning to the end of the function and is
properly aligned.
Listing 6.2 Example 2 – Illegal Modification of SP using Inline Assembly
#define EnterCritical() { asm(adda #2,SP);\
asm(move.l SR,X:(SP)+); \
asm(bfset #0x0300,SR); \
asm(nop); \
asm(nop);}
#define ExitCritical() { asm(deca.l SP);\
a sm(m o v e.l x : (SP) - , SR) ; \
Seitenansicht 121
1 2 ... 117 118 119 120 121 122 123 124 125 126 127 ... 445 446

Kommentare zu diesen Handbüchern

Keine Kommentare