Update: The Interniche license agreement was breached. No example code is available here.
The source code below contains makefile and everything needed to build a “network echo example” with a GNU toolchain for the MCF52235 microcontroller. The toolchain is available for free from CodeSourcery.
Simply connect to IP address 10.10.12.247 with TCP on port 4988 (or change IP, gateway and mask in ether.c) after building code and flashing the MCU:
user@pc:~$ telnet 10.10.12.247 4988
Trying 10.10.12.247...
Connected to 10.10.12.247.
Escape character is '^]'.
ping
ECHO: ping
^]
telnet> quit
Connection closed.
user@pc:~$ nc 10.10.12.247 4988
test
ECHO: test
user@pc:~$
Some debug information should be available on UART 0 at 115200 baud, 8N1:
Router version 0.0.2 (2007-06-27 09:10)
CPU and UART is up. Initialising.
ePHY enabled - Waiting..........
Start sw-semi-auto-negotiate
Try 100HD.
Link UP - 100HD
Heap size: 16384 bytes
MAC address: 00:CF:52:23:00:00
Starting interrupts
prep_evb: Preparing device for networking
IP address: 10.10.12.247
Start listening on TCP port 4988...
Enter main loop
The code is a mix of examples from Interniche Lite, CodeWarrior, CodeSourcery and the Freescale ColdFire forum. It does NOT use the niche-task-system (it’s a superloop thing with interrupts), to be able to use RAM and flash for other stuff. It was a major hassle to remove the task code and make it work from flash memory on the M52235EVB. This is where the initial versions of the files in the archive came from:
- /cpu : codesourcery and codewarrior
- /net : interniche
- /std : interniche
- /doc : relevant text based documents
ARP packets are transparent outside the Interniche files. To enable more debug information, define (by removing comment signs) NPDEBUG in /net/h/ipport.h or change the first “#if 0″ to “#if 1″ in /net/cf_specific/ifec.c. The Interniche mini-sockets TCP-api is partially documented in /doc/interniche. The file ether.c also contains the incomplete functions socket(), connect(), listen(), read() and write().
Fixes for interrupts, the TCP/IP stack, configuration of the coldfire flash module, 10/100 Mbps autonegotiation, address speculation, etc are included. In my opinion, all of them should have been made easily available from Freescale.
Free license
My changes are public domain, making all of this totally free of charge. If you use this code -please tell me here about improvements you make! Also, if anyone is able to compile a toolchain from source, I would be very interested.
If you download and use this software -you accept the terms specified in the text based license information included in the archive (specifically /net/h/license.h and the top of each applicable source code file).
Downloads
To make sure the CodeSourcery toolchain I used (version 4-1-32) is available, it can be downloaded here in [GNU/Linux], [Windows] and [Source code] versions. Extract and make the bin directory available in PATH to install it.
[Download MCF52235 example version 0.0.2], extract and cd to the directory before typing make, to compile.
Leave a comment
Here is a translation of the fields below, for those who do not understand Norwegian.
- Navn : Name (required)
- E-post : Email (required, will not be published)
- Hjemmeside : Website
- Varsle meg på e-post … : Send me an email on new comments here
Please use English in comments on this post.