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
Some issues with the new Beta compiler
Hi,
2)
try this code :
it should be clear
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
}
SmartADAPT2 rules !
-
- Posts: 38
- Joined: 14 Jun 2007 22:05
Hi,
just do it like i posted before
line :
asm mov W0, _myvar
only reversed :
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 !
- nikola.kostic
- mikroElektronika team
- Posts: 433
- Joined: 11 Aug 2009 12:12
Re: Some issues with the new Beta compiler
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.Daniel Wee wrote: 1. Declaring pointers.
Most compilers allow the following:-
char *test;
but the new compiler seems to insist on:-
char * test;
http://www.mikroe.com/en/support/
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 usedDaniel 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.
Regarding other warnings you get, please report them and we will inspect them.
-
- Posts: 38
- Joined: 14 Jun 2007 22:05
As milan has shown, use
Code: Select all
asm mov lo_addr(_myvar),W0 ; lower 16 bits of address of myvar -> W0