BUG in software emulator debugger

Post your requests and ideas on the future development of mikroC PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
Vladimir.CDI
Posts: 28
Joined: 04 Nov 2013 13:21

BUG in software emulator debugger

#1 Post by Vladimir.CDI » 04 Nov 2013 13:32

Hello,

I found some bugs doing asm part code debugging (mikroC PRO for dsPIC30/33)

case 1:
XOR.B W12,[W10++],W12

here W10 = W10+2 after operation (but have to be +1)

case 2:
do w11,loop2
XOR.B W12,[W10++],W12
add w3,w12,w0
mov.b [w0],w12
loop2: nop

sometimes havind W11 = 0 debugger goes to neverending loop (even App crash) but have to pass loop only ones.

Hope this will be solved
Last edited by Vladimir.CDI on 17 Nov 2013 11:09, edited 1 time in total.

User avatar
dejan.odabasic
mikroElektronika team
Posts: 2649
Joined: 30 Apr 2012 14:20

Re: BUG in software emulator debugger

#2 Post by dejan.odabasic » 06 Nov 2013 16:42

Hello,

Could you please post some example code which will more precisely demonstrate the issue.

Code which you posted looks out of context.

Best regards.

Vladimir.CDI
Posts: 28
Joined: 04 Nov 2013 13:21

Re: BUG in software emulator debugger

#3 Post by Vladimir.CDI » 17 Nov 2013 11:08

dejan.odabasic wrote:Hello,

Could you please post some example code which will more precisely demonstrate the issue.

Code which you posted looks out of context.

Best regards.
sure

unsigned char *test1(unsigned char *a, unsigned char b) {
asm {
xor.b w11, [w10],[w10++]
mov w10,w0
}
}

in case, that you use MikroC Pro software debugger you can see, that after XOR operation W10 is increaced by 2 (it sould be 1 according to microchip docs). This bug is related to any arithmetic operation AND, ORI, XOR, ADD, SUB

User avatar
dejan.odabasic
mikroElektronika team
Posts: 2649
Joined: 30 Apr 2012 14:20

Re: BUG in software emulator debugger

#4 Post by dejan.odabasic » 18 Nov 2013 17:41

Hello,

Thank you for posting additional example.
This issue will be corrected as soon as possible.

Best regards.

Vladimir.CDI
Posts: 28
Joined: 04 Nov 2013 13:21

One more bug in software debugger

#5 Post by Vladimir.CDI » 31 Jan 2014 14:01

Hello,

found one more software debugger bug

Code: Select all

ZE [Wx],Wn
works not as expected. In any case Wn will be zero in software degugger
due to that reason code

Code: Select all

char *p, a[] = {"12345"};
int i;
p = &a;
i = (int) *p++;
works wrong in simulator (i always zero) in case, that it translated to

Code: Select all

ZE [Wx],Wn
and works right when translated to

Code: Select all

MOV.B    [Wx],wn
ZE      Wn,Wn
Hope, that this will be possible to correct in nearest future

p.s. using MicroC Pro for dsPic 6.0.0

User avatar
dejan.odabasic
mikroElektronika team
Posts: 2649
Joined: 30 Apr 2012 14:20

Re: BUG in software emulator debugger

#6 Post by dejan.odabasic » 04 Feb 2014 16:18

Hello,

I have tested your minimized code in mikroC PRO for dsPIC v6.0.1 and it worked as expected.

Please install the latest live update by clicking on Help>Check for Updates.

Best regards.

Vladimir.CDI
Posts: 28
Joined: 04 Nov 2013 13:21

Re: BUG in software emulator debugger

#7 Post by Vladimir.CDI » 12 Feb 2014 10:43

OK, that you for your replay - not it works OK

I have tested, that autoincrement in debugger still works wrong, can you please put this to your plans for future bug correction
Vladimir.CDI wrote:

Code: Select all

unsigned char       *test1(unsigned char *a, unsigned char b) {
asm       {
          xor.b          w11, [w10],[w10++]
          mov            w10,w0
          }
}
in case, that you use MikroC Pro software debugger you can see, that after XOR operation W10 is increaced by 2 (it sould be 1 according to microchip docs). This bug is related to any arithmetic operation AND, ORI, XOR, ADD, SUB

Vladimir.CDI
Posts: 28
Joined: 04 Nov 2013 13:21

Re: BUG in software emulator debugger

#8 Post by Vladimir.CDI » 18 Feb 2014 10:09

Hello,

tested version 6.0.1 of a compiler and found, that some bugs is still there. Can you please put them to bugs list

Code: Select all

char testa[20];
volatile int i;
void main()
{
asm {
    mov           #lo_addr(_testa+3),w0
    mov           #0xFF,w1
    mov.b         w1,[w0--]
    xor.b         w1,[++w0],w1    // here W0 have to be increaced by 1 (but it is by 2 in SoftwareDebugger)
    mov           #lo_addr(_testa+3),w0
    ze            [w0],w0         // here W0 have to be 0xFFFF, (but it is 0x00FF using SoftwareDebugger)
}
       testa[3] = 0xFF;
       i = (int) testa[3];       // here variable "i" have to be -1, but it is 255 using software debugger
}

User avatar
dejan.odabasic
mikroElektronika team
Posts: 2649
Joined: 30 Apr 2012 14:20

Re: BUG in software emulator debugger

#9 Post by dejan.odabasic » 18 Feb 2014 13:14

Hello,

Problem with double incrementing in SW debugger is solved and it will be propagated in new release of dsPIC compilers.

If you wish to have 0xFFFF in W0 reg, instead of ZE(Zero-extend), SE(Sign-Extend) instruction should be used.

By default char type is unsigned char in mikroC.
With testa explicitly declared as signed char, the value of variable i will be -1.

Code: Select all

signed char testa[20];
volatile int i;
void main()
{
  testa[3] = 0xFF;
  Delay_100ms();      // Dummy code
  i = testa[3];       // Here variable i = -1 (with or without explicit casting)
}
Best regards.

Vladimir.CDI
Posts: 28
Joined: 04 Nov 2013 13:21

Re: BUG in software emulator debugger

#10 Post by Vladimir.CDI » 18 Feb 2014 16:49

Thanks for signed char explanation

Post Reply

Return to “mikroC PRO for dsPIC30/33 and PIC24 Wish List”