Hi, I am porting my code from compiler C51 ver6.23 and BL51 to the new compiler and linker , C51 ver 7.00 and LX51 ver3.30 . This was to take advantage of the optimisation features of the LX51's linker code packing. The code when compiled and linked while disabling the Linker code packing works just fine. But once I enable the linker code packing the executable doesn't function properly on the target hardware. I feel some corruption of my data is occurring. Just by using this feature I could straight away reduce the code size by 3%. Any suggestions on how I could debug this?? And another problem I faced is untill I decalare my PDATA variables as static PDATA the LX51 linker doesn't put them into PDATA Segment...!! Thanks, -Binu
Binu, If you right click on the appropriate file in the file list at the left hand side of the screen and select "Options for file", "C51" there is a check box for linker code packing for that particular file. In the project I'm working on at the moment the 'tick' in the box is greyed out and I can't uncheck it but you may be able to. I've had some strange behaviour from the IDE particularly with projects that have been converted from BL51, it seems to work better if you create a new project from scratch. It also seems a bit strange to me that code packing can be disabled for an individual module - I thought the call/jump optimisation would have to be performed on the complete program after linkage and all other optimisations to gain maximum benefit. If I were you I'd invest a bit more time investigating a build that doesn't work properly to try to find out exactly where the code is going wrong. If you 'fix' the problem by changing options or rearranging code location you will never know if you have a bug waiting to catch you out next time you make changes to the code, or even worse a bug that is affecting your program in some way that you're not spotting in testing. I find debugging (as you are doing) on the target via the serial port with printf() very effective in most cases. Of course I do have a vested interest - if you do find a bug in the linker I'd like to know about it! Dafydd