[En-Nut-Discussion] The biggest problem when portting
Mike Cornelius
mikec at calldirect.com.au
Tue Jul 22 03:26:46 CEST 2003
Hi Harald and Tyou,
The H8 is an odd machine it can be either an 8 16 or 32 bit machine
depending on how you care to use it, for example:-
mov is an 8 bit move
mov.w is a 16 bit move
and
mov.l is a 32 bit move
Registers can also be 8 16 or 32 bits depending upon how you care to use
them.
For GNU C on the H8 integers are either 16 or 32 bit, there is a compiler
switch -mint32 which makes integers 32 bits.
Because NutOS casts integers (regardless of size) to pointers the easiest
solution was to use the -mint32 switch and then change all the u_shorts
which are cast to pointers in NutOS to u_ints (As Harald suggests).
This approach is IMHO the most portable solution, it will certainly work on
the AVR, H8, ARM and X86 architectures.
One thing for other porters to note is that IPHDR and TCPHDR both make use
of elements that are less than 1 byte (ip_hl, ip_v, and th_off)
interestingly because the H8 is big endian GCC treats these constructs
differently ad gets them is the wrong order.
In response to Tyou's earlier email re the standard libraries I just use the
standard Nut/OS makefiles slightly modified to suit the H8 architecture and
have had no trouble whatsoever.
I had no trouble porting the NutOS crt routines, to be honest I can't
remember making any changes at all (I didn't document any) I think I just
re-compiled for the H8.
As I mentioned I have a working port to the H8 right now, I'lld be happy to
release what I've got but I don't feel it is appropriate to post it to the
list instead I will post it directly to Tyou and anyone else who asks for
it.
Things to note if you want it right now:-
- I believe the low level mods to NutOS are stable, I've had my application
running now for about 1 week with no trouble (includes PPP, GPRS TCP/IP)
- The new UartH8 driver is a work in progress, right now it doesn't support
changing the baud rate through IOCTL (but it probably will within the next
24 hours) and a few other things but it does work.
- I've deliberatly not ported the old print and device routines Harald has
marked in the documentation as deprecated.
- You'll need to change the NutOS_H8.lnk file.
- NutInit will need to be modified for your hardware in particular
system_copy_int_vectors() will likely not be necessary.
- Compilation was done under window using the latest KPIT_Cummins tool
chain.
I hope this helps.
Regards,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mike Cornelius Internet: mikec at calldirect.com.au
Call Direct Cellular Solutions Phone: +61 2 99-65-75-85
Level 1 8-22 West St North Sydney FAX: +61 2 99-65-75-90
NSW 2060 Australia URL: http://www.calldirect.com.au
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----Original Message-----
From: en-nut-discussion-admin at egnite.de
[mailto:en-nut-discussion-admin at egnite.de]On Behalf Of Harald Kipp
Sent: Monday, July 21, 2003 6:57 PM
To: en-nut-discussion at egnite.de
Subject: RE: [En-Nut-Discussion] The biggest problem when portting
>
>I run them all on a 32 bit pc with no trouble. I modified the heap
routines
>to use a u_int for the size so that on bigger architectures it can use more
>than 65kb and changed offending u_short casts for pointers to u_char*
casts.
But as far as I understood, this doesn't work for the H8. It's
a 16-bit machine, so integers are 16 bit, but the address pointer
is 32-bit. It would mean that size_t is u_long, not u_int.
Harald
_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo/en-nut-discussion
More information about the En-Nut-Discussion
mailing list