View previous topic :: View next topic |
Author |
Message |
WalkOver
Joined: 14 May 2021 Posts: 24
|
Help porting Ethernet W5500 chip code to CCS |
Posted: Tue Jul 06, 2021 10:35 am |
|
|
Hello,
Im trying to use Wiznet W5500 with CCS.
There is an example code supplied by MikroElectronika company :
https://libstock.mikroe.com/projects/view/1314/eth-wiz-click-board-example
Their code seems to be based on the original Wiznet library....But for me, this is all Chinese. There are lots of pointers and define and it's hard for me to understand why it compiles on MikroE's compiler but not on CCS.
At first, I thought it was a keyword problem as the compiler returned to me mismatched #IF #ENDIF....
Does anyone have a working driver for W5500 and CCS ?
Or can have a look at what is going on ?
Thank you so much for your help. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Wed Jul 07, 2021 12:58 am |
|
|
The simple reason it won't compile is that it is written in a different language.
Though the 'core' operations in C are all the same every single thing that
deals with hardware, is 'language specific'. So all the chip configuration,
I/O setup etc. etc, needs to be re-written.
The way to translate code from a second compiler, is always to treat it
as a 'flow chart', then follow through this step by step, using the instructions
for the new compiler.
Have a look at these two threads:
<https://www.ccsinfo.com/forum/viewtopic.php?t=48546>
<http://www.ccsinfo.com/forum/viewtopic.php?t=58376>
The first poster said he had it partially working, so may be able to help. |
|
|
WalkOver
Joined: 14 May 2021 Posts: 24
|
|
Posted: Thu Jul 08, 2021 3:17 am |
|
|
Ttelmah wrote: | The simple reason it won't compile is that it is written in a different language.
Though the 'core' operations in C are all the same every single thing that
deals with hardware, is 'language specific'. So all the chip configuration,
I/O setup etc. etc, needs to be re-written.
The way to translate code from a second compiler, is always to treat it
as a 'flow chart', then follow through this step by step, using the instructions
for the new compiler.
Have a look at these two threads:
<https://www.ccsinfo.com/forum/viewtopic.php?t=48546>
<http://www.ccsinfo.com/forum/viewtopic.php?t=58376>
The first poster said he had it partially working, so may be able to help. |
Hello Ttelmah
Are you a CCS employee ?
You answer almost all subjects, with great patience and precision. It is very pleasant.
That said, I am not a software guy ( breaking news ).
But I still know that there are hardware differences between different MCU targets.
I took the example from MikroE because I was hoping the code porting work had already been done as It is a ANSI C compiler and there was an example for dsPIC33 target.
Then I just replaced the built-in MikroE routines with CCS ones to access GPIO and SPI module but the compiler return me errors that I cannot understand with my low level programming skills.
As the code compiles well on Mikroe's compiler, Im almost sure it's not a problem of mismatched #if #endif as returned to me by the CCS compiler but with my level, I'm stuck, I can't go any further |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Thu Jul 08, 2021 6:36 am |
|
|
ANSI C is not 'universal' so you have to modify code to work with whatever compiler and microcontroller you're using.
I had a quick look at the code and there are a LOT of lines you'll have to change into CCS C style code for your PIC.
As for the errors, post some of them,though I suspect they refer to the differences in the Mikro C vs CCS C. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Fri Jul 09, 2021 1:14 am |
|
|
OK.
Nothing to do with CCS, just a PICAHOLIC'....
Your problem with endif is being caused because they declare a variable called
'IF' (for interface), in wizchip_type. Now CCS reserves IF as a reserved word,
so you cannot have a variable called this. Result it is seeing an extra
'IF'....
The next problem you will have is with the callback function parameters.
CCS is strict on these keeping to the original K&R declarations. This compiler
allows the shortcut nomenclature. Dealing with this has been covered here. |
|
|
|