Some issues with the new Beta compiler

Beta Testing discussion on mikroC for dsPIC30/33 and PIC24.
Post Reply
Author
Message
Daniel Wee
Posts: 38
Joined: 14 Jun 2007 22:05

Some issues with the new Beta compiler

#1 Post by Daniel Wee » 10 Dec 2009 05:06

I am testing out the new compiler and have run into several issues, some minor - some not.

1. Declaring pointers.

Most compilers allow the following:-

char *test;

but the new compiler seems to insist on:-

char * test;

or it will spit out an error saying that a const expression is needed. This doesn't always happen though.

2. Assembly addresses

In the previous version, I would do the following:-

mov #@_myvar, W1

to load the address of myvar into W1. Now it gives me an error and I am not sure what the new syntax is.

3. Strange warning for const pointer assignment

const char a[] = "abc";

void test(void) {
char *c = a;
}

This will create some odd warning.

There are several other strange warnings but I think there needs to be more work done to bring the compiler up to speed.

Daniel

User avatar
milan
mikroElektronika team
Posts: 1013
Joined: 04 May 2006 16:36
Contact:

#2 Post by milan » 10 Dec 2009 15:25

Hi,

2)

try this code :

Code: Select all

unsigned myvar absolute 0x1234;

void main() {
  myvar = 5;
  asm nop
  asm mov #10, W0                    ; 10 -> W0
  asm mov W0, _myvar                 ; W0 -> myvar 
  asm mov lo_addr(_myvar), W1        ; lo_addr(myvar) -> W1
  
}
it should be clear
SmartADAPT2 rules !

Daniel Wee
Posts: 38
Joined: 14 Jun 2007 22:05

#3 Post by Daniel Wee » 11 Dec 2009 02:45

Yes but I do not want to have to manually assign all the addresses. In the Microchip C30 assembler, I can just do:-

mov #_myvar, W0

and previously in mikroC I could do:-

mov #@_myvar, W0

so why doesn't the current version do this? Seems like a step backwards to me.

Daniel

User avatar
milan
mikroElektronika team
Posts: 1013
Joined: 04 May 2006 16:36
Contact:

#4 Post by milan » 11 Dec 2009 09:37

Hi,

just do it like i posted before
line :
asm mov W0, _myvar
only reversed :

Code: Select all

unsigned myvar;

void main() {

  myvar = 5;
  asm mov _myvar, W0   ;  here it is, it's simpler than before :) 
  asm nop
}
SmartADAPT2 rules !

User avatar
nikola.kostic
mikroElektronika team
Posts: 433
Joined: 11 Aug 2009 12:12

Re: Some issues with the new Beta compiler

#5 Post by nikola.kostic » 11 Dec 2009 10:50

Daniel Wee wrote: 1. Declaring pointers.

Most compilers allow the following:-

char *test;

but the new compiler seems to insist on:-

char * test;
I have tested this, however, I can't reproduce this problem as both versions of declaration work fine. If you have some code that is generating this problem, please post it here or send us complete project via support ticket and we will research it and fix it if shows as a bug.
http://www.mikroe.com/en/support/

Daniel Wee wrote: 3. Strange warning for const pointer assignment

const char a[] = "abc";

void test(void) {
char *c = a;
}

This will create some odd warning.

There are several other strange warnings but I think there needs to be more work done to bring the compiler up to speed.
As a is used for accumulator, try using some other name for variable and it should work fine. You can use Ctrl+Alt+D to view def file for chip you are using and check which names are already used

Regarding other warnings you get, please report them and we will inspect them.

Daniel Wee
Posts: 38
Joined: 14 Jun 2007 22:05

#6 Post by Daniel Wee » 11 Dec 2009 17:47

mov _myvar, W0 will move the contents of myvar into W0 which is not what I want. I want the address of myvar in W0.

Daniel

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

#7 Post by janni » 11 Dec 2009 22:58

As milan has shown, use

Code: Select all

asm mov lo_addr(_myvar),W0        ; lower 16 bits of address of myvar -> W0

Post Reply

Return to “mikroC for dsPIC30/33 and PIC24 Beta Testing”