I recently upgraded to BoostC++ version 7.02, but it didn't solve a problem I'm having since a long time. I'll try to explain the issue with my own words, but then it's better to compile the project attached, and take a look to the code generated by the compiler.
The program I've written currently is about 11kwords, that is a 67% of tyhe total memory space of the PIC16F1938. Analyzing the machine code generated by the compiler, right at the start (Reset vector at address 0x0000), there's a jump that should take the cpu to the area in which all of the static variables are initialized. Instead of doing this, the GOTO instruction ends up in the middle of the code of a procedure, that is not even the main().
I investigated a bit to find the reason of this, and I saw the following:
- the first instrucion at 0x0000 is a BSF 0xA, 0x3 (sets bit 3 into PCLATH)
- the second instruction at 0x0001 is GOTO 0x294
The GOTO instruction, together with the value of PCLATH (which is 8), will take the PC to the address 0x0A94, which is in the middle of my code. The right place to jump to, sould have been 0x2a94. Seems like it was missing an additional instruction like BSF 0xA,0x5. This would have set PCLATH to 0x28. By manually forcing PCLATH to 0x28 (in debug mode with the ICD3), the code executes well, it goes through all of the static variables, and at last it reaches the begin of main().
Please advise if my interpretation of the bug is correct, and do the fix as soon as possible. If you can manage to build a trial version of the compiler by fixing this bug, I'd like to test it, I don't have the time to wait for an official release.
Thank you - best regards,