alt_load.c


01: #include "sys/alt_load.h"
02: #include "sys/alt_cache.h"
03: 
04: /*
05:  * Linker defined symbols.
06:  */
07: 
08: extern void __flash_rwdata_start; 
09: extern void __ram_rwdata_start;
10: extern void __ram_rwdata_end;
11: extern void __flash_rodata_start; 
12: extern void __ram_rodata_start;
13: extern void __ram_rodata_end;
14: extern void __flash_exceptions_start; 
15: extern void __ram_exceptions_start;
16: extern void __ram_exceptions_end;
17: 
18: /*
19:  * alt_load() is called when the code is executing from flash. In this case
20:  * there is no bootloader, so this application is responsible for loading to
21:  * RAM any sections that are required.
22:  */  
23: 
24: void alt_load (void)
25: {
26:   /* 
27:    * Copy the .rwdata section. 
28:    */
29: 
30:   alt_load_section (&__flash_rwdata_start, 
31:                                 &__ram_rwdata_start,
32:                                 &__ram_rwdata_end);
33: 
34:   /*
35:    * Copy the exception handler.
36:    */
37: 
38:   alt_load_section (&__flash_exceptions_start, 
39:                                 &__ram_exceptions_start,
40:                                 &__ram_exceptions_end);
41: 
42:   /*
43:    * Copy the .rodata section.
44:    */
45: 
46:   alt_load_section (&__flash_rodata_start, 
47:                                 &__ram_rodata_start,
48:                                 &__ram_rodata_end);
49:   
50:   /*
51:    * Now ensure that the caches are in synch.
52:    */
53:   
54:   alt_dcache_flush_all();
55:   alt_icache_flush_all();
56: }


Maintained by John Loomis, updated Thu Nov 13 22:24:47 2008