|How to Compile AR1688 API with Linux|
| || |
|June 9, 2007|
|This is one of the frequently asked questions of AR1688 software API. The answer is possible, but with some extra work.
Please check the makefile in SDCC\src, there are 4 tools used:
AZ80 = $(PATH_SDCC)BIN\as-z80
CZ80 = $(PATH_SDCC)BIN\sdcc
LZ80 = $(PATH_SDCC)BIN\link-z80
HEX2BIN = $(PATH_SDCC)BIN\hex2bin
The first 3 are from SDCC itself, user can download SDCC Linux build and replace those files. We are using current steady version 2.7.0 at this time.
The last tool, hex2bin, is written by ourselves. Its source code is in SDCC\tool\hex2bin. It is a command line tool written in Windows MFC style with heavy usage of CFile and CString.
Linux user need to change the source code and compile it again.
Besides compile with Linux, user may need to debug with Linux. The only way to debug is output debug message in UDP broadcast.PalmTool from PA1688 API is used to receive and display those messages,
user need to port PalmTool to Linux too if some really serious development work is going to be done.
There are also some command line tools used for function like phone settings, user need to port SDCC\tool\convert to Linux. However, it is possibly not necessary because web pages can do those work all.
Updated on Aug 11, 2008
PalmTool is not used for debug since AR1688 0.37, use SDCC\bin\manager.exe instead.
Updated on Nov 23, 2010
Z80 compiler and linker names changed to sdasz80.exe and sdld.exe since SDCC 3.0.0.
Updated on Mar 10, 2013
After nearly 6 years, recently this work was finally done by Alex Vangelov,
who had the same thought about programming and wrote in his email starting with Just for fun.
As I am new to Linux programming, I took special interest in merging it into our AR1688 software code base, and kept a few notes:
1) Ne2000.h is renamed to ne2000.h, unix is case sensitive. Also changed are many stdafx.h related files in sdcc\tool.
Although I can not remember why Ne2000.h was the only file with mixed case letter in sdcc\include,
I know very clearly that Visual Studio generated all those StdAfx.h automatically and included them in source files as stdafx.h.
Looks like a way of Microsoft to show its difference from Unix.
2) Path notation changed from "\\" to "/" in some files for compatibility. This is obviously another way to show Microsoft's difference.
The result is, not only cross platform compilers like SDCC knows how to handle the mess, VC2008 can do it as well.
During my debug, I even found that the VC2008 can handle file path and name like C:\sdcc\src/settings/default_sip.txt correctly!
3) File mfc2std.h is added in sdcc\tool\common, to replace those heavily used MFC class like CString. Although I do not think I will write my next PC application using ansi C only for compatibility,
I will definitely remember to put all MFC related code in separate places.
4) relink tool generates linkmain_unix.lnk with linux paths, instead rewriting the existing file.
5) Tested on Fedora and Gentoo linux with sdcc version 3.2.0. Be CAREFUL here! As SDCC 3.2.0 has known hidden bugs!
So the good news is, we now have the house tools to compile AR1688 API with Linux. And the bad news is, we do not have the right SDCC to do it!
The 3.0.1 #6078 version we are using now is a different from 3.0.0, but we did not keep the source file at that time, so we can not compile a Linux version to use today.
And both 3.1.0 and 3.2.0 have hidden bugs. I had to begin to debug the current SDCC snapshot again, in the hope of a new workable version. I filed my 23rd bug report on SDCC web site last Friday.
Updated on March 11, 2013
Alex pointed out that #6078 source code was available on SourceForge svn, and modified sdcc\Makefile again to include the download and compile of SDCC #6078.
attached modified Makefile with new action "make sdcc",
that downloads sdcc revision #6078 from https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc (only z80 related files) in folder ./sdcc_6078.
executes configure && make and creates symbolic links of compiled sdcc tools in ./bin folder
* svn command required
SDCC : z80 3.0.1 #6078 (Mar 11 2013) (Linux)
to use local version of sdcc with mk command: in src/Makefile at line 17
AZ80 = ../bin/sdasz80
CZ80 = ../bin/sdcc
LZ80 = ../bin/sdld
* "make sdcc" is optional and not included in "make all"
To make sure, I downloaded #6078 tarball and put it on our own web site!
No comments for this page yet.