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

Subversion Repositories aemb

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

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

Line No. Rev Author Line
1 183 sybreon
/* $Id: bootstrap.c,v 1.3 2008-06-24 10:34:40 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
 
22 183 sybreon
 
23
//#define SRAM_BASE 0x00008000
24
//#define SRAM_SIZE 0x8000
25
//#define BOOT_BASE 0x00004000
26
 
27 177 sybreon
#include "memtest.hh"
28
 
29 181 sybreon
/**
30
   MEMORY TEST
31
 */
32
 
33
static inline int memtest (int base, int len)
34 177 sybreon
{
35 181 sybreon
  return (
36
#ifdef TEST_LONG
37
          (memTestDataBus(base) != 0) ||
38
          (memTestAddrBus(base, len) != 0) ||
39
          (memTestFullDev(base, len) != 0) // takes long time
40
#else
41
          (memTestDataBus(base) != 0) ||
42
          (memTestAddrBus(base, len) != 0)
43
#endif
44
           ) ? 0 : -1;
45 177 sybreon
}
46
 
47 183 sybreon
/**
48
   START BOOT LOADER
49
 */
50
 
51 181 sybreon
static inline void runboot(int base)
52
{
53
  asm volatile ("brai %0"::"i"(base));
54
}
55
 
56
int main ()
57
{
58
  if (memtest(SRAM_BASE, SRAM_SIZE) == 0)
59
    runboot(BOOT_BASE);
60
  else
61
    while (1) asm volatile ("");
62
}
63
 
64 177 sybreon
/*
65
  $Log: not supported by cvs2svn $
66 183 sybreon
  Revision 1.2  2008/06/24 00:45:36  sybreon
67
  basic version
68
 
69 181 sybreon
  Revision 1.1  2008/06/23 22:18:04  sybreon
70
  initial import
71
 
72 177 sybreon
 */

powered by: WebSVN 2.1.0

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