1     #include <Mega32.h>
2     #include <delay.h>
3     #include <math.h>
4     #include <stdlib.h>
5     #include <stdio.h>
6     #include <string.h>
7     #include "os.h"
8
9     // This trick puts all the non spm/lpm code
10    // right at the end of main flash, but not in the bootloader.
11    // We do this so that the OS can exceed 2048 words.
12
13    #asm
14    .cseg
15    .equ bootloader=pc
16    .org 0x003500
17    #endasm
18
19    #include "initialize.c"
20    #include "os.c"
21    #include "interrupts.c"
22    #include "thread.c"
23    #include "semaphore.c"
24    #include "message.c"
25    #include "mmc.c"
26    //#include "filesystem.c"
27    #include "osthreads.c"
28
29    #asm
30    .equ mainflash=pc
31    .org bootloader
32    #endasm
33
34    // make sure SPM methods are inside bootloader
35    #include "spm.c"
36
37    void main(void)
38    {
39       os_initialize();
40       while(1) #asm("nop");
41    }