Page 1 of 1

Some issues with the new Beta compiler

Posted: 10 Dec 2009 05:06
by Daniel Wee
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

Posted: 10 Dec 2009 15:25
by milan
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

Posted: 11 Dec 2009 02:45
by Daniel Wee
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

Posted: 11 Dec 2009 09:37
by milan
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
}

Re: Some issues with the new Beta compiler

Posted: 11 Dec 2009 10:50
by nikola.kostic
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.

Posted: 11 Dec 2009 17:47
by Daniel Wee
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

Posted: 11 Dec 2009 22:58
by janni
As milan has shown, use

Code: Select all

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