# HG changeset patch # User Mychaela Falconia # Date 1476328468 0 # Node ID 338bf7edbd4739e3566d636953c48f87da32bad9 # Parent d8197af7e058993f8835535c7995eecbb29fa758 src/g23m-fad/rlp/rlp_kers.c: workaround for TI's compiler BUG diff -r d8197af7e058 -r 338bf7edbd47 src/g23m-fad/rlp/rlp_kers.c --- a/src/g23m-fad/rlp/rlp_kers.c Wed Oct 12 18:37:16 2016 +0000 +++ b/src/g23m-fad/rlp/rlp_kers.c Thu Oct 13 03:14:28 2016 +0000 @@ -1155,6 +1155,31 @@ GLOBAL void sig_rcv_ker_ready_ind(void) { + /* + * FreeCalypso: when we tried to compile this code from TCS3.2 + * in our TCS211-mimicking Magnetite environment, we hit a BUG + * in TI's compiler, or more precisely, the compiler version used + * in TCS211: compiling this C module would fail as the compiler + * was producing bad assembly which the asm step rejected. + * Analysis of the generated asm showed that the switch table + * and all of the switch case code was omitted, but the reference + * to the switch table was still there, hence asm failing. + * + * The following four volatile char initialized but otherwise unused + * automatic variables constitute the workaround we have added to + * get this C module past the broken compiler. This workaround was + * inspired by the disassembly of the rlp_kers.obj binary object + * from the TCS211 blob library: it appears that TI had applied a + * very similar workaround on their end to get this code past the + * same broken compiler. The generated code we get is not exactly + * the same as what's in the blob, so our recreation of TI's compiler + * workaround is probably inexact, but it does the job of getting + * this C module past the compiler. + */ + volatile char bug1 = 'A'; + volatile char bug2 = 'B'; + volatile char bug3 = 'C'; + volatile char bug4 = 0; TRACE_FUNCTION ("sig_rcv_ker_ready_ind()");