C30 Compiling problems

Forum related to ERIKA Enterprise and RT-Druid version 2

Moderator: paolo.gai

jagomo

C30 Compiling problems

Post by jagomo »

Hi,

I have intalled EE 1.5.1 and the microchip C30 compiler 3.25.

I've also followed the tutorial for the configuration of RT-DRUID. The path setting is:

C:\Program Files\Microchip\mplabc30\v3.25 (Since C:\Program Files\Microchip\mplabc30\ doesn't contain a bin folder an throws an error)
C:\Program Files\Microchip\MPLAB ASM30 Suite

and here's the thing:

When I compile the project i'm currently working with, the output is as follows:

C:\RTWorkspace\pruebaEPUCK\Debug\make_launcher.bat all
C:\cygwin\bin\bash found!
MAKE_DIRECTORIES

CP crt0.s
CP p30f6014.inc
GEN ee_pic30regs.inc
DEP crt0.S
CP p30f6014.h
GEN ee_pic30regs.h
DEP eecfg.c
DEP code.c
DEP e_init_port.c
DEP e_led.c
DEP e_motors.c
MAKE_DIRECTORIES (after a clean)
ASM crt0.s
CPP eecfg.c
CPP code.c
CPP e_init_port.c
CPP e_led.c
CPP e_motors.c


No error mesage is given but inside the Debug folder no pic30.cof file can be found. What I'm doing wrong? Is C30 3.25 compiler version supported?

Thanks in advance for your time and help.
paolo.gai
Administrator
Posts: 877
Joined: Thu Dec 07, 2006 12:11 pm

Re: C30 Compiling problems

Post by paolo.gai »

Hi,

To be sure I uninstalled all my microchip sw, and installed the latest version (I had to do that soon or later :-) )

I installed 3.25 Upgrade, and the latest MPLAB 8.66.

I noted Microchip changes *again* the position of the files.

I tried to compile, and the system was not finding the compiler (obvious, since it is in a different diractory).

Then I modified the file below

http://svn.tuxfamily.org/viewvc.cgi/eri ... iew=markup

to make the new location visible by default. You need to replace the file:

C:\Evidence\eclipse\plugins\com.eu.evidence.ee_1.5.1.201101101122\ee_base\pkg\cfg\arch\cc_pic30_detach.sh

(note the date of the eclipse plugin could be different; this modification will be installed in the next preview of RT-Druid 1.6.0 in a few weeks)

after that the system worked fine and generated the pic30.cof on my PC.

I hope it helps...

PJ
paolo.gai
Administrator
Posts: 877
Joined: Thu Dec 07, 2006 12:11 pm

Re: C30 Compiling problems

Post by paolo.gai »

Btw, is your project linked to the EPFL E-PUCK?

http://mobots.epfl.ch/e-puck.html

PJ
jagomo

Re: C30 Compiling problems

Post by jagomo »

First of all, thank you for such a quick response.

Yes, we are triying to get the e-puck fully functional under Erika since we want it to support multitasking. I tried replacing the file, but the result stills the same. No errors in the output but no trace of the following lines:

LD
OBJDUMP
************************************

Compilation terminated successfully!


My guess is that still is something to do with the compiler, because one of my partners managed to compile the same code before but with the academic C30 v3.20. Since using the retail version of the 3.20 is not recommended I tried to use the full version of the 3.25 but without much luck and, since no error mesage is showed, without a clue of what is the exact cause of the problem.

Any more ideas will be really appreciated, and thank you again.
paolo.gai
Administrator
Posts: 877
Joined: Thu Dec 07, 2006 12:11 pm

Re: C30 Compiling problems

Post by paolo.gai »

About the e-Puck: Nice!!! Give my regards to Marco Mattavelli, he should be at EPFL Lausanne (maybe you know him...)

About the compiler: quite strange.

you can try also the following:

- try to compile
- open a cygwin window
- go in the Debug directory
- type "make" to compile from the command line

on some machines, don't ask me why, Windows has problems with permissions, or with other installation of the tools. It would be nice to understand what does not work on your machine... (because on mine it works :-) )

Note that if you are a linux user, you can try also MPLAB X, just check

http://erika.tuxfamily.org/wiki/index.p ... Linux_host

Let me know if you have some more luck with the new trials, and which are the errors...

PJ
jagomo

Re: C30 Compiling problems

Post by jagomo »

Sorry I misundertood you. Actually this research has nothing to do with the EPFL (I'm researching for the Politechnical Univesity of Valencia) we are just using the e-puck to achieve what I explained before.

I'll try the new approach you propose and see if there's any luck.

Thanks again.
paolo.gai
Administrator
Posts: 877
Joined: Thu Dec 07, 2006 12:11 pm

Re: C30 Compiling problems

Post by paolo.gai »

ok... let us know!
jagomo

Re: C30 Compiling problems

Post by jagomo »

Ok i think i found the source of the problem. Some of the libraries provided for the e-puck consist in a header file (.h), but with the code provided in assmebler (.s). By what I read in the manual I thougth that the way of including those source files in erika was as follows:

CPU_DATA = PIC30 {
APP_SRC = "code.c";
APP_SRC = "e_init_port.c";
APP_SRC = "e_led.c";
APP_SRC = "e_motors.c";

APP_SRC = "e_init_uart1.s";
APP_SRC = "e_uart1_rx_char.s";
APP_SRC = "e_uart1_tx_char.s";


MULTI_STACK = FALSE;
ICD2 = TRUE;
};


But I must be wrong since commenting those lines (and all code parts making reference to them, of course) solves the issue. I get a succesful compilation and a pic30.cof file.

Whats the propper way of including .s source (if able)?
paolo.gai
Administrator
Posts: 877
Joined: Thu Dec 07, 2006 12:11 pm

Re: C30 Compiling problems

Post by paolo.gai »

ok... good you found.

the rules are for .S, not .s

.s are compiled just by the assembler
.S are first preprocessed using gcc preprocessor and then compiled using the assembler.

try renaming .s in .S

Ciao,

PJ
jagomo

Re: C30 Compiling problems

Post by jagomo »

Ok Done. I renamed all the files and added them properly by the conf.oil. But now when I try to compile I get a new error.

Code: Select all

"C:\RTWorkspace\epuckBTtest\Debug\make_launcher.bat" all 
C:\cygwin\bin\bash found!
MAKE_DIRECTORIES (after a clean)
CPP   e_init_uart1.S
[b]c:\DOCUME~1\ADMINI~1\CONFIG~1\Temp/cc7eob7O.s: Assembler messages:
c:\DOCUME~1\ADMINI~1\CONFIG~1\Temp/cc7eob7O.s:13: Error: can't open e_epuck_ports.inc for reading[/b]
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:32: Error: Invalid operands specified ('bclr U1STA,#URXISEL1').
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:32:        Check operand #2. Operand must be between 0 and 15, inclusive.
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:33: Error: Invalid operands specified ('bclr U1STA,#URXISEL0').
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:33:        Check operand #2. Operand must be between 0 and 15, inclusive.
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:35: Error: Invalid operands specified ('bclr IFS0,#U1RXIF').
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:35:        Check operand #2. Operand must be between 0 and 15, inclusive.
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:36: Error: Invalid operands specified ('bset IEC0,#U1RXIE').
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:36:        Check operand #2. Operand must be between 0 and 15, inclusive.
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:37: Error: Invalid operands specified ('bset U1MODE,#UARTEN').
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:37:        Check operand #2. Operand must be between 0 and 15, inclusive.
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:41: Error: Invalid operands specified ('bclr IFS0,#U1TXIF').
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:41:        Check operand #2. Operand must be between 0 and 15, inclusive.
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:42: Error: Invalid operands specified ('bset IEC0,#U1TXIE').
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:42:        Check operand #2. Operand must be between 0 and 15, inclusive.
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:54: Error: Invalid operands specified ('bset U1STA,#UTXISEL').
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:54:        Check operand #2. Operand must be between 0 and 15, inclusive.
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:55: Error: Invalid operands specified ('bset U1STA,#UTXEN').
c:\RTWORK~1\EPUCKB~1\e_init_uart1.S:55:        Check operand #2. Operand must be between 0 and 15, inclusive.
make: *** [obj/e_init_uart1.o] Error 1
I guess this new source of error is realted the following line inside e_init_uart1.S:

.include "e_epuck_ports.inc"

The file e_epuck_ports.inc is added to the project and I checked that is accesible and not corrupted. I thougt that could be a problem of not finding the file locally where the file cc7eob7O.s is (taking a long shot), but as I expected copying e_epuck_ports.inc into c:\DOCUME~1\ADMINI~1\CONFIG~1\Temp/ didn't solve anything. So I'm out ideas since handling this mixture of assembler code and C code is new for me.

Any piece of advice?
paolo.gai
Administrator
Posts: 877
Joined: Thu Dec 07, 2006 12:11 pm

Re: C30 Compiling problems

Post by paolo.gai »

The assembler is saying "can't open e_epuck_ports.inc for reading". So you have a problem with the .include statement, probabily with the incluosion of the directories from the command line (Maybe you can add some parameters in ASFLAGS in the OIL file).

Note that since you used .S you can use the normal C preprocessor sttements (#include included)

I hope it helps....

PJ
jagomo

Re: C30 Compiling problems

Post by jagomo »

Ok.

First I tried to add the -I parameter to allow the assembler to reach the included files like this:

ASFLAGS = "-I C:\RTWorkspace\epuckBTtest";

But didn't worked. I got the same error. The other suggestion on the other side did the trick. I edited all the .S and .inc files and changed all the .include statements for #include statements. This gave me a clean compilation. Unfortuantely I dont have any more time today to try out if the resulting program is working properly but is a big advance.

Thanks for everything and I'll try to post the results as soon as i'm able just case somebody else will have the same problem with assembly files.
paolo.gai
Administrator
Posts: 877
Joined: Thu Dec 07, 2006 12:11 pm

Re: C30 Compiling problems

Post by paolo.gai »

Yes! this could be a nice thing... thanks for posting back the comments.

Btw, if the e-PUCK software is open-source / GPL / BSD, we could put it into an example to be included in the examples distributed with ERIKA. Let me know if you are interested in that...

Ciao,

PJ
jagomo

Re: C30 Compiling problems

Post by jagomo »

Firs of all, i don't know if e-puck libraries are any kind of open-source (I didn't chacked it yet check it :P), but anyway if they would be and finally I manage to develop something fully fuctional (and with less dirty solutions :D) over erika I won't mind to provide you with the project so you could offer an example or a project template. Is the least I can do after all the help you provided :)

But at this moment I still fighting against the compiler.

I was provided with a new code that makes use of the main characteristics of the epuck robot (tested in a secuential program developed in MPLAB). I ported it to RT-DRUID but when I try to compile I get the following output:

Code: Select all

[size=85]C:\RTWorkspace\KalmanTracking\Debug\make_launcher.bat all 
C:\cygwin\bin\bash found!
DEP   kalmanT.c
GEN deps.pre
GEN deps
MAKE_DIRECTORIES (after a clean)
CPP   kalmanT.c
In file included from c:\RTWORK~1\KALMAN~1\kalmanT.c:16:
c:/ARCHIV~1/MICROC~1/mplabc30/v3.25/include/stdio.h:167: warning: ignoring #pragma printf_check 
c:/ARCHIV~1/MICROC~1/mplabc30/v3.25/include/stdio.h:168: warning: ignoring #pragma printf_check 
c:/ARCHIV~1/MICROC~1/mplabc30/v3.25/include/stdio.h:205: warning: ignoring #pragma printf_check 
c:/ARCHIV~1/MICROC~1/mplabc30/v3.25/include/stdio.h:206: warning: ignoring #pragma printf_check 
LD
c:\ARCHIV~1\MICROC~1\mplabc30\v3.25\bin\bin\pic30-coff-ld.exe Error: A heap is required, but has not been specified
make: *** [pic30.cof] Error 1[/size]
From what I'm been able to google around, I think is related to the inclusion of the stdio.h library. A possible solution that was suggested is to especify a heap size (but I only found how to do it under MPLAB).

Is there a way to do this in RT-DRUID? Any other suggestions about what could be causing the error?

Greetings.
paolo.gai
Administrator
Posts: 877
Joined: Thu Dec 07, 2006 12:11 pm

Re: C30 Compiling problems

Post by paolo.gai »

Hi!

Sure! Specifying a heap is quite simple. It's a parameter passed to the linker. Then it goes in LDFLAGS.

I have just did a "grep -r heap *" on the pic30 examples directory, and it returned me 3-4 examples using the heap.

The line to add is the following:

LDFLAGS = "--heap=512";

in the OIL file... be sure to specify a heap big enough...

I hope it helps...

Ciao,

PJ
Locked