CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Help porting Ethernet W5500 chip code to CCS

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
WalkOver



Joined: 14 May 2021
Posts: 24

View user's profile Send private message

Help porting Ethernet W5500 chip code to CCS
PostPosted: Tue Jul 06, 2021 10:35 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Jul 07, 2021 12:58 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jul 08, 2021 3:17 am     Reply with quote

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 Smile

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 Evil or Very Mad
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jul 08, 2021 6:36 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jul 09, 2021 1:14 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group