Other Parts Discussed in Thread: CC430F6137, CC430F5137
Hello,
today I just discovered a strange behaviour of my code when I transfered a jump table from RAM to Flash on the CC430F6137 controller.
When the code wants to jump to an entry of the table with a CALLA instruction, it crashes (sets PC to 0x0F3FFE)
If the table sits in RAM then everything works as expected. When the same table is placed in FLASH, the app crashes.
This is the code with the table placed in ROM (at address 0xc272):
0x08226: 4F6F MOV.B @R15,R15
0x08228: 118F SXT R15
0x0822A: 065F RLAM.W #2,R15
0x0822C:> 135F C272 CALLA 0xc272(R15)
At the time of the CALLA instruction, the R15 has the content 0x10. But even with 0 the app crashes.
Coil_module = 0xc272
B372 0000 B3A4 0000 B378 0000 B37E 0000 B352 0000 B242 0000 B390 0000 B3A8 0000
The intended jump address is 0xB352, which I verified to hold the wanted function.
First I thought it is the alignment, which in this case is aligned only to 2 bytes, not to 4 bytes. But even with an alignment of 4 Bytes for the table the app is crashing.
-----------------------
Now, when I place the same table in RAM (here also with alignment 2), the code is working:
0x08228: 118F SXT R15
0x0822A: 065F RLAM.W #2,R15
0x0822C: 135F 28DE CALLA 0x28de(R15)
Now, for security reasons and for restricted RAM space, I just want to place the jump table in ROM. Is there any way to make the call work?
Is this a hardware bug? Is this documented somewhere?
Well, the errata CPU33 of the document SLAZ052J, looks similar, but is states that this is only applicable when
Quote:
This erratum applies only when the instruction sequence is: PUSH or
PUSHX followed by CALLA index(SP).
This erratum does not apply if the PUSH or PUSHX instruction is used in
the Register or Immediate addressing mode.
This erratum applies only when SP is used as the destination register in
the CALLA index(Rdst) instruction.
I use the CCS Version: 4.1.3.00038 and use the CCS compiler.n The original code is in C.
Greetings and happy easter,
Jens

