annotate src/cs/system/main/mem_load.c @ 575:0198ac1e1a4f

cfile_symlink for GPF: a more robust approach
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 24 Jan 2019 23:43:00 +0000
parents 838eeafb0051
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
280
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /************* Revision Controle System Header *************
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * GSM Layer 1 software
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * MEM_LOAD.C
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 *
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * Filename mem_load.c
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * Version 1.6
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 * Date 06/20/01
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 *
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 ************* Revision Controle System Header *************/
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #ifndef _WINDOWS
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include "chipset.cfg"
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include "board.cfg"
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #include "swconfig.cfg"
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 #include "l1sw.cfg" /* OP_L1_STANDALONE definition */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 #if ((((CHIPSET == 3) || (CHIPSET == 4) || (CHIPSET == 5) || (CHIPSET == 6) || (CHIPSET == 7) || \
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 (CHIPSET == 8) || (CHIPSET == 9) || (CHIPSET == 10) || (CHIPSET == 11)) && (LONG_JUMP != 0)) || \
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 (CHIPSET == 12) ||(CHIPSET == 15))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 * USE_GZIP flag is used by modem binaries compression feature on P2.
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 * For P2 build variants it is defined globally - either in master.cfg (HBB)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 * or P2's configdef *.xml files (UBB).
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 * The following definition is for all other platforms - just to
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 * suppress compilation warnings.
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 #ifndef USE_GZIP
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #define USE_GZIP 0
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 #if (OP_L1_STANDALONE == 1)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 #define D_LOAD_START _470_INT_MEM_out_call_load_start
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 #define D_RUN_START _470_INT_MEM_out_call_run_start
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 #define D_RUN_END _470_INT_MEM_out_call_run_end
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 #else
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 #define D_LOAD_START _470_S_MEM_out_call_load_start
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 #define D_RUN_START _470_S_MEM_out_call_run_start
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 #define D_RUN_END _470_S_MEM_out_call_run_end
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 typedef unsigned char UWORD8;
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 typedef unsigned short int UWORD16;
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 typedef unsigned long int UWORD32;
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 UWORD16 d_checksum1;
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 UWORD16 d_checksum2;
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 * INT_memset and INT_memcpy, respectively identical to memset and
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 * memcpy from the rts library of compiler V2.51, are defined in int.s.
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 * They are used to make the initialization of the .bss section and the load
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 * of the internal ram code not dependent to the 32-bit alignment.
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 * The old code used for the initialization and the load used a loop with
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 * 4-byte increment, assuming the 32-bit alignment of the .bss section.
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 * This alignment is not true with compiler V2.51.
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 * This change applies whatever the compiler version.
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 * INT_memset replaces f_zero
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 * INT_memcpy replaces f_download
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 extern void INT_memset(void *s, int c, UWORD32 n);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 extern void INT_memcpy(void *s1, void *s2, UWORD32 n);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 #if (OP_L1_STANDALONE == 0) && (BOARD == 35) && (USE_GZIP == 1)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 extern void decompress(unsigned long input_start,
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 unsigned long input_length,
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 unsigned long output_start);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 #else
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 UWORD16 f_checksum(UWORD8 *p_begin,
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 UWORD32 d_length) {
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 UWORD16 d_checksum = 0x0000;
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 while(d_length > 0) {
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 d_checksum += *(p_begin++);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 d_length --;
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 }
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 return(d_checksum);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 }
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 #if (CHIPSET == 12) || (CHIPSET == 15)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 * Load start address of the interrupt vector table from FLASH into Internal SRAM
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 #define C_NUMBER_OF_INTERRUPT_VECTOR 7
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 #pragma DATA_SECTION(d_interrupt_load_start,".intload")
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 const UWORD32 d_interrupt_load_start=0L;
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 extern const UWORD32 IndirectVectorTable[C_NUMBER_OF_INTERRUPT_VECTOR * 2];
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 #define C_INTERRUPT_VECTOR_LOAD_START (UWORD32)((UWORD32)(&d_interrupt_load_start) + 4)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 #define C_INTERRUPT_VECTOR_RUN_START (UWORD32)((UWORD32)&IndirectVectorTable[0])
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 #define C_INTERRUPT_VECTOR_LENGTH (UWORD32)(C_NUMBER_OF_INTERRUPT_VECTOR * 2 * sizeof(UWORD32))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 #endif /* (CHIPSET == 12) || (CHIPSET == 15)*/
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 #if ((LONG_JUMP == 3) || (((CHIPSET==15)||(CHIPSET == 12)) && (LONG_JUMP == 0)))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 * Load start address of the code downloaded from FLASH into Internal SRAM
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 #pragma DATA_SECTION(d_application_load_start,".ldfl")
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 const UWORD32 d_application_load_start=0L;
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 #if ((OP_WCP == 0) || (OP_L1_STANDALONE == 1))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 #if (TOOL_CHOICE == 0)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 * If use of VISUAL LINKER, needs to manage trampoline download.
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 * Case of:
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 * - TOOL_CHOICE == 0 => compiler v1.22e with vlinker v1.9902
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 #if !(((CHIPSET == 12) || (CHIPSET==15)) && (LONG_JUMP == 0))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 extern UWORD8 D_LOAD_START;
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 #endif /* (((CHIPSET == 12)||(CHIPSET==15)) && (LONG_JUMP == 0)) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 #endif /* (TOOL_CHOICE == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 #endif /* (OP_WCP == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 * Run start address of the code downloaded from FLASH into Internal SRAM
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 #pragma DATA_SECTION(d_application_run_start,"S_P_Mem")
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 const UWORD32 d_application_run_start = 0L;
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 #if ((OP_WCP == 0) || (OP_L1_STANDALONE == 1))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 #if (TOOL_CHOICE == 0)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 * If use of VISUAL LINKER, needs to manage trampoline download.
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 * Case of:
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 * - TOOL_CHOICE == 0 => compiler v1.22e with vlinker v1.9902
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 #if !(((CHIPSET == 12)||(CHIPSET==15)) && (LONG_JUMP == 0))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 extern UWORD8 D_RUN_START;
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 #endif /* (((CHIPSET == 12)||(CHIPSET==15)) && (LONG_JUMP == 0)) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 #endif /* (TOOL_CHOICE == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 #endif /* (OP_WCP == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 * Run end address of the code downloaded from FLASH into Internal SRAM
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 #pragma DATA_SECTION(d_application_run_end,"E_P_Mem")
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 const UWORD32 d_application_run_end = 0L;
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 #if ((OP_WCP == 0) || (OP_L1_STANDALONE == 1))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 #if (TOOL_CHOICE == 0)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 * If use of VISUAL LINKER, needs to manage trampoline download.
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 * Case of:
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 * - TOOL_CHOICE == 0 => compiler v1.22e with vlinker v1.9902
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 #if !(((CHIPSET == 12)||(CHIPSET==15)) && (LONG_JUMP == 0))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 extern UWORD8 D_RUN_END;
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 #endif /* (((CHIPSET == 12)||(CHIPSET==15)) && (LONG_JUMP == 0)) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 #endif /* (TOOL_CHOICE == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 #endif /* (OP_WCP == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 * Application download
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 #define C_APPLICATION_LOAD_START (UWORD32)((UWORD32 *)(&d_application_load_start) + 2)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 #define C_APPLICATION_RUN_START (UWORD32)((UWORD32)(&d_application_run_start) + sizeof(UWORD32))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 #define C_APPLICATION_RUN_END (UWORD32)((UWORD32)(&d_application_run_end) + sizeof(UWORD32))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 #define C_APPLICATION_LENGTH (UWORD32)(C_APPLICATION_RUN_END - C_APPLICATION_RUN_START - sizeof(UWORD32))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 #if ((OP_WCP == 0) || (OP_L1_STANDALONE == 1))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 #if (TOOL_CHOICE == 0)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 * If use of VISUAL LINKER, needs to manage trampoline download.
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 * Case of:
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 * - TOOL_CHOICE == 0 => compiler v1.22e with vlinker v1.9902
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 #if !(((CHIPSET == 12)||(CHIPSET==15)) && (LONG_JUMP == 0))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 * Trampoline download
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175 #define C_TRAMPOLINE_LOAD_START (UWORD32)(&D_LOAD_START)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176 #define C_TRAMPOLINE_RUN_START (UWORD32)(&D_RUN_START)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
177 #define C_TRAMPOLINE_RUN_END (UWORD32)(&D_RUN_END)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 #define C_TRAMPOLINE_LENGTH (UWORD32)(&D_RUN_END - &D_RUN_START)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
179 #endif /* (((CHIPSET == 12)||(CHIPSET==15)) && (LONG_JUMP == 0)) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 #endif /* (TOOL_CHOICE == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 #endif /* (OP_WCP == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183 void f_load_int_mem(void) {
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 * Reset checksum of code downloaded
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 d_checksum1 = 0; /* Load checksum */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 d_checksum2 = 0; /* Run checksum */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191 * Reset the Internal memory where the code must be downloaded
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
193 INT_memset((void *)(C_APPLICATION_RUN_START),0,C_APPLICATION_LENGTH);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194 #if ((OP_WCP == 0) || (OP_L1_STANDALONE == 1))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
195 #if (TOOL_CHOICE == 0)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
196 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197 * If use of VISUAL LINKER, needs to manage trampoline download.
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198 * Case of:
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
199 * - TOOL_CHOICE == 0 => compiler v1.22e with vlinker v1.9902
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
200 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
201 #if !(((CHIPSET == 12)||(CHIPSET==15)) && (LONG_JUMP == 0))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
202 INT_memset((void *)(C_TRAMPOLINE_RUN_START),0,C_TRAMPOLINE_LENGTH);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
203 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
204 #endif /* (TOOL_CHOICE == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
205
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 #if ((CHIPSET == 12)||(CHIPSET==15))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207 INT_memset((void *)(C_INTERRUPT_VECTOR_RUN_START),0,C_INTERRUPT_VECTOR_LENGTH);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209 #endif /* (OP_WCP == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211 #if (OP_L1_STANDALONE == 0) && (BOARD == 35) && (USE_GZIP == 1)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212 #define C_GZIP_START (C_APPLICATION_LOAD_START)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213 #define C_GZIP_LENGTH (*(UWORD32*)C_APPLICATION_LOAD_START)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214 #define C_GZIP_OUT (C_APPLICATION_RUN_START - sizeof(UWORD32))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 /* De-compress on-the-fly and load to internal RAM */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217 decompress(C_GZIP_START, /* load start (compressed) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 C_GZIP_LENGTH, /* compressed length */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
219 C_GZIP_OUT); /* run start */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
220 #else
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
221 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
222 * Compute checksum on code in FLASH (code and trampoline functions)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
224 d_checksum1 = f_checksum((UWORD8 *)(C_APPLICATION_LOAD_START), C_APPLICATION_LENGTH);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
225 #if ((OP_WCP == 0) || (OP_L1_STANDALONE == 1))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
226 #if (TOOL_CHOICE == 0)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
227 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
228 * If use of VISUAL LINKER, needs to manage trampoline download.
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
229 * Case of:
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
230 * - TOOL_CHOICE == 0 => compiler v1.22e with vlinker v1.9902
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
231 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
232 #if !(((CHIPSET == 12)||(CHIPSET==15)) && (LONG_JUMP == 0))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
233 d_checksum1 += f_checksum((UWORD8 *)(C_TRAMPOLINE_LOAD_START), C_TRAMPOLINE_LENGTH);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
234 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
235 #endif /* (TOOL_CHOICE == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
236
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
237 #if ((CHIPSET == 12)||(CHIPSET==15))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
238 d_checksum1 += f_checksum((UWORD8 *)(C_INTERRUPT_VECTOR_LOAD_START), C_INTERRUPT_VECTOR_LENGTH);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
239 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
240 #endif /* (OP_WCP == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
241
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
242
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
243 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
244 * Download code from FLASH into Internal RAM (both code and trampoline functions)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
245 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
246 INT_memcpy((void *)(C_APPLICATION_RUN_START),(void *)(C_APPLICATION_LOAD_START),C_APPLICATION_LENGTH);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
247 #if ((OP_WCP == 0) || (OP_L1_STANDALONE == 1))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
248 #if (TOOL_CHOICE == 0)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
250 * If use of VISUAL LINKER, needs to manage trampoline download.
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
251 * Case of:
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
252 * - TOOL_CHOICE == 0 => compiler v1.22e with vlinker v1.9902
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254 #if !(((CHIPSET == 12)||(CHIPSET==15)) && (LONG_JUMP == 0))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255 INT_memcpy((void *)(C_TRAMPOLINE_RUN_START),(void *)(C_TRAMPOLINE_LOAD_START),C_TRAMPOLINE_LENGTH);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257 #endif /* (TOOL_CHOICE == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259 #if ((CHIPSET == 12)||(CHIPSET==15))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260 INT_memcpy((void *)(C_INTERRUPT_VECTOR_RUN_START),(void *)(C_INTERRUPT_VECTOR_LOAD_START),C_INTERRUPT_VECTOR_LENGTH);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262 #endif /* (OP_WCP == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
263
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
266 * Compute checksum on code in FLASH (code and trampoline functions)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268 d_checksum2 = f_checksum((UWORD8 *)(C_APPLICATION_RUN_START), C_APPLICATION_LENGTH);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269 #if ((OP_WCP == 0) || (OP_L1_STANDALONE == 1))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270 #if (TOOL_CHOICE == 0)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272 * If use of VISUAL LINKER, needs to manage trampoline download.
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273 * Case of:
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274 * - TOOL_CHOICE == 0 => compiler v1.22e with vlinker v1.9902
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276 #if !(((CHIPSET == 12)||(CHIPSET==15)) && (LONG_JUMP == 0))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
277 d_checksum2 += f_checksum((UWORD8 *)(C_TRAMPOLINE_RUN_START), C_TRAMPOLINE_LENGTH);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
279 #endif /* (TOOL_CHOICE == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
280
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
281 #if ((CHIPSET == 12)||(CHIPSET==15))
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
282 d_checksum2 += f_checksum((UWORD8 *)(C_INTERRUPT_VECTOR_RUN_START), C_INTERRUPT_VECTOR_LENGTH);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
283 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
284 #endif /* (OP_WCP == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
285
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 #endif /* (OP_L1_STANDALONE == 0) && (BOARD == 35) && (USE_GZIP == 1) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
287
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288 } /* f_load_int_mem() */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
289 #endif /* ((LONG_JUMP == 3) || (((CHIPSET == 12)||(CHIPSET==15)) && (LONG_JUMP == 0))) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
290 #endif /* ((((CHIPSET == 3) || (CHIPSET == 4) || ... (CHIPSET == 12) || (CHIPSET == 15)) */