H8S/2638: Difference between revisions
No edit summary |
|||
| (18 intermediate revisions by one other user not shown) | |||
| Line 5: | Line 5: | ||
== Boards == | == Boards == | ||
* [ | * [[h8canusb]] - Board with 1 MB RAM suitable for application development -- Jiří Zemánek. | ||
* [http://rtime/~sojka/projects/mirosot/index Soccer robot control board] -- Petr Kováik | * [http://rtime.felk.cvut.cz/~sojka/projects/mirosot/index Soccer robot control board] -- Petr Kováik | ||
* [http://rtime.felk.cvut.cz/robot/index.php/H8eurobot h8eurobot board] used for motor control in our Eurobot team | |||
== Development tools == | == 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 === | |||
# Download [ftp://rtime.felk.cvut.cz/arch-tools/gcc-h8300-coff-3.4.3-bin.tar.gz gcc-h8300-coff-3.4.3-bin] | |||
# 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 <tt>arch/h8300/generic/bloader</tt> directory and can be loaded to the processor by runnin | |||
./bootstrap | |||
from <tt>bloader</tt> 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 <tt>excptvec_initfill</tt> and particular interrupts are setup by calling <tt>excptvec_set</tt>. 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 <tt>excptvec</tt>. 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 <tt>printf()</tt> and similar functions. The output of theese will go to the serial port specified by <tt>sci_rs232_chan_default</tt> variable. Its default value is selected in <tt>system_def.h</tt> and can be different for every board. | |||
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
- h8canusb - Board with 1 MB RAM suitable for application development -- Jiří Zemánek.
- Soccer robot control board -- Petr Kováik
- h8eurobot board used for motor control in our Eurobot team
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
- Download gcc-h8300-coff-3.4.3-bin
- 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