1 /* procesor H8S/2638 ver 1.1 */
5 //#include <periph/chmod_lcd.h>
6 //#include <periph/sgm_lcd.h>
7 #include <system_def.h>
12 #define DEB_LED_INIT()
13 #define DEB_LED_OFF(num)
14 #define DEB_LED_ON(num)
18 #define APPLICATION_START
20 /*#define USE_FONT_6x8*/
23 #define HIT_LOAD_BAUD 0
26 /* hack for start of main, should use crt0.o instead */
27 /* Used in boot mode to start main(). */
28 __asm__ /*__volatile__*/(
29 ".global _start_hack\n\t"
31 "mov.l #0xffdffe,sp\n\t"
41 void deb_wr_hex(long hex, short digs);
43 char data_test[]={'D','A','T','A',0};
46 *----------------------------------------------------------
48 void deb_wr_hex(long hex, short digs)
52 c=((hex>>(4*digs))&0xf)+'0';
53 if(c>'9') c+='A'-'9'-1;
57 static void deb_led_out(char val)
82 /* Provided by linker script */
83 extern char __boot_fn_start;
84 extern char __boot_fn_end;
87 void RelocatedProgMode(unsigned baud)
89 size_t reloc_size=&__boot_fn_end-&__boot_fn_start;
90 memcpy(&__boot_fn_start,&etext,reloc_size);
91 /*deb_wr_hex((long)ProgMode_ptr,8);*/
98 /*set power on for SCI0 and SCI1 module*/
99 *SYS_MSTPCRB&=~MSTPCRB_SCI0m;
100 *SYS_MSTPCRB&=~MSTPCRB_SCI1m;
103 SCIInit(HIT_LOAD_BAUD);
111 /* switch off SCI2 module*/
112 *SYS_MSTPCRB|=MSTPCRB_SCI2m;
119 bauddet=SCIAutoBaud();
120 deb_wr_hex(bauddet,4);
124 if((__u8*)&__boot_fn_start<(__u8*)0xffb000) {
125 /* If we are not in the internal RAM, copy and run us from
127 RelocatedProgMode(HIT_LOAD_BAUD);
130 ProgMode(HIT_LOAD_BAUD);
133 #endif /* BOOT_TEST */
135 inline int call_address(unsigned long addr)
137 typedef int (*my_call_t)(void);
138 my_call_t my_call=(my_call_t)addr;
143 *-----------------------------------------------------------
147 /* Only for debuging */
148 void deb_led_blink() {
161 _setup_board(); /* Provided in bspbase library of each board */
163 p=(__u8*)&deb_wr_hex;
164 if(p>=IRAM_START) p=" IRAM";
166 else if(p>=SRAM_START) p=" SRAM";
169 else if(p>=XRAM_START) p=" XRAM";
171 else if(p>(__u8*)0x4000l) p=" FLSHU";
175 #if 0 /* FLASH timing test */
188 #ifdef APPLICATION_START
189 if(((*FLM_FLMCR1) & FLMCR1_FWEm)==0) {
190 if (*((unsigned long *)0x4000)!=0xffffffff){
191 call_address(0x4000);
194 #endif /* APPLICATION_START */
202 #endif /* BOOT_TEST */