2 e07 bootloader suite - ROM base application header
3 Copyright (c) 2009 Christopher Hall <hsw@openmoko.com>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #if !defined(_APPLICATION_H_)
20 #define _APPLICATION_H_
24 #include "wikireader.h"
28 #if !defined(APPLICATION_TITLE)
29 #error "APPLICATION_TITLE must be defined before including application.h"
32 // setup and configure run time environment
33 // the very first line of main() after the '}'
34 #define APPLICATION_INITIALISE() \
36 asm volatile ("\txld.w\t%r15, __dp\n" \
37 "\txld.w\t%r10, __SIZE_bss\n" \
38 "\tor\t%r10, %r10\n" \
39 "\tjreq\tclear_bss_done\n" \
40 "\txld.w\t%r9, __START_bss\n" \
43 "\tld.w\t[%r9]+, %r8\n" \
45 "\tjrgt\tclear_bss_loop\n" \
54 // the last line of main() before the final '}'
55 // at present just returns the next_program number to
56 #define APPLICATION_FINALISE(next_program, status) \
58 ReturnType rc = {next_program, status}; \
63 __attribute__ ((packed
))
69 typedef ReturnType
application(int block
, int status
);