Jump to content

H8S/2638: Difference between revisions

From HW wiki
Line 34: Line 34:


== Software ==
== Software ==
Basic development environment for h8300 microcontrollers. It contains [[OMK|Makefiles]] for building your applications and code for booting the processor.
=== Getting the software ===
Actual source code can be downloaded using a [[Git]] tool:
  git clone git://rtime.felk.cvut.cz/sysless-h8300.git
If you have an acount on the ''rtime'' server, you can use ''ssh''-based access to the repository. If an administrator gave you the right for writing to the repository, you can not only read (pull) repository but also write (push) changes to the repository:
  git clone <login>@rtime.felk.cvut.cz:/var/git/sysless-h8300.git
For the proper work you need to download and configure additional common files:
  cd sysless-h8300
  git submodule init
  git submodule update
Later you can update your repository using the command:
  git pull
and if you see modification of ''common'' directory also:
  git submodule update
Browsing of project sources is also possible via [http://rtime.felk.cvut.cz/gitweb/sysless-h8300.git GIT web interface].


== Using the sysless framework ==
== Using the sysless framework ==

Revision as of 16:01, 19 January 2010

Documentation

Boards

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

binutils-h8300-elf
gcc-h8300-elf

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

Software

Using the sysless framework

To compile the downloaded sources, follow the instructions at System less framework#Compiling

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 app/bloader directory and you can load it to the processor by

sh bootstrap

from bloader direcotry.

Interrupts

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

sti();

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. */
    sti();
    ...
}

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