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

Subversion Repositories s6soc

[/] [s6soc/] [trunk/] [sw/] [zipos/] [bootloader.c] - Blame information for rev 45

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    bootloader.c
4
//
5
// Project:     CMod S6 System on a Chip, ZipCPU demonstration project
6
//
7
// Purpose:     To copy into RAM, upon boot, sections from the FLASH that
8
//              need to be placed into RAM.  This also handles setting initial
9
//              values.
10
//
11
// Creator:     Dan Gisselquist, Ph.D.
12
//              Gisselquist Technology, LLC
13
//
14
////////////////////////////////////////////////////////////////////////////////
15
//
16
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
17
//
18
// This program is free software (firmware): you can redistribute it and/or
19
// modify it under the terms of  the GNU General Public License as published
20
// by the Free Software Foundation, either version 3 of the License, or (at
21
// your option) any later version.
22
//
23
// This program is distributed in the hope that it will be useful, but WITHOUT
24
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
25
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26
// for more details.
27
//
28
// You should have received a copy of the GNU General Public License along
29
// with this program.  (It's in the $(ROOT)/doc directory, run make with no
30
// target there if the PDF file isn't present.)  If not, see
31
// <http://www.gnu.org/licenses/> for a copy.
32
//
33
// License:     GPL, v3, as defined and found on www.gnu.org,
34
//              http://www.gnu.org/licenses/gpl.html
35
//
36
//
37
////////////////////////////////////////////////////////////////////////////////
38
//
39
//
40
#include "board.h"
41 45 dgisselq
#include "bootloader.h"
42 27 dgisselq
 
43
// These values will be filled in by the linker.  They are unknown at compile
44
// time.
45
 
46 45 dgisselq
void    _bootloader(void) __attribute__ ((section(".boot")));
47 27 dgisselq
 
48 45 dgisselq
void    _bootloader(void) {
49
        int     *flash = _kernel_image_start;
50
        int     *mem = _blkram;
51
 
52
        while(mem < _kernel_image_end)
53
                *mem++ = *flash++;
54
 
55 27 dgisselq
        // While I'd love to continue and clear to the end of memory, doing
56
        // so will corrupt my stack and perhaps even my return address.  Hence
57
        // we only do this much.
58 45 dgisselq
        while(mem < _bss_image_end)
59
                *mem++ = 0;
60 27 dgisselq
}
61
 

powered by: WebSVN 2.1.0

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