Jump to content
Sign in to follow this  
chmotori

Bug In Pclath Addressing For Pic16f1938

Recommended Posts

Hello,

 

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,

Elpidio Scaroni

PIC16F1938BUG.zip

Share this post


Link to post
Share on other sites

chmotori,

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

...

This is an issue that had already been reported and has been fixed.

It will be in the next release (V7.03).

 

Regards

Dave

Share this post


Link to post
Share on other sites

Dave,

 

I'm happy you already fixed this issue. Unfortunately, I'm stuck with my project since I cannot execute or debug the code. Have you an idea about when version 7.03 will be released?

 

I recently bought a commercial licence for this new company I started to work with. I told my boss to buy this product because I already used it for a long time for non-commercial purposes, and I never had any problem. Now I cannot wait a month or two for the official release, I'm afraid I'll be fired before that time. Could you please build up a release candidate of the compiler? I'd appreciate it very much.

 

Bye - Elpidio Scaroni

Share this post


Link to post
Share on other sites
...Could you please build up a release candidate of the compiler? I'd appreciate it very much...

 

No problem. Check you PM.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×