View previous topic :: View next topic |
Author |
Message |
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
New PCD bug in V4.087 |
Posted: Sun Mar 15, 2009 10:58 am |
|
|
Although PCD V4.087 has been released with the statement "A number of PCD issues have been resolved", it's apparently introducing new surprizing bugs with int1 variables. I use #bit notation to assign different variable addresses, the problem also occurs with variable declared as int1 or int1 members of structures above address 0x1000.
Code: | #include <24FJ128GA106.h>
#bit b1 = 0xFF0.3
#bit b2 = 0x1000.3
void main(void)
{
if (b1) b1=0;
if (b2) b2=0;
} |
While b1 is treated as with previous versions, the b2 access is compiled incorrectly see below, b2 is treated as an int1* pointer. No idea, what the programmers tried to achieve here. As a result, PCD V4.087 is unusable, if data space above 0x1000 is populated with any int1 vars. A dummy (int1) type cast can be workaround, but not a serious solution of course, cause it would have to be applied to hundreds of int1 instances.
.................... if (b1) b1=0;
0020C: BTSS.B FF0.3
0020E: BRA 212
00210: BCLR.B FF0.3
.................... if (b2) b2=0;
00212: MOV 1000,W4
00214: MOV [W4],W4
00216: BTSS W4.3
00218: BRA 21C
0021A: BCLR.B 1000.3 |
|
|
n-squared
Joined: 03 Oct 2006 Posts: 99
|
|
Posted: Sun Mar 15, 2009 1:01 pm |
|
|
The code looks correct to me. It is using W4 as a pointer AND later as a temporary accumulator, but tests the actual contents of 0x1000.3.
The problem with this code is that it uses two more instructions to execute. Just like you said - makes no sense.
The guys at CCS still have a long way to go before PCD is a serious product.
I just saw on Microchip web site an announcement of purchasing HI-TECH. I expect they will provide the best of both. If only they had all the libraries of CCS... _________________ Every solution has a problem. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sun Mar 15, 2009 1:46 pm |
|
|
Quote: | The code looks correct to me. | It isn't. The below code would be functional correct, the V4.087 code ist loading the content of address 0x1000 to W4 rather then the address value, in other words, it treats b2 as a pointer int1*.
Code: | MOV #1000,W4
MOV [W4],W4
BTSS W4.3 |
I never would have checked the code, if it works correctly. I was trying a small code change with newly installed V4.087 and experienced complete failure of a previously working application. |
|
|
n-squared
Joined: 03 Oct 2006 Posts: 99
|
|
Posted: Sun Mar 15, 2009 1:56 pm |
|
|
ah, you are right. I did not notice the omission of the # sign.
Sorry.
These guys keep reinforcing my saying that "every solution has a problem". They keep new problems while solving previous problems. _________________ Every solution has a problem. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Tue Mar 17, 2009 8:47 am |
|
|
CCS support told, the issue gonna be fixed in the next compiler release. |
|
|
|