• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

BASIC compiler/interpreter for PIC32MX/MZ-80K


Commit MetaInfo

Revisão8918ad345ba53737ba90955a2cde90be0f42e6d5 (tree)
Hora2019-05-08 10:36:06
AutorKatsumi <kmorimatsu@sour...>
CommiterKatsumi

Mensagem de Log

Begin CLIB implementation.

Mudança Sumário

Diff

--- /dev/null
+++ b/mips/clib/clib.c
@@ -0,0 +1,25 @@
1+/***********************************
2+ * *
3+ * Template of CLIB for MachiKania *
4+ * *
5+ ***********************************/
6+
7+#include "./clib.h"
8+
9+// main() function is not used, but necessary for compiling
10+void main(void){
11+ while(1);
12+}
13+
14+// Data list to provide addresses of constants[] and functions[]
15+CLIBDATA unsigned int clibdata[]={
16+ (unsigned int)&constants[0],
17+ (unsigned int)&functions[0]
18+};
19+
20+// Infinite loop at the beginning of program
21+/*const __attribute__((address(0x9d007000))) unsigned int const _loop[]={
22+ // loop:
23+ 0x1000FFFF, // b loop
24+ 0x00000000 // nop
25+};//*/
--- /dev/null
+++ b/mips/clib/clib.h
@@ -0,0 +1,16 @@
1+/***********************************
2+ * *
3+ * Template of CLIB for MachiKania *
4+ * *
5+ ***********************************/
6+
7+// All CLIB functions must be written in .machikania_club section.
8+#define CLIB __attribute__((section(".machikania_clib")))
9+
10+// CLIB data is placed at specific address
11+#define CLIBDATA const __attribute__((address(0x9d01ff00)))
12+
13+// Global variables
14+// These must be defined by user
15+extern const void* const constants[];
16+extern const void* const functions[];
--- /dev/null
+++ b/mips/clib/clib.mcp
@@ -0,0 +1,62 @@
1+[HEADER]
2+magic_cookie={66E99B07-E706-4689-9E80-9B2582898A13}
3+file_version=1.0
4+device=PIC32MX350F256H
5+[PATH_INFO]
6+BuildDirPolicy=BuildDirIsProjectDir
7+dir_src=
8+dir_bin=
9+dir_tmp=
10+dir_sin=
11+dir_inc=
12+dir_lib=C:\Program Files\Microchip\xc32\v1.42\pic32mx\lib
13+dir_lkr=
14+[CAT_FILTERS]
15+filter_src=*.s;*.c
16+filter_inc=*.h;*.inc
17+filter_obj=*.o
18+filter_lib=*.a
19+filter_lkr=*.ld
20+[CAT_SUBFOLDERS]
21+subfolder_src=
22+subfolder_inc=
23+subfolder_obj=
24+subfolder_lib=
25+subfolder_lkr=
26+[FILE_SUBFOLDERS]
27+file_000=.
28+file_001=.
29+file_002=.
30+file_003=.
31+[GENERATED_FILES]
32+file_000=no
33+file_001=no
34+file_002=no
35+file_003=no
36+[OTHER_FILES]
37+file_000=no
38+file_001=no
39+file_002=no
40+file_003=no
41+[FILE_INFO]
42+file_000=clib.c
43+file_001=example.c
44+file_002=clib.h
45+file_003=clib_p32MX370F512H.ld
46+[SUITE_INFO]
47+suite_guid={62D235D8-2DB2-49CD-AF24-5489A6015337}
48+suite_state=
49+[TOOL_SETTINGS]
50+TS{6F324298-6323-4781-8C43-43FA5E6F3646}=-gdwarf-2
51+TS{1F324EFA-C0BA-4A8F-A85A-B21644939CAD}=-g -O1
52+TS{29D3B6CC-DCAB-4659-8011-FFF75BB7F8D7}=-Map="$(BINDIR_)$(TARGETBASE).map" -o"$(BINDIR_)$(TARGETBASE).$(TARGETSUFFIX)" -O1 -nostdlib -mno-float
53+TS{AD4C3FBD-B6BB-4F50-AB4E-35BF132D4D60}=
54+[INSTRUMENTED_TRACE]
55+enable=0
56+transport=0
57+format=0
58+[CUSTOM_BUILD]
59+Pre-Build=
60+Pre-BuildEnabled=1
61+Post-Build=
62+Post-BuildEnabled=1
--- /dev/null
+++ b/mips/clib/clib_p32MX370F512H.ld
@@ -0,0 +1,804 @@
1+/*--------------------------------------------------------------------------
2+ * MPLAB XC Compiler - PIC32MX370F512H linker script
3+ *
4+ * This software is developed by Microchip Technology Inc. and its
5+ * subsidiaries ("Microchip").
6+ *
7+ * Redistribution and use in source and binary forms, with or without
8+ * modification, are permitted provided that the following conditions are
9+ * met:
10+ *
11+ * 1. Redistributions of source code must retain the above copyright
12+ * notice, this list of conditions and the following disclaimer.
13+ * 2. Redistributions in binary form must reproduce the above
14+ * copyright notice, this list of conditions and the following
15+ * disclaimer in the documentation and/or other materials provided
16+ * with the distribution.
17+ * 3. Microchip's name may not be used to endorse or promote products
18+ * derived from this software without specific prior written
19+ * permission.
20+ *
21+ * THIS SOFTWARE IS PROVIDED BY MICROCHIP "AS IS" AND ANY EXPRESS OR IMPLIED
22+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23+ * MERCHANTABILITY AND FITNESS FOR PURPOSE ARE DISCLAIMED. IN NO EVENT
24+ * SHALL MICROCHIP BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING BUT NOT LIMITED TO
26+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA OR PROFITS;
27+ * OR BUSINESS INTERRUPTION) HOWSOEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+ *
32+ *-------------------------------------------------------------------------*/
33+
34+/* Default linker script, for normal executables */
35+
36+/* IMPORTANT: PIC32MX MCUs use two files for the default linker script:
37+ * 1) pic32mx/lib/ldscripts/elf32pic32.x (main linker script)
38+ * 2) pic32mx/lib/proc/32MX370F512H/procdefs.ld (variant-specific fragment)
39+ *
40+ * This file is provided only as a convenience when adding a custom linker script
41+ * to your application.
42+ */
43+
44+OUTPUT_FORMAT("elf32-tradlittlemips")
45+OUTPUT_ARCH(pic32mx)
46+ENTRY(_reset)
47+/*
48+ * Provide for a minimum stack and heap size
49+ * - _min_stack_size - represents the minimum space that must be made
50+ * available for the stack. Can be overridden from
51+ * the command line using the linker's --defsym option.
52+ * - _min_heap_size - represents the minimum space that must be made
53+ * available for the heap. Must be specified on
54+ * the command line using the linker's --defsym option.
55+ */
56+EXTERN (_min_stack_size _min_heap_size)
57+PROVIDE(_min_stack_size = 0x800) ;
58+
59+/*************************************************************************
60+ * Processor-specific object file. Contains SFR definitions.
61+ *************************************************************************/
62+INPUT("processor.o")
63+
64+/*************************************************************************
65+ * Processor-specific peripheral libraries are optional
66+ *************************************************************************/
67+OPTIONAL("libmchp_peripheral.a")
68+OPTIONAL("libmchp_peripheral_32MX370F512H.a")
69+
70+/*************************************************************************
71+ * For interrupt vector handling
72+ *************************************************************************/
73+PROVIDE(_vector_spacing = 0x00000001);
74+_ebase_address = 0x9D006000;
75+
76+/*************************************************************************
77+ * Memory Address Equates
78+ * _RESET_ADDR -- Reset Vector
79+ * _BEV_EXCPT_ADDR -- Boot exception Vector
80+ * _DBG_EXCPT_ADDR -- In-circuit Debugging Exception Vector
81+ * _DBG_CODE_ADDR -- In-circuit Debug Executive address
82+ * _DBG_CODE_SIZE -- In-circuit Debug Executive size
83+ * _GEN_EXCPT_ADDR -- General Exception Vector
84+ *************************************************************************/
85+_RESET_ADDR = (0x9D006000 + 0x1000);
86+_BEV_EXCPT_ADDR = (0x9D006000 + 0x1000 + 0x380);
87+_DBG_EXCPT_ADDR = (0x9D006000 + 0x1000 + 0x480);
88+_DBG_CODE_ADDR = 0xBFC02000;
89+_DBG_CODE_SIZE = 0xFF0;
90+_GEN_EXCPT_ADDR = _ebase_address + 0x180;
91+
92+/*************************************************************************
93+ * Memory Regions
94+ *
95+ * Memory regions without attributes cannot be used for orphaned sections.
96+ * Only sections specifically assigned to these regions can be allocated
97+ * into these regions.
98+ *
99+ * The Debug exception vector is located at 0x9FC00480.
100+ * The config_<address> sections are used to locate the config words at
101+ * their absolute addresses.
102+ *************************************************************************/
103+MEMORY
104+{
105+ kseg0_program_mem (rx) : ORIGIN = (0x9D006000+0x1000+0x490), LENGTH = (0x20000-0x6000-0x1000-0x490)
106+ kseg2_program_mem (rx) : ORIGIN = (0x9D020000), LENGTH = (0x80000-0x20000-0x1000)
107+ kseg0_boot_mem : ORIGIN = (0x9D006000+0x1000+0x490), LENGTH = 0 /* dummy */
108+ exception_mem : ORIGIN = 0x9D006000, LENGTH = 0x1000
109+ kseg1_boot_mem : ORIGIN = (0x9D006000+0x1000), LENGTH = 0x490
110+ debug_exec_mem : ORIGIN = 0xBFC02000, LENGTH = 0xFF0
111+ config3 : ORIGIN = 0xBFC02FF0, LENGTH = 0x4
112+ config2 : ORIGIN = 0xBFC02FF4, LENGTH = 0x4
113+ config1 : ORIGIN = 0xBFC02FF8, LENGTH = 0x4
114+ config0 : ORIGIN = 0xBFC02FFC, LENGTH = 0x4
115+ kseg1_data_mem (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x20000
116+ sfrs : ORIGIN = 0xBF800000, LENGTH = 0x100000
117+ configsfrs : ORIGIN = 0xBFC02FF0, LENGTH = 0x10
118+}
119+
120+/*
121+ MachiKania C library specific section follows
122+*/
123+
124+SECTIONS
125+{
126+ .machikania_object : {
127+ KEEP(*(.machikania_clib))
128+ } > kseg2_program_mem
129+}
130+
131+/*************************************************************************
132+ * Configuration-word sections. Map the config-pragma input sections to
133+ * absolute-address output sections.
134+ *************************************************************************/
135+SECTIONS
136+{
137+ .config_BFC02FF0 : {
138+ KEEP(*(.config_BFC02FF0))
139+ } > config3
140+ .config_BFC02FF4 : {
141+ KEEP(*(.config_BFC02FF4))
142+ } > config2
143+ .config_BFC02FF8 : {
144+ KEEP(*(.config_BFC02FF8))
145+ } > config1
146+ .config_BFC02FFC : {
147+ KEEP(*(.config_BFC02FFC))
148+ } > config0
149+}
150+SECTIONS
151+{
152+ /* Boot Sections */
153+ .reset _RESET_ADDR :
154+ {
155+ KEEP(*(.reset))
156+ KEEP(*(.reset.startup))
157+ } > kseg1_boot_mem
158+ .bev_excpt _BEV_EXCPT_ADDR :
159+ {
160+ KEEP(*(.bev_handler))
161+ } > kseg1_boot_mem
162+ /* Debug exception vector */
163+ .dbg_excpt _DBG_EXCPT_ADDR (NOLOAD) :
164+ {
165+ . += (DEFINED (_DEBUGGER) ? 0x8 : 0x0);
166+ } > kseg1_boot_mem
167+ /* Space reserved for the debug executive */
168+ .dbg_code _DBG_CODE_ADDR (NOLOAD) :
169+ {
170+ . += (DEFINED (_DEBUGGER) ? _DBG_CODE_SIZE : 0x0);
171+ } > debug_exec_mem
172+
173+ .app_excpt _GEN_EXCPT_ADDR :
174+ {
175+ KEEP(*(.gen_handler))
176+ } > exception_mem
177+
178+ .vector_0 _ebase_address + 0x200 + ((_vector_spacing << 5) * 0) :
179+ {
180+ KEEP(*(.vector_0))
181+ } > exception_mem
182+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_0) <= (_vector_spacing << 5), "function at exception vector 0 too large")
183+ .vector_1 _ebase_address + 0x200 + ((_vector_spacing << 5) * 1) :
184+ {
185+ KEEP(*(.vector_1))
186+ } > exception_mem
187+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_1) <= (_vector_spacing << 5), "function at exception vector 1 too large")
188+ .vector_2 _ebase_address + 0x200 + ((_vector_spacing << 5) * 2) :
189+ {
190+ KEEP(*(.vector_2))
191+ } > exception_mem
192+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_2) <= (_vector_spacing << 5), "function at exception vector 2 too large")
193+ .vector_3 _ebase_address + 0x200 + ((_vector_spacing << 5) * 3) :
194+ {
195+ KEEP(*(.vector_3))
196+ } > exception_mem
197+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_3) <= (_vector_spacing << 5), "function at exception vector 3 too large")
198+ .vector_4 _ebase_address + 0x200 + ((_vector_spacing << 5) * 4) :
199+ {
200+ KEEP(*(.vector_4))
201+ } > exception_mem
202+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_4) <= (_vector_spacing << 5), "function at exception vector 4 too large")
203+ .vector_5 _ebase_address + 0x200 + ((_vector_spacing << 5) * 5) :
204+ {
205+ KEEP(*(.vector_5))
206+ } > exception_mem
207+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_5) <= (_vector_spacing << 5), "function at exception vector 5 too large")
208+ .vector_6 _ebase_address + 0x200 + ((_vector_spacing << 5) * 6) :
209+ {
210+ KEEP(*(.vector_6))
211+ } > exception_mem
212+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_6) <= (_vector_spacing << 5), "function at exception vector 6 too large")
213+ .vector_7 _ebase_address + 0x200 + ((_vector_spacing << 5) * 7) :
214+ {
215+ KEEP(*(.vector_7))
216+ } > exception_mem
217+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_7) <= (_vector_spacing << 5), "function at exception vector 7 too large")
218+ .vector_8 _ebase_address + 0x200 + ((_vector_spacing << 5) * 8) :
219+ {
220+ KEEP(*(.vector_8))
221+ } > exception_mem
222+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_8) <= (_vector_spacing << 5), "function at exception vector 8 too large")
223+ .vector_9 _ebase_address + 0x200 + ((_vector_spacing << 5) * 9) :
224+ {
225+ KEEP(*(.vector_9))
226+ } > exception_mem
227+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_9) <= (_vector_spacing << 5), "function at exception vector 9 too large")
228+ .vector_10 _ebase_address + 0x200 + ((_vector_spacing << 5) * 10) :
229+ {
230+ KEEP(*(.vector_10))
231+ } > exception_mem
232+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_10) <= (_vector_spacing << 5), "function at exception vector 10 too large")
233+ .vector_11 _ebase_address + 0x200 + ((_vector_spacing << 5) * 11) :
234+ {
235+ KEEP(*(.vector_11))
236+ } > exception_mem
237+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_11) <= (_vector_spacing << 5), "function at exception vector 11 too large")
238+ .vector_12 _ebase_address + 0x200 + ((_vector_spacing << 5) * 12) :
239+ {
240+ KEEP(*(.vector_12))
241+ } > exception_mem
242+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_12) <= (_vector_spacing << 5), "function at exception vector 12 too large")
243+ .vector_13 _ebase_address + 0x200 + ((_vector_spacing << 5) * 13) :
244+ {
245+ KEEP(*(.vector_13))
246+ } > exception_mem
247+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_13) <= (_vector_spacing << 5), "function at exception vector 13 too large")
248+ .vector_14 _ebase_address + 0x200 + ((_vector_spacing << 5) * 14) :
249+ {
250+ KEEP(*(.vector_14))
251+ } > exception_mem
252+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_14) <= (_vector_spacing << 5), "function at exception vector 14 too large")
253+ .vector_15 _ebase_address + 0x200 + ((_vector_spacing << 5) * 15) :
254+ {
255+ KEEP(*(.vector_15))
256+ } > exception_mem
257+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_15) <= (_vector_spacing << 5), "function at exception vector 15 too large")
258+ .vector_16 _ebase_address + 0x200 + ((_vector_spacing << 5) * 16) :
259+ {
260+ KEEP(*(.vector_16))
261+ } > exception_mem
262+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_16) <= (_vector_spacing << 5), "function at exception vector 16 too large")
263+ .vector_17 _ebase_address + 0x200 + ((_vector_spacing << 5) * 17) :
264+ {
265+ KEEP(*(.vector_17))
266+ } > exception_mem
267+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_17) <= (_vector_spacing << 5), "function at exception vector 17 too large")
268+ .vector_18 _ebase_address + 0x200 + ((_vector_spacing << 5) * 18) :
269+ {
270+ KEEP(*(.vector_18))
271+ } > exception_mem
272+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_18) <= (_vector_spacing << 5), "function at exception vector 18 too large")
273+ .vector_19 _ebase_address + 0x200 + ((_vector_spacing << 5) * 19) :
274+ {
275+ KEEP(*(.vector_19))
276+ } > exception_mem
277+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_19) <= (_vector_spacing << 5), "function at exception vector 19 too large")
278+ .vector_20 _ebase_address + 0x200 + ((_vector_spacing << 5) * 20) :
279+ {
280+ KEEP(*(.vector_20))
281+ } > exception_mem
282+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_20) <= (_vector_spacing << 5), "function at exception vector 20 too large")
283+ .vector_21 _ebase_address + 0x200 + ((_vector_spacing << 5) * 21) :
284+ {
285+ KEEP(*(.vector_21))
286+ } > exception_mem
287+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_21) <= (_vector_spacing << 5), "function at exception vector 21 too large")
288+ .vector_22 _ebase_address + 0x200 + ((_vector_spacing << 5) * 22) :
289+ {
290+ KEEP(*(.vector_22))
291+ } > exception_mem
292+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_22) <= (_vector_spacing << 5), "function at exception vector 22 too large")
293+ .vector_23 _ebase_address + 0x200 + ((_vector_spacing << 5) * 23) :
294+ {
295+ KEEP(*(.vector_23))
296+ } > exception_mem
297+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_23) <= (_vector_spacing << 5), "function at exception vector 23 too large")
298+ .vector_24 _ebase_address + 0x200 + ((_vector_spacing << 5) * 24) :
299+ {
300+ KEEP(*(.vector_24))
301+ } > exception_mem
302+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_24) <= (_vector_spacing << 5), "function at exception vector 24 too large")
303+ .vector_25 _ebase_address + 0x200 + ((_vector_spacing << 5) * 25) :
304+ {
305+ KEEP(*(.vector_25))
306+ } > exception_mem
307+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_25) <= (_vector_spacing << 5), "function at exception vector 25 too large")
308+ .vector_26 _ebase_address + 0x200 + ((_vector_spacing << 5) * 26) :
309+ {
310+ KEEP(*(.vector_26))
311+ } > exception_mem
312+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_26) <= (_vector_spacing << 5), "function at exception vector 26 too large")
313+ .vector_27 _ebase_address + 0x200 + ((_vector_spacing << 5) * 27) :
314+ {
315+ KEEP(*(.vector_27))
316+ } > exception_mem
317+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_27) <= (_vector_spacing << 5), "function at exception vector 27 too large")
318+ .vector_28 _ebase_address + 0x200 + ((_vector_spacing << 5) * 28) :
319+ {
320+ KEEP(*(.vector_28))
321+ } > exception_mem
322+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_28) <= (_vector_spacing << 5), "function at exception vector 28 too large")
323+ .vector_29 _ebase_address + 0x200 + ((_vector_spacing << 5) * 29) :
324+ {
325+ KEEP(*(.vector_29))
326+ } > exception_mem
327+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_29) <= (_vector_spacing << 5), "function at exception vector 29 too large")
328+ .vector_30 _ebase_address + 0x200 + ((_vector_spacing << 5) * 30) :
329+ {
330+ KEEP(*(.vector_30))
331+ } > exception_mem
332+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_30) <= (_vector_spacing << 5), "function at exception vector 30 too large")
333+ .vector_31 _ebase_address + 0x200 + ((_vector_spacing << 5) * 31) :
334+ {
335+ KEEP(*(.vector_31))
336+ } > exception_mem
337+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_31) <= (_vector_spacing << 5), "function at exception vector 31 too large")
338+ .vector_32 _ebase_address + 0x200 + ((_vector_spacing << 5) * 32) :
339+ {
340+ KEEP(*(.vector_32))
341+ } > exception_mem
342+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_32) <= (_vector_spacing << 5), "function at exception vector 32 too large")
343+ .vector_33 _ebase_address + 0x200 + ((_vector_spacing << 5) * 33) :
344+ {
345+ KEEP(*(.vector_33))
346+ } > exception_mem
347+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_33) <= (_vector_spacing << 5), "function at exception vector 33 too large")
348+ .vector_34 _ebase_address + 0x200 + ((_vector_spacing << 5) * 34) :
349+ {
350+ KEEP(*(.vector_34))
351+ } > exception_mem
352+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_34) <= (_vector_spacing << 5), "function at exception vector 34 too large")
353+ .vector_35 _ebase_address + 0x200 + ((_vector_spacing << 5) * 35) :
354+ {
355+ KEEP(*(.vector_35))
356+ } > exception_mem
357+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_35) <= (_vector_spacing << 5), "function at exception vector 35 too large")
358+ .vector_36 _ebase_address + 0x200 + ((_vector_spacing << 5) * 36) :
359+ {
360+ KEEP(*(.vector_36))
361+ } > exception_mem
362+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_36) <= (_vector_spacing << 5), "function at exception vector 36 too large")
363+ .vector_37 _ebase_address + 0x200 + ((_vector_spacing << 5) * 37) :
364+ {
365+ KEEP(*(.vector_37))
366+ } > exception_mem
367+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_37) <= (_vector_spacing << 5), "function at exception vector 37 too large")
368+ .vector_38 _ebase_address + 0x200 + ((_vector_spacing << 5) * 38) :
369+ {
370+ KEEP(*(.vector_38))
371+ } > exception_mem
372+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_38) <= (_vector_spacing << 5), "function at exception vector 38 too large")
373+ .vector_39 _ebase_address + 0x200 + ((_vector_spacing << 5) * 39) :
374+ {
375+ KEEP(*(.vector_39))
376+ } > exception_mem
377+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_39) <= (_vector_spacing << 5), "function at exception vector 39 too large")
378+ .vector_40 _ebase_address + 0x200 + ((_vector_spacing << 5) * 40) :
379+ {
380+ KEEP(*(.vector_40))
381+ } > exception_mem
382+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_40) <= (_vector_spacing << 5), "function at exception vector 40 too large")
383+ .vector_41 _ebase_address + 0x200 + ((_vector_spacing << 5) * 41) :
384+ {
385+ KEEP(*(.vector_41))
386+ } > exception_mem
387+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_41) <= (_vector_spacing << 5), "function at exception vector 41 too large")
388+ .vector_42 _ebase_address + 0x200 + ((_vector_spacing << 5) * 42) :
389+ {
390+ KEEP(*(.vector_42))
391+ } > exception_mem
392+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_42) <= (_vector_spacing << 5), "function at exception vector 42 too large")
393+ .vector_43 _ebase_address + 0x200 + ((_vector_spacing << 5) * 43) :
394+ {
395+ KEEP(*(.vector_43))
396+ } > exception_mem
397+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_43) <= (_vector_spacing << 5), "function at exception vector 43 too large")
398+ .vector_44 _ebase_address + 0x200 + ((_vector_spacing << 5) * 44) :
399+ {
400+ KEEP(*(.vector_44))
401+ } > exception_mem
402+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_44) <= (_vector_spacing << 5), "function at exception vector 44 too large")
403+ .vector_45 _ebase_address + 0x200 + ((_vector_spacing << 5) * 45) :
404+ {
405+ KEEP(*(.vector_45))
406+ } > exception_mem
407+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_45) <= (_vector_spacing << 5), "function at exception vector 45 too large")
408+ .vector_46 _ebase_address + 0x200 + ((_vector_spacing << 5) * 46) :
409+ {
410+ KEEP(*(.vector_46))
411+ } > exception_mem
412+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_46) <= (_vector_spacing << 5), "function at exception vector 46 too large")
413+ .vector_47 _ebase_address + 0x200 + ((_vector_spacing << 5) * 47) :
414+ {
415+ KEEP(*(.vector_47))
416+ } > exception_mem
417+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_47) <= (_vector_spacing << 5), "function at exception vector 47 too large")
418+ .vector_48 _ebase_address + 0x200 + ((_vector_spacing << 5) * 48) :
419+ {
420+ KEEP(*(.vector_48))
421+ } > exception_mem
422+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_48) <= (_vector_spacing << 5), "function at exception vector 48 too large")
423+ .vector_49 _ebase_address + 0x200 + ((_vector_spacing << 5) * 49) :
424+ {
425+ KEEP(*(.vector_49))
426+ } > exception_mem
427+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_49) <= (_vector_spacing << 5), "function at exception vector 49 too large")
428+ .vector_50 _ebase_address + 0x200 + ((_vector_spacing << 5) * 50) :
429+ {
430+ KEEP(*(.vector_50))
431+ } > exception_mem
432+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_50) <= (_vector_spacing << 5), "function at exception vector 50 too large")
433+ .vector_51 _ebase_address + 0x200 + ((_vector_spacing << 5) * 51) :
434+ {
435+ KEEP(*(.vector_51))
436+ } > exception_mem
437+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_51) <= (_vector_spacing << 5), "function at exception vector 51 too large")
438+ .vector_52 _ebase_address + 0x200 + ((_vector_spacing << 5) * 52) :
439+ {
440+ KEEP(*(.vector_52))
441+ } > exception_mem
442+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_52) <= (_vector_spacing << 5), "function at exception vector 52 too large")
443+ .vector_53 _ebase_address + 0x200 + ((_vector_spacing << 5) * 53) :
444+ {
445+ KEEP(*(.vector_53))
446+ } > exception_mem
447+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_53) <= (_vector_spacing << 5), "function at exception vector 53 too large")
448+ .vector_54 _ebase_address + 0x200 + ((_vector_spacing << 5) * 54) :
449+ {
450+ KEEP(*(.vector_54))
451+ } > exception_mem
452+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_54) <= (_vector_spacing << 5), "function at exception vector 54 too large")
453+ .vector_55 _ebase_address + 0x200 + ((_vector_spacing << 5) * 55) :
454+ {
455+ KEEP(*(.vector_55))
456+ } > exception_mem
457+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_55) <= (_vector_spacing << 5), "function at exception vector 55 too large")
458+ .vector_56 _ebase_address + 0x200 + ((_vector_spacing << 5) * 56) :
459+ {
460+ KEEP(*(.vector_56))
461+ } > exception_mem
462+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_56) <= (_vector_spacing << 5), "function at exception vector 56 too large")
463+ .vector_57 _ebase_address + 0x200 + ((_vector_spacing << 5) * 57) :
464+ {
465+ KEEP(*(.vector_57))
466+ } > exception_mem
467+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_57) <= (_vector_spacing << 5), "function at exception vector 57 too large")
468+ .vector_58 _ebase_address + 0x200 + ((_vector_spacing << 5) * 58) :
469+ {
470+ KEEP(*(.vector_58))
471+ } > exception_mem
472+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_58) <= (_vector_spacing << 5), "function at exception vector 58 too large")
473+ .vector_59 _ebase_address + 0x200 + ((_vector_spacing << 5) * 59) :
474+ {
475+ KEEP(*(.vector_59))
476+ } > exception_mem
477+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_59) <= (_vector_spacing << 5), "function at exception vector 59 too large")
478+ .vector_60 _ebase_address + 0x200 + ((_vector_spacing << 5) * 60) :
479+ {
480+ KEEP(*(.vector_60))
481+ } > exception_mem
482+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_60) <= (_vector_spacing << 5), "function at exception vector 60 too large")
483+ .vector_61 _ebase_address + 0x200 + ((_vector_spacing << 5) * 61) :
484+ {
485+ KEEP(*(.vector_61))
486+ } > exception_mem
487+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_61) <= (_vector_spacing << 5), "function at exception vector 61 too large")
488+ .vector_62 _ebase_address + 0x200 + ((_vector_spacing << 5) * 62) :
489+ {
490+ KEEP(*(.vector_62))
491+ } > exception_mem
492+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_62) <= (_vector_spacing << 5), "function at exception vector 62 too large")
493+ .vector_63 _ebase_address + 0x200 + ((_vector_spacing << 5) * 63) :
494+ {
495+ KEEP(*(.vector_63))
496+ } > exception_mem
497+ ASSERT (_vector_spacing == 0 || SIZEOF(.vector_63) <= (_vector_spacing << 5), "function at exception vector 63 too large")
498+
499+ /* The startup code is in the .reset.startup section.
500+ * Keep this here for backwards compatibility with older
501+ * C32 v1.xx releases.
502+ */
503+ .startup ORIGIN(kseg0_boot_mem) :
504+ {
505+ KEEP(*(.startup))
506+ } > kseg0_boot_mem
507+ /* Code Sections - Note that input sections *(.text) and *(.text.*)
508+ ** are not mapped here. The best-fit allocator locates them,
509+ ** so that .text may flow around absolute sections as needed.
510+ */
511+ .text :
512+ {
513+ *(.stub .gnu.linkonce.t.*)
514+ KEEP (*(.text.*personality*))
515+ *(.mips16.fn.*)
516+ *(.mips16.call.*)
517+ *(.gnu.warning)
518+ . = ALIGN(4) ;
519+ } >kseg0_program_mem
520+ /* Global-namespace object initialization */
521+ .init :
522+ {
523+ KEEP (*crti.o(.init))
524+ KEEP (*crtbegin.o(.init))
525+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o *crtn.o ).init))
526+ KEEP (*crtend.o(.init))
527+ KEEP (*crtn.o(.init))
528+ . = ALIGN(4) ;
529+ } >kseg0_program_mem
530+ .fini :
531+ {
532+ KEEP (*(.fini))
533+ . = ALIGN(4) ;
534+ } >kseg0_program_mem
535+ .preinit_array :
536+ {
537+ PROVIDE_HIDDEN (__preinit_array_start = .);
538+ KEEP (*(.preinit_array))
539+ PROVIDE_HIDDEN (__preinit_array_end = .);
540+ . = ALIGN(4) ;
541+ } >kseg0_program_mem
542+ .init_array :
543+ {
544+ PROVIDE_HIDDEN (__init_array_start = .);
545+ KEEP (*(SORT(.init_array.*)))
546+ KEEP (*(.init_array))
547+ PROVIDE_HIDDEN (__init_array_end = .);
548+ . = ALIGN(4) ;
549+ } >kseg0_program_mem
550+ .fini_array :
551+ {
552+ PROVIDE_HIDDEN (__fini_array_start = .);
553+ KEEP (*(SORT(.fini_array.*)))
554+ KEEP (*(.fini_array))
555+ PROVIDE_HIDDEN (__fini_array_end = .);
556+ . = ALIGN(4) ;
557+ } >kseg0_program_mem
558+ .ctors :
559+ {
560+ /* XC32 uses crtbegin.o to find the start of
561+ the constructors, so we make sure it is
562+ first. Because this is a wildcard, it
563+ doesn't matter if the user does not
564+ actually link against crtbegin.o; the
565+ linker won't look for a file to match a
566+ wildcard. The wildcard also means that it
567+ doesn't matter which directory crtbegin.o
568+ is in. */
569+ KEEP (*crtbegin.o(.ctors))
570+ KEEP (*crtbegin?.o(.ctors))
571+ /* We don't want to include the .ctor section from
572+ the crtend.o file until after the sorted ctors.
573+ The .ctor section from the crtend file contains the
574+ end of ctors marker and it must be last */
575+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
576+ KEEP (*(SORT(.ctors.*)))
577+ KEEP (*(.ctors))
578+ . = ALIGN(4) ;
579+ } >kseg0_program_mem
580+ .dtors :
581+ {
582+ KEEP (*crtbegin.o(.dtors))
583+ KEEP (*crtbegin?.o(.dtors))
584+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
585+ KEEP (*(SORT(.dtors.*)))
586+ KEEP (*(.dtors))
587+ . = ALIGN(4) ;
588+ } >kseg0_program_mem
589+ /* Read-only sections */
590+ .rodata :
591+ {
592+ *( .gnu.linkonce.r.*)
593+ *(.rodata1)
594+ . = ALIGN(4) ;
595+ } >kseg0_program_mem
596+ /*
597+ * Small initialized constant global and static data can be placed in the
598+ * .sdata2 section. This is different from .sdata, which contains small
599+ * initialized non-constant global and static data.
600+ */
601+ .sdata2 ALIGN(4) :
602+ {
603+ *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
604+ . = ALIGN(4) ;
605+ } >kseg0_program_mem
606+ /*
607+ * Uninitialized constant global and static data (i.e., variables which will
608+ * always be zero). Again, this is different from .sbss, which contains
609+ * small non-initialized, non-constant global and static data.
610+ */
611+ .sbss2 ALIGN(4) :
612+ {
613+ *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
614+ . = ALIGN(4) ;
615+ } >kseg0_program_mem
616+ .eh_frame_hdr :
617+ {
618+ *(.eh_frame_hdr)
619+ } >kseg0_program_mem
620+ . = ALIGN(4) ;
621+ .eh_frame : ONLY_IF_RO
622+ {
623+ KEEP (*(.eh_frame))
624+ } >kseg0_program_mem
625+ . = ALIGN(4) ;
626+ .gcc_except_table : ONLY_IF_RO
627+ {
628+ *(.gcc_except_table .gcc_except_table.*)
629+ } >kseg0_program_mem
630+ . = ALIGN(4) ;
631+ .dbg_data (NOLOAD) :
632+ {
633+ . += (DEFINED (_DEBUGGER) ? 0x200 : 0x0);
634+ } >kseg1_data_mem
635+ .jcr :
636+ {
637+ KEEP (*(.jcr))
638+ . = ALIGN(4) ;
639+ } >kseg1_data_mem
640+ .eh_frame : ONLY_IF_RW
641+ {
642+ KEEP (*(.eh_frame))
643+ } >kseg1_data_mem
644+ . = ALIGN(4) ;
645+ .gcc_except_table : ONLY_IF_RW
646+ {
647+ *(.gcc_except_table .gcc_except_table.*)
648+ } >kseg1_data_mem
649+ . = ALIGN(4) ;
650+ /* Persistent data - Use the new C 'persistent' attribute instead. */
651+ .persist :
652+ {
653+ _persist_begin = .;
654+ *(.persist .persist.*)
655+ *(.pbss .pbss.*)
656+ . = ALIGN(4) ;
657+ _persist_end = .;
658+ } >kseg1_data_mem
659+ /*
660+ * Note that input sections named .data* are not mapped here.
661+ * The best-fit allocator locates them, so that they may flow
662+ * around absolute sections as needed.
663+ */
664+ .data :
665+ {
666+ *( .gnu.linkonce.d.*)
667+ SORT(CONSTRUCTORS)
668+ *(.data1)
669+ . = ALIGN(4) ;
670+ } >kseg1_data_mem
671+ . = .;
672+ _gp = ALIGN(16) + 0x7ff0;
673+ .got ALIGN(4) :
674+ {
675+ *(.got.plt) *(.got)
676+ . = ALIGN(4) ;
677+ } >kseg1_data_mem /* AT>kseg0_program_mem */
678+ /*
679+ * Note that 'small' data sections are still mapped in the linker
680+ * script. This ensures that they are grouped together for
681+ * gp-relative addressing. Absolute sections are allocated after
682+ * the 'small' data sections so small data cannot flow around them.
683+ */
684+ /*
685+ * We want the small data sections together, so single-instruction offsets
686+ * can access them all, and initialized data all before uninitialized, so
687+ * we can shorten the on-disk segment size.
688+ */
689+ .sdata ALIGN(4) :
690+ {
691+ _sdata_begin = . ;
692+ *(.sdata .sdata.* .gnu.linkonce.s.*)
693+ . = ALIGN(4) ;
694+ _sdata_end = . ;
695+ } >kseg1_data_mem
696+ .lit8 :
697+ {
698+ *(.lit8)
699+ } >kseg1_data_mem
700+ .lit4 :
701+ {
702+ *(.lit4)
703+ } >kseg1_data_mem
704+ . = ALIGN (4) ;
705+ _data_end = . ;
706+ _bss_begin = . ;
707+ .sbss ALIGN(4) :
708+ {
709+ _sbss_begin = . ;
710+ *(.dynsbss)
711+ *(.sbss .sbss.* .gnu.linkonce.sb.*)
712+ *(.scommon)
713+ _sbss_end = . ;
714+ . = ALIGN(4) ;
715+ } >kseg1_data_mem
716+ /*
717+ * Align here to ensure that the .bss section occupies space up to
718+ * _end. Align after .bss to ensure correct alignment even if the
719+ * .bss section disappears because there are no input sections.
720+ *
721+ * Note that input sections named .bss* are no longer mapped here.
722+ * The best-fit allocator locates them, so that they may flow
723+ * around absolute sections as needed.
724+ *
725+ */
726+ .bss :
727+ {
728+ *(.dynbss)
729+ *(COMMON)
730+ /* Align here to ensure that the .bss section occupies space up to
731+ _end. Align after .bss to ensure correct alignment even if the
732+ .bss section disappears because there are no input sections. */
733+ . = ALIGN(. != 0 ? 4 : 1);
734+ } >kseg1_data_mem
735+ . = ALIGN(4) ;
736+ _end = . ;
737+ _bss_end = . ;
738+ /*
739+ * The heap and stack are best-fit allocated by the linker after other
740+ * data and bss sections have been allocated.
741+ */
742+ /*
743+ * RAM functions go at the end of our stack and heap allocation.
744+ * Alignment of 2K required by the boundary register (BMXDKPBA).
745+ *
746+ * RAM functions are now allocated by the linker. The linker generates
747+ * _ramfunc_begin and _bmxdkpba_address symbols depending on the
748+ * location of RAM functions.
749+ */
750+ _bmxdudba_address = LENGTH(kseg1_data_mem) ;
751+ _bmxdupba_address = LENGTH(kseg1_data_mem) ;
752+ /* The .pdr section belongs in the absolute section */
753+ /DISCARD/ : { *(.pdr) }
754+ .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
755+ .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
756+ .mdebug.abi32 : { KEEP(*(.mdebug.abi32)) }
757+ .mdebug.abiN32 : { KEEP(*(.mdebug.abiN32)) }
758+ .mdebug.abi64 : { KEEP(*(.mdebug.abi64)) }
759+ .mdebug.abiO64 : { KEEP(*(.mdebug.abiO64)) }
760+ .mdebug.eabi32 : { KEEP(*(.mdebug.eabi32)) }
761+ .mdebug.eabi64 : { KEEP(*(.mdebug.eabi64)) }
762+ .gcc_compiled_long32 : { KEEP(*(.gcc_compiled_long32)) }
763+ .gcc_compiled_long64 : { KEEP(*(.gcc_compiled_long64)) }
764+ /* Stabs debugging sections. */
765+ .stab 0 : { *(.stab) }
766+ .stabstr 0 : { *(.stabstr) }
767+ .stab.excl 0 : { *(.stab.excl) }
768+ .stab.exclstr 0 : { *(.stab.exclstr) }
769+ .stab.index 0 : { *(.stab.index) }
770+ .stab.indexstr 0 : { *(.stab.indexstr) }
771+ .comment 0 : { *(.comment) }
772+ /* DWARF debug sections used by MPLAB X for source-level debugging.
773+ Symbols in the DWARF debugging sections are relative to the beginning
774+ of the section so we begin them at 0. */
775+ /* DWARF 1 */
776+ .debug 0 : { *(.debug) }
777+ .line 0 : { *(.line) }
778+ /* GNU DWARF 1 extensions */
779+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
780+ .debug_sfnames 0 : { *(.debug_sfnames) }
781+ /* DWARF 1.1 and DWARF 2 */
782+ .debug_aranges 0 : { *(.debug_aranges) }
783+ .debug_pubnames 0 : { *(.debug_pubnames) }
784+ /* DWARF 2 */
785+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
786+ .debug_abbrev 0 : { *(.debug_abbrev) }
787+ .debug_line 0 : { *(.debug_line) }
788+ .debug_frame 0 : { *(.debug_frame) }
789+ .debug_str 0 : { *(.debug_str) }
790+ .debug_loc 0 : { *(.debug_loc) }
791+ .debug_macinfo 0 : { *(.debug_macinfo) }
792+ /* SGI/MIPS DWARF 2 extensions */
793+ .debug_weaknames 0 : { *(.debug_weaknames) }
794+ .debug_funcnames 0 : { *(.debug_funcnames) }
795+ .debug_typenames 0 : { *(.debug_typenames) }
796+ .debug_varnames 0 : { *(.debug_varnames) }
797+ .debug_pubtypes 0 : { *(.debug_pubtypes) }
798+ .debug_ranges 0 : { *(.debug_ranges) }
799+ /DISCARD/ : { *(.rel.dyn) }
800+ .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
801+ /DISCARD/ : { *(.note.GNU-stack) }
802+ /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) *(.discard) }
803+}
804+
--- /dev/null
+++ b/mips/clib/example.c
@@ -0,0 +1,51 @@
1+/***********************************
2+ * *
3+ * Template of CLIB for MachiKania *
4+ * *
5+ ***********************************/
6+#include <xc.h>
7+#include "./clib.h"
8+
9+char** g_pconst;
10+
11+// The init() for initiation is required if string constant(s) will be used.
12+// First parameter is the pointer to string constan(s) array
13+// The initializations of global variables must be done here.
14+// 文字列定数を使いたい時は、初期化関数init()は必須。
15+// 第一引数は、文字列定数リストへのポインター。
16+// グローバル変数の初期化は、この関数内で行なう必要あり。
17+CLIB void init(char** pconstants){
18+ g_pconst=pconstants;
19+}
20+
21+// Example of a function.
22+// The definition must start from "CLIB"
23+// Maximum number of parameter(s) is 4.
24+// 関数の実装例。
25+// 関数定義は、「CLIB」で始める事。
26+// 引数は、最大4つまで。
27+CLIB char* test(int param1){
28+ return g_pconst[0];
29+}
30+// The list of string constant(s)
31+// This array must end with 0.
32+// 文字列定数のリスト。
33+// この配列の最終要素は、0 とすること。
34+const void* const constants[]={
35+ "STRCONSTANT1",
36+ "STRCONSTANT2",
37+ "STRCONSTANT3",
38+ 0
39+};
40+
41+// The list of public function(s)
42+// This defines the function name(s) and function address(s)
43+// This array must end with 0.
44+// パブリック関数のリスト。
45+// 関数名と、関数のアドレスを指定する。
46+// この配列の最終要素は、0 とすること。
47+const void* const functions[]={
48+ "INIT",init,
49+ "TEST",test,
50+ 0
51+};