I'm using CW 8.1 for PPC and am working with the MPC565. I'm running into what appears to be a rom->ram data relocation issue when running from internal flash. Here are two instances of the problem:
1. If the compiler option to leave initialized strings in rom is not checked (i.e. initialized strings are copied to ram at runtime), and the string is then sent to the SCI via a simple polling method, the first four bytes appear to be missing. They are there in the flash image but when they are copied to ram, the string is offset such that it starts on the fifth byte. When this same application is targeted to RAM (and therefore no rom->ram copy takes place) the strings come out the SCI intact. Similarly, if the above compiler option is checked (leaving the strings in rom) the strings come out fine.
2. switch statements. If I use a switch statement with 4 cases, the resulting assembly uses a fairly straightforward jump table implementation that works fine. As the number of cases is increased, the implementation changes to a method in which the jump table is copied to RAM and the address index to use is computed based on the switch statement argument. This is in contrast to the hard coded branch addresses used previously when the number of cases is less. In this implementation, the code breaks and jumps to the wrong case statement. For example, if the switch argument (the index) is 1, it will jump to case 2: and so on. All cases are "off by one". And again, the same application targeted for RAM works properly. The only difference between the two appears to be the relocation of the jump table to RAM before its use.
so the question, has this come up previously or do I have a unique situation here? Any ideas?