AnsweredAssumed Answered

Issue arising with optimizations: Codewarrior 10.7 with MCF51JM

Question asked by venuss on Sep 9, 2016
Latest reply on Oct 14, 2016 by ZhangJennie



I have installed Codewarrior for MCU 10.7 on Windows 10 x64 for use with the MCF51JM series of microprocessors. 

The problem arises with the following configuration:

Optimization Level: 1

Speed vs. Size: Size

Peephole: on


We are currently using Codewarrior 6.2 (but hoping to move everyone up to 10.7), and this was the configuration we used with the classic IDE with no issue.


The disassembly shows that the problematic line of code uses register A7 instead of the expected A5 for access to a global variable. I checked the indexing on A7 in case it would refer to the correct address, but it doesn't. I am performing the same operation on this variable several times throughout the function, which is why I don't understand why only this line uses the wrong register/address. 


I don't encounter this problem with either optimization level 0 or peephole optimization turned off, but we need to save on code space.


I'm quite new to this sort of development, so please let me know if I didn't provide enough information! Any ideas about what I should do?