]> rtime.felk.cvut.cz Git - sysless.git/commitdiff
Added (NOLOAD) attribute to ".shadreg" section and some spread of changes avalanche...
authorStanislav Marek <mareks1@fel.cvut.cz>
Wed, 26 Oct 2005 19:10:00 +0000 (19:10 +0000)
committerStanislav Marek <mareks1@fel.cvut.cz>
Wed, 26 Oct 2005 19:10:00 +0000 (19:10 +0000)
darcs-hash:20051026191039-5f899-b40061bd1074ac8255ecbad8b3ab78fa99b25117.gz

18 files changed:
board/edk2638/libs/edk2638.ld-bload
board/edk2638/libs/edk2638.ld-boot
board/edk2638/libs/edk2638.ld-flash
board/edk2638/libs/edk2638.ld-ram
board/h8canusb/libs/h8canusb.ld-bload
board/h8canusb/libs/h8canusb.ld-boot
board/h8canusb/libs/h8canusb.ld-flash
board/h8canusb/libs/h8canusb.ld-flashnoram
board/h8canusb/libs/h8canusb.ld-ram
board/h8mirosot/libs/Makefile.omk
board/h8mirosot/libs/h8canusb.ld-bload
board/h8mirosot/libs/h8canusb.ld-boot
board/h8mirosot/libs/h8canusb.ld-flash
board/h8mirosot/libs/h8canusb.ld-ram
board/h8mirosot/libs/hwinit/Makefile [new file with mode: 0644]
board/h8mirosot/libs/hwinit/Makefile.omk [new file with mode: 0644]
board/h8mirosot/libs/hwinit/hwinit.c [new file with mode: 0644]
board/h8mirosot/libs/hwinit/setup_board.S [new file with mode: 0644]

index d7486131a75b76091ff5f81e99ada623db4e9cea..7d1a98bd9d28c3416fc269d1793a375b1b235939 100644 (file)
@@ -23,7 +23,7 @@ SECTIONS
          _etext = ALIGN( 0x4 ) ;
         } > bloader
 
-       .shadreg :
+       .shadreg (NOLOAD) :
        {
          *(.shadreg)
          . = ALIGN( 0x4 ) ;
index f4f72f9595e04479f70f280782a899e0c4ab8f9e..aeae1dd65334cffa53e80829468be62407f4bead 100644 (file)
@@ -17,7 +17,7 @@ SECTIONS
          *(.fvector)
        } > flashvec
        
-       .shadreg :
+       .shadreg (NOLOAD) :
        {
          *(.shadreg)
          . = ALIGN( 0x4 ) ;
index 69ddcbd19777c7a3a891e8b55c6a3311e5ee9517..0c73931009d22ca7064a5f29302e84080841d3cd 100644 (file)
@@ -33,7 +33,7 @@ SECTIONS
          _etext = ALIGN( 0x10 ) ;
        } > flashusr
 
-       .shadreg :
+       .shadreg (NOLOAD) :
        {
          *(.shadreg)
          . = ALIGN( 0x4 ) ;
index adcb48293f485ef623f72d6ae42d76b80ab28b97..561a1d37528f2d4638f75704f4f4f22776af580b 100644 (file)
@@ -36,7 +36,7 @@ SECTIONS
          _etext = ALIGN( 0x4 ) ;
        } > ram
 
-       .shadreg :
+       .shadreg (NOLOAD) :
        {
          *(.shadreg)
          . = ALIGN( 0x4 ) ;
index 1716da0ea6efa2609b6c65a65b7219f7402f3f6f..940dbae076e42aca732ad52db67bfced5de2c17f 100644 (file)
@@ -23,7 +23,7 @@ SECTIONS
          _etext = ALIGN( 0x4 ) ;
         } > bloader
 
-       .shadreg :
+       .shadreg (NOLOAD) :
        {
          *(.shadreg)
          . = ALIGN( 0x4 ) ;
index 26494c2007bd7b5a5ec1c85afe88393e42f704b7..8305bc485a6e3dc99a24c23cc8268bcd58040ea6 100644 (file)
@@ -17,7 +17,7 @@ SECTIONS
          *(.fvector)
        } > flashvec
        
-       .shadreg :
+       .shadreg (NOLOAD) :
        {
          *(.shadreg)
          . = ALIGN( 0x4 ) ;
index ad95ec755003e13ac3683df8ae9e537a4e2501fc..5ced3710305e20e0535f7cd139980494519d1883 100644 (file)
@@ -33,7 +33,7 @@ SECTIONS
          _etext = ALIGN( 0x10 ) ;
        } > flashusr
 
-       .shadreg :
+       .shadreg (NOLOAD) :
        {
          *(.shadreg)
          . = ALIGN( 0x4 ) ;
index 918db6c29df15f4a4bd67d567e34f42c58f00ae3..02747032c481c10aeee308c40ce19af627b4660e 100644 (file)
@@ -34,7 +34,7 @@ SECTIONS
          _etext = ALIGN( 0x10 ) ;
        } > flashusr
 
-       .shadreg :
+       .shadreg (NOLOAD) :
        {
          *(.shadreg)
          . = ALIGN( 0x4 ) ;
index 2db66e229feb76d4511e42a986e058aacab3c7aa..c0a9d7cfcb8db9d8b2211fc4962a33c79a144e2a 100644 (file)
@@ -36,7 +36,7 @@ SECTIONS
          _etext = ALIGN( 0x4 ) ;
        } > ram
 
-       .shadreg :
+       .shadreg (NOLOAD) :
        {
          *(.shadreg)
          . = ALIGN( 0x4 ) ;
index 0915604446abc3560b09bff4f5f395cf4583ab7a..b9ef283f0941ba169cd66d4ea60606daba3e78bc 100644 (file)
@@ -1,3 +1,6 @@
 # -*- makefile -*-
 lib_LDSCRIPTS = $(notdir $(wildcard $(SOURCES_DIR)/*.ld*))
+
+SUBDIRS = hwinit
+
 # ldscript_ADD_PREFIX_PATH = crt0\.o
index 33b783428dea3baa1d33b881e90b261c32a59b1c..940dbae076e42aca732ad52db67bfced5de2c17f 100644 (file)
@@ -23,6 +23,12 @@ SECTIONS
          _etext = ALIGN( 0x4 ) ;
         } > bloader
 
+       .shadreg (NOLOAD) :
+       {
+         *(.shadreg)
+         . = ALIGN( 0x4 ) ;
+       } > iram0
+
        .tors : 
        {
          ___ctors = . ;
index 97e3292b51865304ce7537f52e2e817c9639db73..83b569f07fd4f85fe3f0a24bad1e42631b0cdbff 100644 (file)
@@ -3,18 +3,26 @@
 INCLUDE "h8canusb.ld-cfg"
 
 PROVIDE( ___stack_top = ( __iram0_end & ~ 3 ) - 4 );
+/*PROVIDE( ___setup_board = _start);*/
 
 STARTUP(crt0.o)
+INPUT(hwinit.o setup_board.o)
 
 SECTIONS
 {
        .fvector :
        {
          ___flashbb_vector = . ;
-         LONG( ABSOLUTE( _start ) )
+         LONG( ABSOLUTE( ___setup_board ) )
          *(.fvector)
        } > flashvec
        
+       .shadreg (NOLOAD) :
+       {
+         *(.shadreg)
+         . = ALIGN( 0x4 ) ;
+       } > iram0
+
         .text :
        {
          text_start = . ;
index a71b8e52a8474e7cd33935c440b8e52723a70186..02747032c481c10aeee308c40ce19af627b4660e 100644 (file)
@@ -34,6 +34,12 @@ SECTIONS
          _etext = ALIGN( 0x10 ) ;
        } > flashusr
 
+       .shadreg (NOLOAD) :
+       {
+         *(.shadreg)
+         . = ALIGN( 0x4 ) ;
+       } > iram0
+
        .tors : 
        {
          ___ctors = . ;
index 28e65bc3e06d14b0d5ad74ff09185a9bf7b93c8c..c0a9d7cfcb8db9d8b2211fc4962a33c79a144e2a 100644 (file)
@@ -36,6 +36,12 @@ SECTIONS
          _etext = ALIGN( 0x4 ) ;
        } > ram
 
+       .shadreg (NOLOAD) :
+       {
+         *(.shadreg)
+         . = ALIGN( 0x4 ) ;
+       } > iram0
+
        .tors : 
        {
          ___ctors = . ;
diff --git a/board/h8mirosot/libs/hwinit/Makefile b/board/h8mirosot/libs/hwinit/Makefile
new file mode 100644 (file)
index 0000000..f595272
--- /dev/null
@@ -0,0 +1,14 @@
+# Generic directory or leaf node makefile for OCERA make framework
+
+ifndef MAKERULES_DIR
+MAKERULES_DIR := $(shell ( old_pwd="" ;  while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" == `pwd`  ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) )
+endif
+
+ifeq ($(MAKERULES_DIR),)
+all : default
+.DEFAULT::
+       @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n"
+else   
+include $(MAKERULES_DIR)/Makefile.rules
+endif
+
diff --git a/board/h8mirosot/libs/hwinit/Makefile.omk b/board/h8mirosot/libs/hwinit/Makefile.omk
new file mode 100644 (file)
index 0000000..8528bbf
--- /dev/null
@@ -0,0 +1,7 @@
+# -*- makefile -*-
+
+lib_LIBRARIES = hwinit
+
+hwinit_SOURCES = hwinit.c setup_board.S
+
+lib_obj_SOURCES = hwinit.c setup_board.S
diff --git a/board/h8mirosot/libs/hwinit/hwinit.c b/board/h8mirosot/libs/hwinit/hwinit.c
new file mode 100644 (file)
index 0000000..70de50d
--- /dev/null
@@ -0,0 +1,178 @@
+/* procesor H8S/2638 ver 1.1  */
+#include <types.h>
+#include <cpu_def.h>
+#include <h8s2638h.h>
+#include <system_def.h>
+#include <string.h>
+#include <boot_fn.h>
+
+#ifdef XRAM_SUPPORT_ENABLED
+#define FULL_XRAM_ADRBUS
+#endif /*XRAM_SUPPORT_ENABLED*/
+#define SMALL_ADRBUS 8
+
+#define SHADOW_SECT __attribute((section (".shadreg")))
+
+__u8 DIO_P1DDR_shadow SHADOW_SECT;
+__u8 DIO_P3DDR_shadow SHADOW_SECT;
+__u8 DIO_PFDDR_shadow SHADOW_SECT;
+__u8 DIO_PJDDR_shadow SHADOW_SECT;
+
+static void deb_led_out(char val)
+{
+  if (val&1)
+    DEB_LED_ON(0);
+  else
+    DEB_LED_OFF(0);
+  if (val&2)
+    DEB_LED_ON(1);
+  else
+    DEB_LED_OFF(1);
+  if (val&4)
+    DEB_LED_ON(2);
+  else
+    DEB_LED_OFF(2);
+  if (val&8)
+    DEB_LED_ON(3);
+  else
+    DEB_LED_OFF(3);
+}
+
+void _setup_board()
+{
+  //int i, j;// POE-100
+
+#if 1 /* registers setup */
+  /* Internal RAM enabled, advanced interrupt mode */
+  /* *SYS_SYSCR = 1*SYSCR_RAMEm | 1*SYSCR_INTM1m ; */
+
+  /* Remap 4kB of RAM from 0xffd000-0xffdfff to 0x0-0xfff */
+  /* *FLM_RAMER= 1*RAMER_RAMSm | 0&RAMER_RAMxm */
+  /* Sideefect - sets Flash software protection */
+
+  /* Enables access to flash control registers */
+  *IIC_SCRX |= SCRX_FLSHEm;
+
+  /* set shadow registers */
+  DIO_P1DDR_shadow=0;
+  DIO_P3DDR_shadow=0;
+
+  DEB_LED_INIT();
+
+  /* show something on debug leds */
+  deb_led_out(0);
+  FlWait(1*100000);
+
+  SHADOW_REG_SET(DIO_P1DDR,0x03); /* A20 and A21 are outputs */
+
+  *DIO_P3DR=0x09;      /* Inactive value of TxD0 and TxD1 has to be log 1 */
+  SHADOW_REG_SET(DIO_P3DDR,0x09); /* TxD0 and TxD1 to outputs */
+
+  /* Setup system clock oscilator */
+  /* PLL mode x4, */
+  /* *SYS_LPWRCR=2&LPWRCR_STCxm; */
+  /* PLL mode x2, */
+  /* *SYS_LPWRCR=1&LPWRCR_STCxm; */
+  {
+    const char clkrat2stc[]={0,0/*1*/,1/*2*/,1,2/*4*/,2,2,2,3/*8*/};
+    *SYS_LPWRCR=LPWRCR_STCxm&(LPWRCR_STC0m*
+                              clkrat2stc[(CPU_SYS_HZ+CPU_REF_HZ/2)/CPU_REF_HZ]);
+  }
+  deb_led_out(1);
+  FlWait(1*100000);
+
+  /* No clock disable, immediate change, busmaster high-speed */
+  *SYS_SCKCR=(0*SCKCR_PSTOPm)|(1*SCKCR_STCSm)|(0&SCKCR_SCKxm);
+  // POE-100
+#if 0
+  /* Setup chipselect outputs CS4 CS5 CS6 */
+  *DIO_P7DR |=1|2|4;
+  SHADOW_REG_SET(DIO_P7DDR,1|2|4);
+#else
+  // SHADOW_REG_SET(DIO_P7DDR,0); not on 2638
+#endif
+
+  /* Setup chipselect outputs CS3 CS2 CS1 CS0 */
+  // *DIO_PGDR |=2|4|8|0x10; no on 2638
+#if 0
+  SHADOW_REG_SET(DIO_PGDDR,2|4|8|0x10);
+#else
+  // SHADOW_REG_SET(DIO_PGDDR,2|4); no on 2638
+#endif
+
+#if 1
+  /* setup chipselect 0 - FLASH */
+  *BUS_ABWCR&=~ABWCR_ABW0m;    /* 16 bit width */
+  *BUS_ASTCR&=~ASTCR_AST0m;    /* 2 states access */
+  //*BUS_ASTCR|=ASTCR_AST0m;   /* 3 states access EDK 2638 */
+  *BUS_WCRL&=~(WCRL_W01m|WCRL_W00m);/* 0 additional wait states */
+
+  /* setup chipselect 1 - XRAM */
+  *BUS_ABWCR&=~ABWCR_ABW1m;    /* 16 bit width */
+  *BUS_ASTCR&=~ASTCR_AST1m;    /* 2 states access */
+  *BUS_WCRL&=~(WCRL_W11m|WCRL_W10m);/* 0 additional wait states */
+
+  /* setup chipselect 2 - USB */
+  *BUS_ABWCR|=ABWCR_ABW2m;     /* 8 bit width */
+  *BUS_ASTCR|=ASTCR_AST2m;     /* 3 states access */
+  *BUS_WCRL&=~(WCRL_W21m|WCRL_W20m);/* 0 additional wait states */
+  *BUS_WCRL|=1*WCRL_W21m;      /* 0/1 additional wait state */
+
+  /* setup chipselect 3 - KBD */
+  *BUS_ABWCR|=ABWCR_ABW3m;     /* 8 bit width */
+  *BUS_ASTCR|=ASTCR_AST3m;     /* 3 states access */
+  *BUS_WCRL|=(WCRL_W31m|WCRL_W30m);/* 0 additional wait states */
+#endif
+
+#if 0
+  /* setup chipselect 4 - IDE */
+  *BUS_ABWCR&=~ABWCR_ABW4m;    /* 16 bit width */
+  *BUS_ASTCR|=ASTCR_AST4m;     /* 3 states access */
+  *BUS_WCRH&=~(WCRH_W41m|WCRH_W40m);/* 0 additional wait states */
+
+  /* setup chipselect 5 - IDE */
+  *BUS_ABWCR&=~ABWCR_ABW5m;    /* 16 bit width */
+  *BUS_ASTCR|=ASTCR_AST5m;     /* 3 states access */
+  *BUS_WCRH&=~(WCRH_W51m|WCRH_W50m);/* 0 additional wait states */
+
+  /* setup chipselect 6 - KL41 */
+  *BUS_ABWCR|=ABWCR_ABW6m;     /* 8 bit width */
+  *BUS_ASTCR|=ASTCR_AST6m;     /* 3 states access */
+  *BUS_WCRH=WCRH_W61m|WCRH_W60m;       /* 3 additional wait states */
+#endif
+
+  deb_led_out(2);
+  FlWait(1*100000);
+
+#if 1
+  /*  cross cs wait| rd/wr wait    | no burst and DRAM */
+  *BUS_BCRH=0*BCRH_ICIS1m | 0*BCRH_ICIS0m;
+  /* release      | no DMAC buffer | no external wait */
+  *BUS_BCRL=0*BCRL_WDBEm; // 0*BCRL_BRLEm | 0*BCRL_WDBEm | 0*BCRL_WAITEm;  BRLE and WAITE not build in 2638
+  *DIO_PCDDR=0xff;             /* A0-A7 are outputs */
+#ifndef SMALL_ADRBUS
+  *DIO_PBDDR=0xff;             /* A8-A15 are outputs */
+#endif /*SMALL_ADRBUS*/
+#ifndef FULL_XRAM_ADRBUS
+#ifndef SMALL_ADRBUS
+  *SYS_PFCR=__val2mfld(PFCR_AExm,16-8);        /* only 16 address lines */
+#else /*SMALL_ADRBUS*/
+  *SYS_PFCR=__val2mfld(PFCR_AExm,SMALL_ADRBUS-8); /* only SMALL_ADRBUS address lines */
+#endif /*SMALL_ADRBUS*/
+#endif /* FULL_XRAM_ADRBUS */
+
+#endif /* registers setup */
+
+  FlWait(1*100000);
+
+#ifdef FULL_XRAM_ADRBUS
+  /* Setup full 22 address lines */
+  *DIO_PADR|=0x0f;
+  *DIO_PADDR=0x0f;             /* A16-A19 are outputs */
+  /* number of address output signals */
+  *SYS_PFCR=__val2mfld(PFCR_AExm,22-8);
+#endif /*FULL_XRAM_ADRBUS*/
+#endif
+
+}
+
diff --git a/board/h8mirosot/libs/hwinit/setup_board.S b/board/h8mirosot/libs/hwinit/setup_board.S
new file mode 100644 (file)
index 0000000..220a838
--- /dev/null
@@ -0,0 +1,20 @@
+
+#if defined(__H8300H__)
+       .h8300h
+#endif
+#if defined(__H8300S__)
+       .h8300s
+#endif
+
+.text
+
+.align 2
+
+.global ___setup_board
+
+___setup_board :
+       mov.l   #__iram0_end,sp
+       jsr     __setup_board
+       jmp     _start
+
+.end