annotate src/cs/system/Main/mem_load.c @ 280:081a2b303178

src/cs/system/Main/mem_load.c: import from LoCosto source
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 07 Aug 2017 05:27:26 +0000
parents
children 852b8410431d
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 #ifdef USE_CHECKSUM
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 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
74 UWORD32 d_length) {
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 UWORD16 d_checksum = 0x0000;
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 while(d_length > 0) {
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 d_checksum += *(p_begin++);
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 d_length --;
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
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 return(d_checksum);
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 #else
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 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
86 UWORD32 d_length) {
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 return 0;
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 }
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 #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
94 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 * 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
96 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 #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
98 #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
99 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
100 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
101
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 #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
103 #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
104 #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
105 #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
106
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 #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
109 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 * 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
111 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 #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
113 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
114 #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
115 #if (TOOL_CHOICE == 0)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 * 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
118 * Case of:
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 * - 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
120 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 #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
122 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
123 #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
124 #endif /* (TOOL_CHOICE == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 #endif /* (OP_WCP == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 * 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
129 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 #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
131 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
132 #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
133 #if (TOOL_CHOICE == 0)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 * 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
136 * Case of:
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 * - 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
138 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 #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
140 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
141 #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
142 #endif /* (TOOL_CHOICE == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 #endif /* (OP_WCP == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 * 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
147 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 #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
149 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
150 #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
151 #if (TOOL_CHOICE == 0)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 * 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
154 * Case of:
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 * - 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
156 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 #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
158 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
159 #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
160 #endif /* (TOOL_CHOICE == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 #endif /* (OP_WCP == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162
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 * Application download
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 #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
167 #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
168 #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
169 #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
170
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 #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
172 #if (TOOL_CHOICE == 0)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 * 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
175 * Case of:
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176 * - 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
177 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 #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
179 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 * Trampoline download
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182 #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
183 #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
184 #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
185 #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
186 #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
187 #endif /* (TOOL_CHOICE == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 #endif /* (OP_WCP == 0) */
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 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
191 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192 * 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
193 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194 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
195 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
196
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198 * 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
199 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
200 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
201 #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
202 #if (TOOL_CHOICE == 0)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
203 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
204 * 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
205 * Case of:
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 * - 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
207 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208 #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
209 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
210 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211 #endif /* (TOOL_CHOICE == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213 #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
214 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
215 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 #endif /* (OP_WCP == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 #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
219 #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
220 #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
221 #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
222
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223 /* 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
224 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
225 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
226 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
227 #else
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
228 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
229 * 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
230 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
231 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
232 #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
233 #if (TOOL_CHOICE == 0)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
234 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
235 * 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
236 * Case of:
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
237 * - 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
238 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
239 #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
240 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
241 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
242 #endif /* (TOOL_CHOICE == 0) */
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 #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
245 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
246 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
247 #endif /* (OP_WCP == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
248
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
250 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
251 * 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
252 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253 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
254 #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
255 #if (TOOL_CHOICE == 0)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257 * 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
258 * Case of:
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259 * - 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
260 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261 #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
262 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
263 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264 #endif /* (TOOL_CHOICE == 0) */
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 #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
267 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
268 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269 #endif /* (OP_WCP == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272 /*
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273 * 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
274 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 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
276 #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
277 #if (TOOL_CHOICE == 0)
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278 /* NEW COMPILER MANAGEMENT
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
279 * 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
280 * Case of:
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
281 * - 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
282 */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
283 #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
284 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
285 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 #endif /* (TOOL_CHOICE == 0) */
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 #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
289 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
290 #endif
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
291 #endif /* (OP_WCP == 0) */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
292
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
293 #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
294
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
295 } /* f_load_int_mem() */
081a2b303178 src/cs/system/Main/mem_load.c: import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
296 #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
297 #endif /* ((((CHIPSET == 3) || (CHIPSET == 4) || ... (CHIPSET == 12) || (CHIPSET == 15)) */