Jump to content

H8S/2638: Difference between revisions

From HW wiki
Pisa (talk | contribs)
No edit summary
 
(8 intermediate revisions by one other user not shown)
Line 11: Line 11:
== Development tools ==
== Development tools ==


# Download [ftp://rtime.felk.cvut.cz/arch-tools/gcc-h8300-coff-3.4.3-bin.tar.gz gcc-h8300-coff-3.4.3-bin]
=== Toolchain binaries for Debian ===
# 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
Invoke next line to add rtime cross-dev into packages sources list


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


Basic development environment for h8300 microcontrollers. It contains [http://rtime.felk.cvut.cz/omk/ makefiles] for building your applications and code for booting the processor.
Update packages cache (aptitude update)
Check, that libmpfr1ldbl and libgmp3c2 packages are installed and select next packages


=== Getting the software ===
binutils-h8300-elf
gcc-h8300-elf


Actual source code can be downloaded using a [[Git]] tool:
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


  git clone git://rtime.felk.cvut.cz/sysless-h8300.git
=== Older version in tar archive ===


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:
# Download [ftp://rtime.felk.cvut.cz/arch-tools/gcc-h8300-coff-3.4.3-bin.tar.gz gcc-h8300-coff-3.4.3-bin]
  git clone <login>@rtime.felk.cvut.cz:/var/git/sysless-h8300.git
# 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


For the proper work you need to download and configure additional common files:
== Software ==
  cd sysless-h8300
  git submodule init
  git submodule update


Later you can update your repository using the command:
See the installation and usage instruction of the [[System less framework]]. Then continue with the following subsections.
  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].
=== Bootstrapping the processor ===


== Using the sysless framework ==
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 <tt>arch/h8300/generic/bloader</tt> directory and can be loaded to the processor by runnin
./bootstrap
from <tt>bloader</tt> direcotry.


To compile the downloaded sources, follow the instructions at [[System less framework#Compiling]]
=== Run in GDB Simulator  ===


=== Bootstrapping the processor ===
echo H8S GDB init
file elf-file-to-test
set architecture h8300s
target sim
load


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 <tt>app/bloader</tt> directory and you can load it to the processor by
sh bootstrap
from <tt>bloader</tt> direcotry.


=== Interrupts ===
=== Interrupts ===
Line 97: Line 99:


For examples see [http://rtime.felk.cvut.cz/darcs/darcsweb.cgi?r=h8300-boot;a=tree;f=/app/rs_test app/rs_test/*.c]
For examples see [http://rtime.felk.cvut.cz/darcs/darcsweb.cgi?r=h8300-boot;a=tree;f=/app/rs_test app/rs_test/*.c]
[[Category:Hardware]]

Latest revision as of 20:50, 2 May 2011

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

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

./bootstrap

from bloader direcotry.

Run in GDB Simulator

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


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