From HW wiki
Jump to navigation Jump to search



Development tools

Toolchain binaries for Debian

Invoke next line to add rtime cross-dev into packages sources list

echo deb ftp://rtime.felk.cvut.cz/debian unstable main >/etc/apt/sources.list.d/rtime-debs.list

Update packages cache (aptitude update) Check, that libmpfr1ldbl and libgmp3c2 packages are installed and select next packages


To install the binaries on non-Debian systems download the packages manually and run:

ar x binutils-h8300-elf_2.19.50-1_i386.deb
tar -C / -xzf data.tar.gz

Older version in tar archive

  1. Download gcc-h8300-coff-3.4.3-bin
  2. Unpack this to the root direcotry (you must be root to do this - use sudo in Ubuntu)
tar -C / -xvzf gcc-h8300-coff-3.4.3-bin.tar.gz


See the installation and usage instruction of the System less framework. Then continue with the following subsections.

Bootstrapping the processor

In order to be able to load applications to the target system, there have to be a boot loader program in processor's FLASH memory. It has to be loaded through serial channel 1 (pins TxD1, RxD1). The loader program is located at arch/h8300/generic/bloader directory and can be loaded to the processor by runnin


from bloader direcotry.

Run in GDB Simulator

echo H8S GDB init
file elf-file-to-test
set architecture h8300s
target sim


Interrupts are disabled by default. If you wand to use interrupts in your application you have to enable them explicitly by


Interrupts handling mechanisms are initialized by calling excptvec_initfill and particular interrupts are setup by calling excptvec_set. For example see the code bellow.

void  no_isr(void) __attribute__ ((interrupt_handler));
void  no_isr(void) {};

void my_isr(void)
    /* some code */

int main()
    // all the interrupts will run no_isr
    excptvec_initfill(no_isr, 0);
    // set the interrupt handler my_isr to the interrupt vector
    // number 42
    excptvec_set(42, my_isr); 

    /* Enable interrupts which are disabled by default. */

When linking your program you need to link it with library excptvec. So in your Makefile.omk you will need a line similar to

yourprogram_LIBS = excptvec

Serial Communication

You have to include

   #include <periph/sci_rs232.h>

then initialize the needed serial ports:

   /* Initialize SCI channels 0 and 1 */
   sci_rs232_setmode(19200, 0, 0, 0);
   sci_rs232_setmode(19200, 0, 0, 1);

Then you can use:

       sci_rs232_sendch('H', 0);

to send characters.

You can also use printf() and similar functions. The output of theese will go to the serial port specified by sci_rs232_chan_default variable. Its default value is selected in system_def.h and can be different for every board.

For examples see app/rs_test/*.c