This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Porting "ST #immediate, Smem" from C54x to C55x

Hi!

As the subject says, I have a problem  porting "ST #immediate, Smem" from C54x to C55x.

==== Code example ====

.cpl_on ; Tell compiler CPL=1 
ST #0, 0 ; Store #0 at (SP + 0)

==== Compiler output ====

"example.asm", REMARK at line 2: [R5010] C54x and C55x interrupt enable/flag
registers and bit mapping are
different. Replace with native C55x
mnemonic.
ST #0, 0 ; Store #0 at (SP + 0)

"example.asm", ERROR! at line 2: [E0003] This address mode is invalid in CPL=1
mode
ST #0, 0 ; Store #0 at (SP + 0)
====

R5010: Why does the compiler think I'm trying to modify IER0? I've clearly told it on the row above that I want to direct memory addressing relative to SP. The stack is setup in another source file.

E0003: What address mode? Isn't "ST #immediate, Smem" valid when CPL=1 ? If so, why isn't this mentioned in SPRU429 - C54x-to-C55x Code Migration
  Reference Guide?

  • The C54x-to-C55x migration in the assembler does not accept "0" as syntax for "*SP(0)", because it would lead to ambiguity with memory-mapped location 0, which happens to be IER0.  You should change the source code to "ST #0, *SP(0)", which is the canonical syntax for C54x, and will work with the C55x assembler.  ".cpl_on" does not change the assembler's interpretation of the syntax, all it does is allow the syntax *SP(0) and disallow the syntax *DP(0).