H8S/2638: Difference between revisions
No edit summary |
|||
| Line 38: | Line 38: | ||
Browsing of project sources is also possible via [http://rtime.felk.cvut.cz/gitweb/sysless-h8300.git GIT web interface]. | Browsing of project sources is also possible via [http://rtime.felk.cvut.cz/gitweb/sysless-h8300.git GIT web interface]. | ||
== Using the sysless framework == | |||
To compile the downloaded sources, follow the instructions at [[System less framework]] | |||
=== 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>app/bloader</tt> directory and you can load it to the processor by | |||
sh bootstrap | |||
from <tt>bloader</tt> 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 <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] | |||
Revision as of 17:17, 21 March 2008
Documentation
Boards
- CAN<->USB Converter: Board with 1 MB RAM suitable for application development -- Jiří Zemánek.
- Soccer robot control board -- Petr Kováik
Development tools
- Download gcc-h8300-coff-3.4.3-bin
- Unpack this to the root direcotry
tar -C / -xvzf gcc-h8300-coff-3.4.3-bin.tar.gz
Software
Basic development environment for h8300 microcontrollers. It contains 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 common/linkarch
Later you can update your repository using the command:
git pull
Browsing of project sources is also possible via GIT web interface.
Using the sysless framework
To compile the downloaded sources, follow the instructions at System less framework
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