[En-Nut-Discussion] Nut/OS port for H8/300H.

Jan Dubiec jdx at slackware.pl
Tue Mar 16 08:04:28 CET 2004


Hello,

Finally I have merged my H8/300H port into the latest cvs snapshot. Exemplary
httpd aplication has been also ported. Nut/OS has been built using toolchain
for H8 micros from http://www.kpitgnutools.com (ver. 4.0.1 based on gcc 3.3).
Software (httpd and my own application) has been ran on custom board built on
H8/3068F MCU. I havent noticed any errors. Likewise I have successfuly compiled
Nut/OS and httpd for AVRs using avr-gcc 3.3.0 (built by myself). Unfortunately,
I haven't got Ethernut board so the software has not been ran on hardware. Most
of the Nut/OS files have been successfuly compiled using arm-elf-gcc as well.
Although the port has been made for H8/3068F, porting to other H8/300H and H8
devices is trivial. The patch can be downloaded from
http://free.polbox.pl/h/hs001/nut-cvs20040316-H8.diff.gz.
Please use direct link because the file is not listed on my webpage.

Below is the list of changes. The order is not important:

- support for H8 and (partially) ARM MCUs has been added and appropriate
  makefiles provided,

- arch subdirectory has been added in the Nut/OS main directory - currently it
  contains startup code, header file and generic linker scripts for H8/3068F,

- __HARVARD_ARCH__ has been added which which allows to turn off building
   of functions with _P suffix on non Harvard based micros,

- file include/sys/config.h has been renamed to nutconfig.h and all references
  to it have been changed accordingly - config.h is also part of newlib (which
  is included in H8 gcc package) so there was obvious conflict,

- directory include/cpu has been renamed to arch - just a cosmetic chnge,

- ureg_t, reg_t and uptr_t typedefs has been moved from include/compiler.h to
  include/sys/types.h; SRF* macro definitions has been moved to _IMAGECRAFT
  only section - for avr-gcc these macros are provided byc avr-libc,

- files include/sys/uart.h and include/sys/ir.h has been moved to include/dev
  and os/ir.c to dev - these are the right places for these files,

- places where pointers were casted to integers have been adjusted (many, many
  files); format strings in printf like functions have been changed as well,

- files ctx_*.c, tmr_*.c have been renamed and moved to os/arch subdirectory;
  nutinit.c has been also splitted into 4 parts,

- macro NutJumpOutCritical() has been added in atom.h; on H8 and ARM interrupts
  may have different priorities so it would be good to save current value of
  condition register (or whatever is it called) before entering critical section
  so smarter Nut{Enter,Exit}Critical() have been defined (for H8 at the moment);
  the nice side effect of such definitions is that a programmer must always close
  a critical section (a compiler will remind him about it ;-) ); not so nice
  is the fact that special function/macro must be provided in order to exit from
  critical section dur to an exception, eg.:
  [.....]
  NutEnterCritical();
  [.....]
  if (an_exception_occured)
     NutJumpOutCritical();
  [.....]
  NutExitCritical();
  [.....]

- 9366 EEPROM routines has been added for H8,

- SCI (aka USART) driver has been added for H8 (works pretty well although a
  lot of festures are not implemented yet),

- siple SCI based devices for debugging are provided (scih8dbg.c),

- RTL8019 driver for H8 is in separate file but I am going to merge changes
  I have made into original driver;  BTW. couldn't be original RTL driver files
  renamed to a more descriptive names, eg. rtl8019.*?

- interrupt code in dev directory has been splitted into architecture
  dependant files.

Of course it is sure that I have forgotten to mention a lot of changes but all
is in the sources. ;-)


Just a few suggestions at the end:

- there is a lot of files with functions marked as deprecated which just
  pollute source tree; IMO they should be removed before the next release,

- IMO bankmem.c should be moved to dev directory,

- include/sys/atomic.h should be removed - any other file doesn't include it,

- AVR interrupt functions/variables definitions should be put into one file.

Harald, I hope also that my patch will help you to make port for ARM beacause
a lot of stuff is "ARM ready" - H8/300H and H8S in advanced mode have 32 bit
internal architecture (with 16 bit data bus).

Regards,
/J.D.
-- 
Jan Dubiec, jdx at slackware.pl, mobile: +48 602 101787

Głęboka wiara wymaga płytkiego rozumu i nikłej wiedzy.



More information about the En-Nut-Discussion mailing list