1 |
31 |
csantifort |
/*----------------------------------------------------------------
|
2 |
|
|
// //
|
3 |
|
|
// start.S //
|
4 |
|
|
// //
|
5 |
|
|
// This file is part of the Amber project //
|
6 |
|
|
// http://www.opencores.org/project,amber //
|
7 |
|
|
// //
|
8 |
|
|
// Description //
|
9 |
|
|
// Assembly routines for hello-world. //
|
10 |
|
|
// As hello-world is a stand-alone application, it needs a //
|
11 |
|
|
// simple start function written in assembly to call the //
|
12 |
|
|
// C code main() function. //
|
13 |
|
|
// //
|
14 |
|
|
// Author(s): //
|
15 |
|
|
// - Conor Santifort, csantifort.amber@gmail.com //
|
16 |
|
|
// //
|
17 |
|
|
//////////////////////////////////////////////////////////////////
|
18 |
|
|
// //
|
19 |
|
|
// Copyright (C) 2010 Authors and OPENCORES.ORG //
|
20 |
|
|
// //
|
21 |
|
|
// This source file may be used and distributed without //
|
22 |
|
|
// restriction provided that this copyright statement is not //
|
23 |
|
|
// removed from the file and that any derivative work contains //
|
24 |
|
|
// the original copyright notice and the associated disclaimer. //
|
25 |
|
|
// //
|
26 |
|
|
// This source file is free software; you can redistribute it //
|
27 |
|
|
// and/or modify it under the terms of the GNU Lesser General //
|
28 |
|
|
// Public License as published by the Free Software Foundation; //
|
29 |
|
|
// either version 2.1 of the License, or (at your option) any //
|
30 |
|
|
// later version. //
|
31 |
|
|
// //
|
32 |
|
|
// This source is distributed in the hope that it will be //
|
33 |
|
|
// useful, but WITHOUT ANY WARRANTY; without even the implied //
|
34 |
|
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
|
35 |
|
|
// PURPOSE. See the GNU Lesser General Public License for more //
|
36 |
|
|
// details. //
|
37 |
|
|
// //
|
38 |
|
|
// You should have received a copy of the GNU Lesser General //
|
39 |
|
|
// Public License along with this source; if not, download it //
|
40 |
|
|
// from http://www.opencores.org/lgpl.shtml //
|
41 |
|
|
// //
|
42 |
|
|
----------------------------------------------------------------*/
|
43 |
|
|
|
44 |
|
|
.section .text
|
45 |
|
|
.globl start
|
46 |
|
|
_start:
|
47 |
|
|
/* Switch to User Mode */
|
48 |
|
|
/* and unset interrupt mask bits */
|
49 |
|
|
mov r0, #0x00000000
|
50 |
|
|
teqp pc, r0
|
51 |
|
|
|
52 |
|
|
@ Enable the cache
|
53 |
|
|
mov r0, #0xffffffff
|
54 |
|
|
mcr 15, 0, r0, cr3, cr0, 0 @ cacheable area
|
55 |
|
|
mov r0, #1
|
56 |
|
|
mcr 15, 0, r0, cr2, cr0, 0 @ cache enable
|
57 |
|
|
|
58 |
|
|
@ initialize the stack pointer
|
59 |
|
|
ldr sp, AdrStack
|
60 |
|
|
|
61 |
|
|
@ jump to main
|
62 |
|
|
.extern main
|
63 |
|
|
bl main
|
64 |
|
|
|
65 |
|
|
b _testpass
|
66 |
|
|
|
67 |
|
|
/* stack at top of ddr3 memory space */
|
68 |
|
|
AdrStack: .word 0x8000000
|
69 |
|
|
AdrMalloc: .word 0x7000000
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
/* ========================================================================= */
|
73 |
|
|
/* ========================================================================= */
|
74 |
|
|
|
75 |
|
|
|