Pinguino Forum

Full Version: Help on compiling the Ethernet example
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,

I am new in the Pinguino platform.

By now I am trying to compile the  Ethernet example.

The thing is that the compiler gives the error :
[DEBUG] Ending 'verify'
[OUT] ERROR: 9: missing terminating > character
[OUT] 48: token -> '1' ; column 27
[OUT]
>>> 


Opening the stdout window I get the last  lines as:

sdcc: Generating code...
In file included from C:\pinguino\v11\user\source\main.c:39:
C:\pinguino\v11\user\source\/define.h:9:30: error: missing terminating > character
sdcpp.exe: fatal error: when writing output to : Invalid argument
/dvpt/pinguino/git-copy/pinguino-compilers/sources/sdcc/src/pic16/main.c:697 setting interrupt vector addresses 0xc00
C:/pinguino/v11/p8/include/pinguino/core/typedef.h:48: syntax error: token -> '1' ; column 27

When I open the file
C:\pinguino\v11\user\source\define.h
 
I get:

#define BUFFER_SIZE 500
#define ONEWIREBUS 6
#define SPIINIT
#define STR_BUFFER_SIZE 22
#include <18b20.c>
#include <digitalp.c>
#include <digitalw.c>
#include <ethernet/ethernet.c
#include <ethernet/ethernet.c>
#include <stdio.c>
#include <string.h>
#include <typedef.h>

The problem is that I delete the wrong line but each time I run the compiler the same contents reapear.

What did I miss? Where are stored the "original" files?
Hello,
Would you precise your microcontroller ? If it is a 18fx550 I have to try to improve some functions to save memory space.
If it is a 18f47j53 or 18f26j50 there no memory problem except when changing from X.4 to V11 we have to adapt the spi library (§1).
The 2 errors you mentionned are very easy to repair(§2).
I try ASAP to offer you corrected files.
André
(07-11-2016, 10:38 PM)gtcbreizh Wrote: [ -> ]Hello,
Would you precise your microcontroller ? If it is a 18fx550 I have to try to improve some functions to save memory space.
If it is a 18f47j53 or 18f26j50 there no memory problem except when changing from X.4 to V11 we have to adapt the spi library (§1).
The 2 errors you mentionned are very easy to repair(§2).
I try ASAP to offer you corrected files.
André

Hi André,

My goal is really to try it on a 18f2550 (the one I have on my bench[Image: wink.gif]) but by now I am only trying to compile the example for a 47J53.

For me the problem, at the moment, is that I do not find where the IDE (or the make proccess) goes to pick the files like "define.h". I would like also to have a look at the  libraries these examples use.

Is there a doc. where I can learn the various steps of the compiling proccess without having to "disassemble" the makefiles?

Thanks.

J.A.R.Militão
Hello J.A.R.
I am going to try to explain how the Pinguino environment works.
You write your .pde using a language close to the Arduino langage but with a great difference : your .pde is converted into C (SDCC or XC8 compiler) while the .ino is converted into C++.
When "compiling" this .pde the IDE finds in the P8\pdl folder numerous .pdl files which contain information to translate the Pinguino code.
example = ethernet.pdl (used in the case of ethernet_web_temp.pde) listing :
Ethernet.init eth_init#include <ethernet/ethernet.c>
Ethernet.read enc28j60PacketReceive#include <ethernet/ethernet.c>
Ethernet.write www_server_reply#include <ethernet/ethernet.c>
Ethernet.requestAnalysis packetloop_icmp_tcp#include <ethernet/ethernet.c>

So when the IDE meets Ethernet.init(mymac,myip,mywwwport) it is converted into eth_init(mymac,myip,mywwwport), and the define.h receive #include <ethernet/ethernet.c>.
Then eth_init(mymac,myip,mywwwport); is written in user.c.

Now you can imagine this process is repeated according the code you have written :
Another example, when meeting this code in ethernet_web_temp.pde

DS18B20.read(ONEWIREBUS, SKIPROM, &t)

the IDE looks at this line in 1wire.pdl :
DS18B20.read DS18B20Read#include <18b20.c>

and translates it into DS18B20Read(ONEWIREBUS, SKIPROM, &t) and adds #include <18b20.c> into define.h
and DS18B20Read(ONEWIREBUS, SKIPROM, &t) into user.c.

Note you find ethernet\ethernet.c and  18b20.c in P8\include\pinguino\libraries.
Other files (spi.c, oscillator.c, ...) which contain functions close to the hardware are found in P8\include\pinguino\core.

Finally we get 2 important files user.c and define.h located in pinguino\v11\user\source ( I refer to Windows).
In this same folder you find main.c which is compiled as the heart of your application and which introduce define.h and user.c in the compilation process.

Therefore you can go further in the understanding of this process by analysing the 3 files main.c, define.h, user.c. Then you can look at the core or libraries files.

Following the compiling is the linking which refers to the .lkr file associated to the microcontroller you have beforehand declare. This .lkr is found in p8\lkr folder.

Here is a quick overview for the Pinguino environment. I hope it can help you.

I need yet a bit of time to optimize the ethernet + ds18b20 libraries for the 18fx550.

André
Hello André.

Many thanks for the explanation. I find it very usefull. Can I suggest this text, or a similar one, be posted somewhere on the Pinguino documentation?

Now I understand why the define.h reapears all the time with the same error.

What I still do not understand is why it appears, in the define.h file, the lines:
        #include <ethernet/ethernet.c
        #include <ethernet/ethernet.c>

I was expecting to find in the ethernet.pdl  some lines like:
       Ethernet.init eth_init#include <ethernet/ethernet.c
       Ethernet.read enc28j60PacketReceive#include <ethernet/ethernet.c>

But no. All the lines seem to be correct in that file!

Does this has anything to see with your statment:
"I need yet a bit of time to optimize the ethernet + ds18b20 libraries for the 18fx550."

Are you saying that it may be because the generated code is to big there are some "side efects"?

Regards.

J.A.R.Militão
Hello
§1 In ethernet.pdl :

Ethernet.init eth_init#include <ethernet/ethernet.c>
Ethernet.read enc28j60PacketReceive#include <ethernet/ethernet.c>
Ethernet.write www_server_reply#include <ethernet/ethernet.c>
Ethernet.requestAnalysis packetloop_icmp_tcp#include <ethernet/ethernet.c>

the problem is in the last line which is not terminated by CR LF  or by, as minimum, LF

§2 the second error is due to typedef.h (in pinguino\core) - line 47:
//    typedef unsigned char       BYTE;
comment it !

NB. There are no side effects associated to the size problem.

§3 the optimization goal is to reduce the size of the .hex in the case of 18fx550 (only 32KB). I succeeded to do it by rewriting the DS18B20 library which is too general. Now it is adapted to our need : one sensor.

But now I encounter 2 difficulties :
for the 18f4550 the spi library seems not to work
for the 18f47j53, that I used earlier to test the enc28j60 device with success, the libusb driver installation is unsuccessful (recurring Windows10 problem !).

Do you use Linux or Windows ?

I hope to solve the difficulties in the coming days either using Windows, either using Linux.

André
(09-11-2016, 03:28 PM)gtcbreizh Wrote: [ -> ]Hello
§1 In ethernet.pdl :

Ethernet.init eth_init#include <ethernet/ethernet.c>
Ethernet.read enc28j60PacketReceive#include <ethernet/ethernet.c>
Ethernet.write www_server_reply#include <ethernet/ethernet.c>
Ethernet.requestAnalysis packetloop_icmp_tcp#include <ethernet/ethernet.c>

the problem is in the last line which is not terminated by CR LF  or by, as minimum, LF

§2 the second error is due to typedef.h (in pinguino\core) - line 47:
//    typedef unsigned char       BYTE;
comment it !

NB. There are no side effects associated to the size problem.

§3 the optimization goal is to reduce the size of the .hex in the case of 18fx550 (only 32KB). I succeeded to do it by rewriting the DS18B20 library which is too general. Now it is adapted to our need : one sensor.

But now I encounter 2 difficulties :
for the 18f4550 the spi library seems not to work
for the 18f47j53, that I used earlier to test the enc28j60 device with success, the libusb driver installation is unsuccessful (recurring Windows10 problem !).

Do you use Linux or Windows ?

I hope to solve the difficulties in the coming days either using Windows, either using Linux.

André

Hi!

§1 and §2
 I managed to make the corrections and now it comples with no erros (for  the 47J53 and 2550).
Now I have to assemble my Pic on a bread board to start testing it.

§3
I am using Win 7 ultimate but Ialso have a PicKit2 and wil use it to program the device. 

§4
Apart from the PIC18F2550 I also have an Olimex ENC28J60-H development board.
Is there a circuit recomended for this example? 

Thanks

J.A.R.Militão
Adapt IP address :
static uint8_t myip[4] = {192,168,1,21};  // Livebox router from my Orange provider
static char baseurl[] = "http://192.168.1.21/";
according your local net.

André
(10-11-2016, 03:10 PM)gtcbreizh Wrote: [ -> ]Adapt IP address :
static uint8_t myip[4] = {192,168,1,21};  // Livebox router from my Orange provider
static char baseurl[] = "http://192.168.1.21/";
according your local net.

André

Thanks André.

In the next few days I will assemble a board whit the next circuit and try it.

[attachment=821]

J.A.R.Militão
(10-11-2016, 10:37 PM)jarmilitao Wrote: [ -> ]
(10-11-2016, 03:10 PM)gtcbreizh Wrote: [ -> ]Adapt IP address :
static uint8_t myip[4] = {192,168,1,21};  // Livebox router from my Orange provider
static char baseurl[] = "http://192.168.1.21/";
according your local net.

André

Thanks André.

In the next few days I will assemble a board whit the next circuit and try it.



J.A.R.Militão

Strange now I cant compile for PIC18F2550. 

And even for the 47J53 if I select ICSP I get the same type of error:
error: Linker script has no definition that matches the type of section "udata_main_7".



warning: Relocation of section "udata_main_7" failed, relocating to a shared memory location.
error: Linker script has no definition that matches the type of section "udata_main_7".
Processor: 18f2550
sdcc: Calling linker...
+ C:\pinguino\COMPIL~1\p8\bin\gplink.exe -I"C:\pinguino\compilers\p8\bin\..\share\sdcc\lib\pic16" -I"C:\pinguino\compilers\p8\bin\..\share\sdcc\non-free\lib\pic16" -sC:\pinguino\v11\p8\lkr\boot4.18f2550.lkr -m -w -r -o "C:\pinguino\v11\user\source\main.hex" "C:\pinguino\v11\user\source\main.o" "libio18f2550.lib" "libdev18f2550.lib" "libc18f.lib" "libm18f.lib" "libsdcc.lib" "libdev18f2550.lib" "libsdcc.lib"
+ C:\pinguino\COMPIL~1\p8\bin\gplink.exe -I"C:\pinguino\compilers\p8\bin\..\share\sdcc\lib\pic16" -I"C:\pinguino\compilers\p8\bin\..\share\sdcc\non-free\lib\pic16" -sC:\pinguino\v11\p8\lkr\boot4.18f2550.lkr -m -w -r -o "C:\pinguino\v11\user\source\main.hex" "C:\pinguino\v11\user\source\main.o" "libio18f2550.lib" "libdev18f2550.lib" "libc18f.lib" "libm18f.lib" "libsdcc.lib" "libdev18f2550.lib" "libsdcc.lib" returned errorcode 1
/dvpt/pinguino/git-copy/pinguino-compilers/sources/sdcc/src/pic16/main.c:697 setting interrupt vector addresses 0xc00
Pages: 1 2