UnixEmulationInstallation
Install instructions for Unix Emulation
Software versions tested:
- GCC 4.03 (Ubuntu Dapper) or GCC 4.1.2 (Ubuntu Feisty)
- Ethernut 4.2.1
- Mac OS X 10.5 (GCC 4.0)
- Ethernut 4.4.1
Extract the source code of the Ethernut OS
tar xvfj ethernut-4.2.1.tar.bz2
Enter the new folder and prepare the system for Unix emulation
cd ethernut-4.2.1 ./nutsetup
Enter 5 for Unix Emulation
Fix some troublemakers
The 4.x version of the GCC compiler seems to be more sensitive to C-Code correctness than former versions. This results in error messages while trying to compile the NutOS directly.
Found issues in the sourcecode and fixes to make it run:
- arch/unix/dev/ostimer.c
-> Ethernut 4.4 needs following line to be commented out (please explain it to me - seems useless on the one hand to declare function with attribute noreturn and on the other hand have the returntype void *)
//void *NutTimerEmulation(void *) __attribute__ ((noreturn));
missing return at the end of function NutTimerEmulation - solution:
add
return(NULL);
at the end of this function
- arch/unix/os/nutinit.c
-> Ethernut 4.4 needs following line to be commented out again
//void *NutInterruptEmulation(void *) __attribute__ ((noreturn));
another missing return at the end of function NutInterruptEmulation - solution:
again add
return(NULL);
at the end of this function
- the missing return at some functions error also appears at some
example applications. Eg. with many THREAD definitions it is necessary to add a - useless because actually never reached - return value to the end of concerning functions.
- error messages at different device drivers with unsupported direct
hardware access - quick and dirty solution:
remove the following files (line beginning with SRCS = )from the makefile in the dev/ folder and prevent the compilation of the - in this environment - useless drivers
twbbif.c npl.c nplmmc.c sbimmc.c
- some of the file system drivers cause trouble. So remove them out of the Makefile:
fs/Makefile :
#SRCS = pathops.c dirent.c fat.c uromfs.c pnutfs.c \ # phatfs.c phatvol.c phatdir.c phatio.c \ # phat12.c phat16.c phat32.c phatutil.c phatdbg.c SRCS = uromfs.c
Compile the sources and install the libraries
cd lib make make install
Adaptations at the example applications
By default hex-files for usage with mikrocontroller hardware are built. For Unix emulation this hardly makes sense so change the target definition of the application Makefile from .hex to .elf
TARG = $(PROJ).elf
If the application directory is not inside the default example directory some Makefile variables of the application have to be adapted.
The Path /opt/ethernut-4.2.1_unixEmul/ has to be changed accordingly
Eg.:
top_srcdir = /opt/ethernut-4.2.1_unixEmul/ LIBDIR = /opt/ethernut-4.2.1_unixEmul/lib/gcc/unix NUTPATH = /opt/ethernut-4.2.1_unixEmul/
Run the application
The built application can directly be executed
./application.elf
and should be debuggable this way more easily than with the embedded hardware.