OpenCores
URL https://opencores.org/ocsvn/aemb/aemb/trunk

Subversion Repositories aemb

[/] [aemb/] [trunk/] [sw/] [cc/] [bootstrap.c] - Blame information for rev 184

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 184 sybreon
/* $Id: bootstrap.c,v 1.4 2008-06-30 10:14:59 sybreon Exp $
2 177 sybreon
**
3
** BOOTSTRAP
4
** Copyright (C) 2008 Shawn Tan <shawn.tan@aeste.net>
5
**
6
** This file is part of AEMB.
7
**
8
** AEMB is free software: you can redistribute it and/or modify it
9
** under the terms of the GNU General Public License as published by
10
** the Free Software Foundation, either version 3 of the License, or
11
** (at your option) any later version.
12
**
13
** AEMB is distributed in the hope that it will be useful, but WITHOUT
14
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15
** or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16
** License for more details.
17
**
18
** You should have received a copy of the GNU General Public License
19
** along with AEMB.  If not, see <http://www.gnu.org/licenses/>.
20
*/
21 184 sybreon
/*
22
#define SRAM_BASE 0x00008000
23
The base address of the RAM block
24 177 sybreon
 
25 184 sybreon
#define SRAM_SIZE 0x8000
26
The size of the RAM block
27 183 sybreon
 
28 184 sybreon
#define BOOT_BASE 0x00004000
29
The base address of the boot loader
30
*/
31 183 sybreon
 
32 177 sybreon
#include "memtest.hh"
33
 
34 181 sybreon
/**
35
   MEMORY TEST
36
 */
37
 
38
static inline int memtest (int base, int len)
39 177 sybreon
{
40 181 sybreon
  return (
41
#ifdef TEST_LONG
42
          (memTestDataBus(base) != 0) ||
43
          (memTestAddrBus(base, len) != 0) ||
44
          (memTestFullDev(base, len) != 0) // takes long time
45
#else
46
          (memTestDataBus(base) != 0) ||
47
          (memTestAddrBus(base, len) != 0)
48
#endif
49
           ) ? 0 : -1;
50 177 sybreon
}
51
 
52 183 sybreon
/**
53
   START BOOT LOADER
54
 */
55
 
56 181 sybreon
static inline void runboot(int base)
57
{
58 184 sybreon
  asm volatile ("brai %0"::"i"(base));
59
  //void *fsboot = (void *) base;
60
  //fsboot = (void *) base;
61
  //goto *fsboot;  
62 181 sybreon
}
63
 
64 184 sybreon
/**
65
   STRING IT ALL TOGETHER
66
 */
67
 
68 181 sybreon
int main ()
69
{
70
  if (memtest(SRAM_BASE, SRAM_SIZE) == 0)
71
    runboot(BOOT_BASE);
72
  else
73 184 sybreon
    while (1); // asm volatile ("");  
74 181 sybreon
}
75
 
76 177 sybreon
/*
77
  $Log: not supported by cvs2svn $
78 184 sybreon
  Revision 1.3  2008/06/24 10:34:40  sybreon
79
  updated
80
 
81 183 sybreon
  Revision 1.2  2008/06/24 00:45:36  sybreon
82
  basic version
83
 
84 181 sybreon
  Revision 1.1  2008/06/23 22:18:04  sybreon
85
  initial import
86
 
87 177 sybreon
 */

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.