View previous topic :: View next topic |
Author |
Message |
C-H Wu Guest
|
Any Bug in PCH 3.188 ? Please heeeelp ! |
Posted: Sat May 22, 2004 7:06 am |
|
|
Dear Friends:
Due to the unacceptable bug with 3.190, 3.191 and 3.200, I am considering back to 3.188. If any of you have any knowledge about the proven bugs with 3.188, could you please kindly share your valuable information with us.
Thanks a huge lot.
Sincerely,
Chang-Huei Wu |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat May 22, 2004 9:48 am |
|
|
We used PCH 3.188 on a major project with the 18F458 and it worked OK. |
|
|
C-H Wu Guest
|
confused |
Posted: Sat May 22, 2004 1:06 pm |
|
|
Dear PCM programmer:
Thanks for your encouraging information.
The project I am working on is 18F458 + 3.188 + #opt 10 + roughly 32 kB, I found that it does have a bug relating to bank setting on function return, however, it does NOT show up in simplied small test code. Same situation for 3.190, 191, and 3.200. After all these test, I am really confused , and I have nothing more to say but keep my fingers crossed.
Best wishes |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat May 22, 2004 1:39 pm |
|
|
Quote: | The project I am working on is 18F458 + 3.188 + #opt 10 + roughly 32
kB, I found that it does have a bug relating to bank setting on function
return, however, it does NOT show up in simplied small test code |
Our project used about 51% of the ROM.
We did not use #opt 10 or #opt 11, because I didn't want to take a risk.
Since you are at 32KB, I guess you have to use it, or find some other
way to reduce the code size. |
|
|
C-H Wu Guest
|
|
Posted: Sat May 22, 2004 9:07 pm |
|
|
While trying to reduce the code size, I will call Microchip tomorrow to see if they have any engineering sample for 18F4525 or 18F4620. |
|
|
C-H Wu Guest
|
A small bug with high optimization level, PCH 3.188 ~ 3.200 |
Posted: Sun May 23, 2004 2:17 am |
|
|
Tested with my real code for 18F458, the bank select bug with high optimization level when using PCH 3.188 ~ 3.200 turns out the following results
Code: | // 3.173 3.188 3.191 3.200
// ------------------------------------------------------------------
// ROM used Bug ROM Bug ROM Bug ROM Bug
// ------------------------------------------------------------------
// #opt 0 // 81% no
// #opt 7 // 78% no 78% no 74% no
// #opt 9 // 23438 (72%) no 71% yes 71% yes 61% yes
// #opt 10 // N/A 62% yse 61% yes N/A
|
A simplified test code may explain what happened like below:
Code: | int16 x, y;
#locate x = 0x056
#locate y = 0x356
void main()
{
while(1)
{
if ( kbhit() && (mode = getc()) )
{
if ( mode == '0' ) fun_A();
else if ( mode == '1' ) fun_B();
else if ( mode == '2' ) fun_C();
}
y = 0;
}
|
when returning from fun_B() with high optimization level, the code write to variable x instead of y. However, there is no bug with this small test program.
Work around: instead of using y = 0, wrap it up with a function, then the bank select will be fixed, since CCS always put a "MOVLB 0" before calling a function or returning from a funcion, and there will be a correct "MOVLB n" right after entering the function.
Is it my problem in using global variables or is it really a compiler bug ?
Thanks for your comment.
Best regards
C-H Wu |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Sun May 23, 2004 9:37 am |
|
|
This line
Code: |
if ( kbhit() && (mode = getc()) )
|
looks to me like it will cause problems.
Does this have the same problems?
Code: | if ( kbhit())
{
mode = getc();
if ( mode == '0' ) fun_A();
else if ( mode == '1' ) fun_B();
else if ( mode == '2' ) fun_C();
}
y = 0;
|
|
|
|
C-H Wu Guest
|
|
Posted: Sun May 23, 2004 6:48 pm |
|
|
Thanks for your suggestion,
What in my real big code is
Code: | if (host.eth.pcol == PCOL_IP && ip_recv()) |
I tried to separate the code into two lines
Code: | if (host.eth.pcol == PCOL_IP) if (ip_recv()) |
and the result is still the same, bug. |
|
|
C-H Wu Guest
|
Another workaround |
Posted: Tue May 25, 2004 10:34 pm |
|
|
Considering the BSR setting bug in my previous post Code: | if ( kbhit() && (mode = getc()) )
{
if ( mode == '0' ) fun_A();
else if ( mode == '1' ) fun_B();
else if ( mode == '2' ) fun_C();
}
y = 0;
|
the bug disappeared by using switch-case statement.
Cheers ! |
|
|
|