i_embed.pas 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. {
  2. This unit implements support information structures for the FPC Embedded target
  3. Copyright (c) 1998-2006 by Peter Vreman
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit i_embed;
  18. {$i fpcdefs.inc}
  19. {$ifdef go32v2}
  20. { As wlib uses a different Dos-Extender, long-command line
  21. encoding for DJGPP does not work here.
  22. Put all inside a script file instead }
  23. {$define USE_SCRIPTED_WLIB}
  24. {$endif}
  25. interface
  26. uses
  27. systems;
  28. const
  29. system_arm_embedded_info : tsysteminfo =
  30. (
  31. system : system_arm_embedded;
  32. name : 'Embedded';
  33. shortname : 'embedded';
  34. flags : [tf_needs_symbol_size,tf_files_case_sensitive,tf_requires_proper_alignment,
  35. tf_smartlink_sections];
  36. cpu : cpu_arm;
  37. unit_env : '';
  38. extradefines : '';
  39. exeext : '';
  40. defext : '.def';
  41. scriptext : '.sh';
  42. smartext : '.sl';
  43. unitext : '.ppu';
  44. unitlibext : '.ppl';
  45. asmext : '.s';
  46. objext : '.o';
  47. resext : '.res';
  48. resobjext : '.or';
  49. sharedlibext : '.so';
  50. staticlibext : '.a';
  51. staticlibprefix : 'libp';
  52. sharedlibprefix : 'lib';
  53. sharedClibext : '.so';
  54. staticClibext : '.a';
  55. staticClibprefix : 'lib';
  56. sharedClibprefix : 'lib';
  57. importlibprefix : 'libimp';
  58. importlibext : '.a';
  59. Cprefix : '';
  60. newline : #10;
  61. dirsep : '/';
  62. assem : as_gas;
  63. assemextern : as_gas;
  64. link : ld_none;
  65. linkextern : ld_embedded;
  66. ar : ar_gnu_ar;
  67. res : res_none;
  68. dbg : dbg_dwarf2;
  69. script : script_unix;
  70. endian : endian_little;
  71. alignment :
  72. (
  73. procalign : 4;
  74. loopalign : 4;
  75. jumpalign : 0;
  76. jumpalignskipmax : 0;
  77. coalescealign : 0;
  78. coalescealignskipmax: 0;
  79. constalignmin : 0;
  80. constalignmax : 4;
  81. varalignmin : 0;
  82. varalignmax : 4;
  83. localalignmin : 4;
  84. localalignmax : 4;
  85. recordalignmin : 0;
  86. recordalignmax : 4;
  87. maxCrecordalign : 4
  88. );
  89. first_parm_offset : 8;
  90. stacksize : 262144;
  91. stackalign : 4;
  92. abi : abi_default;
  93. llvmdatalayout : 'e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32-S32';
  94. );
  95. system_avr_embedded_info : tsysteminfo =
  96. (
  97. system : system_avr_embedded;
  98. name : 'Embedded';
  99. shortname : 'embedded';
  100. flags : [tf_needs_symbol_size,tf_files_case_sensitive,
  101. tf_smartlink_sections];
  102. cpu : cpu_avr;
  103. unit_env : '';
  104. extradefines : '';
  105. exeext : '';
  106. defext : '.def';
  107. scriptext : '.sh';
  108. smartext : '.sl';
  109. unitext : '.ppu';
  110. unitlibext : '.ppl';
  111. asmext : '.s';
  112. objext : '.o';
  113. resext : '.res';
  114. resobjext : '.or';
  115. sharedlibext : '.so';
  116. staticlibext : '.a';
  117. staticlibprefix : 'libp';
  118. sharedlibprefix : 'lib';
  119. sharedClibext : '.so';
  120. staticClibext : '.a';
  121. staticClibprefix : 'lib';
  122. sharedClibprefix : 'lib';
  123. importlibprefix : 'libimp';
  124. importlibext : '.a';
  125. Cprefix : '';
  126. newline : #10;
  127. dirsep : '/';
  128. assem : as_gas;
  129. assemextern : as_gas;
  130. link : ld_none;
  131. linkextern : ld_embedded;
  132. ar : ar_gnu_ar;
  133. res : res_none;
  134. dbg : dbg_dwarf3;
  135. script : script_unix;
  136. endian : endian_little;
  137. alignment :
  138. (
  139. procalign : 1;
  140. loopalign : 1;
  141. jumpalign : 0;
  142. jumpalignskipmax : 0;
  143. coalescealign : 0;
  144. coalescealignskipmax: 0;
  145. constalignmin : 0;
  146. constalignmax : 1;
  147. varalignmin : 0;
  148. varalignmax : 1;
  149. localalignmin : 0;
  150. localalignmax : 1;
  151. recordalignmin : 0;
  152. recordalignmax : 1;
  153. maxCrecordalign : 1
  154. );
  155. first_parm_offset : 0;
  156. stacksize : 1024;
  157. stackalign : 1;
  158. abi : abi_default;
  159. llvmdatalayout : 'todo';
  160. );
  161. system_mipsel_embedded_info : tsysteminfo =
  162. (
  163. system : system_mipsel_embedded;
  164. name : 'Embedded';
  165. shortname : 'embedded';
  166. flags : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,
  167. tf_smartlink_sections];
  168. cpu : cpu_mipsel;
  169. unit_env : '';
  170. extradefines : '';
  171. exeext : '';
  172. defext : '.def';
  173. scriptext : '.sh';
  174. smartext : '.sl';
  175. unitext : '.ppu';
  176. unitlibext : '.ppl';
  177. asmext : '.s';
  178. objext : '.o';
  179. resext : '.res';
  180. resobjext : '.or';
  181. sharedlibext : '.so';
  182. staticlibext : '.a';
  183. staticlibprefix : 'libp';
  184. sharedlibprefix : 'lib';
  185. sharedClibext : '.so';
  186. staticClibext : '.a';
  187. staticClibprefix : 'lib';
  188. sharedClibprefix : 'lib';
  189. importlibprefix : 'libimp';
  190. importlibext : '.a';
  191. Cprefix : '';
  192. newline : #10;
  193. dirsep : '/';
  194. assem : as_gas;
  195. assemextern : as_gas;
  196. link : ld_none;
  197. linkextern : ld_embedded;
  198. ar : ar_gnu_ar;
  199. res : res_none;
  200. dbg : dbg_dwarf2;
  201. script : script_unix;
  202. endian : endian_little;
  203. alignment :
  204. (
  205. procalign : 4;
  206. loopalign : 4;
  207. jumpalign : 0;
  208. jumpalignskipmax : 0;
  209. coalescealign : 0;
  210. coalescealignskipmax: 0;
  211. constalignmin : 0;
  212. constalignmax : 4;
  213. varalignmin : 0;
  214. varalignmax : 4;
  215. localalignmin : 4;
  216. localalignmax : 8;
  217. recordalignmin : 0;
  218. recordalignmax : 8;
  219. maxCrecordalign : 4
  220. );
  221. first_parm_offset : 0;
  222. stacksize : 262144;
  223. stackalign : 8;
  224. abi : abi_default;
  225. llvmdatalayout : 'todo';
  226. );
  227. system_i386_embedded_info : tsysteminfo =
  228. (
  229. system : system_i386_embedded;
  230. name : 'Embedded';
  231. shortname : 'embedded';
  232. flags : [tf_needs_symbol_size,tf_files_case_sensitive,
  233. tf_smartlink_sections];
  234. cpu : cpu_i386;
  235. unit_env : '';
  236. extradefines : '';
  237. exeext : '';
  238. defext : '.def';
  239. scriptext : '.sh';
  240. smartext : '.sl';
  241. unitext : '.ppu';
  242. unitlibext : '.ppl';
  243. asmext : '.s';
  244. objext : '.o';
  245. resext : '.res';
  246. resobjext : '.or';
  247. sharedlibext : '.so';
  248. staticlibext : '.a';
  249. staticlibprefix : 'libp';
  250. sharedlibprefix : 'lib';
  251. sharedClibext : '.so';
  252. staticClibext : '.a';
  253. staticClibprefix : 'lib';
  254. sharedClibprefix : 'lib';
  255. importlibprefix : 'libimp';
  256. importlibext : '.a';
  257. Cprefix : '';
  258. newline : #10;
  259. dirsep : '/';
  260. assem : as_i386_elf32;
  261. assemextern : as_gas;
  262. link : ld_none;
  263. linkextern : ld_embedded;
  264. ar : ar_gnu_ar;
  265. res : res_none;
  266. dbg : dbg_stabs;
  267. script : script_unix;
  268. endian : endian_little;
  269. alignment :
  270. (
  271. procalign : 16;
  272. loopalign : 4;
  273. jumpalign : 0;
  274. jumpalignskipmax : 0;
  275. coalescealign : 0;
  276. coalescealignskipmax: 0;
  277. constalignmin : 0;
  278. constalignmax : 16;
  279. varalignmin : 0;
  280. varalignmax : 16;
  281. localalignmin : 4;
  282. localalignmax : 8;
  283. recordalignmin : 0;
  284. recordalignmax : 16;
  285. maxCrecordalign : 4
  286. );
  287. first_parm_offset : 8;
  288. stacksize : 4096;
  289. stackalign : 4;
  290. abi : abi_default;
  291. llvmdatalayout : 'e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S32';
  292. );
  293. system_x86_64_embedded_info : tsysteminfo =
  294. (
  295. system : system_x86_64_embedded;
  296. name : 'Embedded';
  297. shortname : 'embedded';
  298. flags : [tf_needs_symbol_size,tf_files_case_sensitive,
  299. tf_smartlink_sections];
  300. cpu : cpu_x86_64;
  301. unit_env : '';
  302. extradefines : '';
  303. exeext : '';
  304. defext : '.def';
  305. scriptext : '.sh';
  306. smartext : '.sl';
  307. unitext : '.ppu';
  308. unitlibext : '.ppl';
  309. asmext : '.s';
  310. objext : '.o';
  311. resext : '.res';
  312. resobjext : '.or';
  313. sharedlibext : '.so';
  314. staticlibext : '.a';
  315. staticlibprefix : 'libp';
  316. sharedlibprefix : 'lib';
  317. sharedClibext : '.so';
  318. staticClibext : '.a';
  319. staticClibprefix : 'lib';
  320. sharedClibprefix : 'lib';
  321. importlibprefix : 'libimp';
  322. importlibext : '.a';
  323. Cprefix : '';
  324. newline : #10;
  325. dirsep : '/';
  326. assem : as_x86_64_elf64;
  327. assemextern : as_gas;
  328. link : ld_none;
  329. linkextern : ld_embedded;
  330. ar : ar_gnu_ar;
  331. res : res_none;
  332. dbg : dbg_stabs;
  333. script : script_unix;
  334. endian : endian_little;
  335. alignment :
  336. (
  337. procalign : 16;
  338. loopalign : 8;
  339. jumpalign : 0;
  340. jumpalignskipmax : 0;
  341. coalescealign : 0;
  342. coalescealignskipmax: 0;
  343. constalignmin : 0;
  344. constalignmax : 16;
  345. varalignmin : 0;
  346. varalignmax : 16;
  347. localalignmin : 4;
  348. localalignmax : 16;
  349. recordalignmin : 0;
  350. recordalignmax : 16;
  351. maxCrecordalign : 16
  352. );
  353. first_parm_offset : 16;
  354. stacksize : 8*1024*1024;
  355. stackalign : 16;
  356. abi : abi_default;
  357. llvmdatalayout : 'e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128';
  358. );
  359. system_i8086_embedded_info : tsysteminfo =
  360. (
  361. system : system_i8086_embedded;
  362. name : 'Embedded';
  363. shortname : 'embedded';
  364. flags : [tf_use_8_3,
  365. {$ifdef I8086_SMARTLINK_SECTIONS}
  366. tf_smartlink_sections,
  367. {$else I8086_SMARTLINK_SECTIONS}
  368. tf_smartlink_library,
  369. tf_no_objectfiles_when_smartlinking,
  370. {$endif I8086_SMARTLINK_SECTIONS}
  371. tf_cld,
  372. tf_no_generic_stackcheck,tf_emit_stklen];
  373. cpu : cpu_i8086;
  374. unit_env : '';
  375. extradefines : '';
  376. exeext : '.exe';
  377. defext : '.def';
  378. scriptext : '.bat';
  379. smartext : '.sl';
  380. unitext : '.ppu';
  381. unitlibext : '.ppl';
  382. asmext : '.s';
  383. objext : '.o';
  384. resext : '.res';
  385. resobjext : '.or';
  386. sharedlibext : '.dll';
  387. staticlibext : '.a';
  388. staticlibprefix : '';
  389. sharedlibprefix : '';
  390. sharedClibext : '.dll';
  391. staticClibext : '.a';
  392. staticClibprefix : 'lib';
  393. sharedClibprefix : '';
  394. importlibprefix : '';
  395. importlibext : '.al';
  396. Cprefix : '_';
  397. newline : #13#10;
  398. dirsep : '\';
  399. assem : as_i8086_omf;
  400. assemextern : as_i8086_nasmobj;
  401. link : ld_int_msdos;
  402. linkextern : ld_msdos;
  403. {$ifdef USE_SCRIPTED_WLIB}
  404. ar : ar_watcom_wlib_omf_scripted;
  405. {$else}
  406. ar : ar_watcom_wlib_omf;
  407. {$endif}
  408. res : res_none;
  409. dbg : dbg_dwarf2;
  410. script : script_dos;
  411. endian : endian_little;
  412. alignment :
  413. (
  414. procalign : 1;
  415. loopalign : 1;
  416. jumpalign : 0;
  417. jumpalignskipmax : 0;
  418. coalescealign : 0;
  419. coalescealignskipmax: 0;
  420. constalignmin : 0;
  421. constalignmax : 2;
  422. varalignmin : 0;
  423. varalignmax : 2;
  424. localalignmin : 0;
  425. localalignmax : 2;
  426. recordalignmin : 0;
  427. recordalignmax : 2;
  428. maxCrecordalign : 2
  429. );
  430. first_parm_offset : 4;
  431. stacksize : 0;
  432. stackalign : 2;
  433. abi : abi_default;
  434. llvmdatalayout : 'todo';
  435. );
  436. system_m68k_embedded_info : tsysteminfo =
  437. (
  438. system : system_m68k_embedded;
  439. name : 'Embedded';
  440. shortname : 'embedded';
  441. flags : [tf_under_development,tf_needs_symbol_size,tf_files_case_sensitive,tf_requires_proper_alignment,
  442. tf_smartlink_sections];
  443. cpu : cpu_m68k;
  444. unit_env : '';
  445. extradefines : '';
  446. exeext : '';
  447. defext : '.def';
  448. scriptext : '.sh';
  449. smartext : '.sl';
  450. unitext : '.ppu';
  451. unitlibext : '.ppl';
  452. asmext : '.s';
  453. objext : '.o';
  454. resext : '.res';
  455. resobjext : '.or';
  456. sharedlibext : '.so';
  457. staticlibext : '.a';
  458. staticlibprefix : 'libp';
  459. sharedlibprefix : 'lib';
  460. sharedClibext : '.so';
  461. staticClibext : '.a';
  462. staticClibprefix : 'lib';
  463. sharedClibprefix : 'lib';
  464. importlibprefix : 'libimp';
  465. importlibext : '.a';
  466. Cprefix : '';
  467. newline : #10;
  468. dirsep : '/';
  469. assem : as_gas;
  470. assemextern : as_gas;
  471. link : ld_none;
  472. linkextern : ld_embedded;
  473. ar : ar_gnu_ar;
  474. res : res_none;
  475. dbg : dbg_dwarf2;
  476. script : script_unix;
  477. endian : endian_big;
  478. alignment :
  479. (
  480. procalign : 4;
  481. loopalign : 4;
  482. jumpalign : 0;
  483. jumpalignskipmax : 0;
  484. coalescealign : 0;
  485. coalescealignskipmax: 0;
  486. constalignmin : 0;
  487. constalignmax : 4;
  488. varalignmin : 0;
  489. varalignmax : 4;
  490. localalignmin : 4;
  491. localalignmax : 4;
  492. recordalignmin : 0;
  493. recordalignmax : 4;
  494. maxCrecordalign : 4
  495. );
  496. first_parm_offset : 8;
  497. stacksize : 32768;
  498. stackalign : 4;
  499. abi : abi_default;
  500. llvmdatalayout : 'TODO';
  501. );
  502. implementation
  503. initialization
  504. {$ifdef CPUARM}
  505. {$ifdef embedded}
  506. set_source_info(system_arm_embedded_info);
  507. {$endif embedded}
  508. {$endif CPUARM}
  509. {$ifdef CPUAVR}
  510. {$ifdef embedded}
  511. set_source_info(system_avr_embedded_info);
  512. {$endif embedded}
  513. {$endif CPUAVR}
  514. {$ifdef CPUMIPSEL}
  515. {$ifdef embedded}
  516. set_source_info(system_mipsel_embedded_info);
  517. {$endif embedded}
  518. {$endif CPUMIPSEL}
  519. {$ifdef CPUI386}
  520. {$ifdef embedded}
  521. set_source_info(system_i386_embedded_info);
  522. {$endif embedded}
  523. {$endif CPUI386}
  524. {$ifdef CPUX86_64}
  525. {$ifdef embedded}
  526. set_source_info(system_x86_64_embedded_info);
  527. {$endif embedded}
  528. {$endif CPUX86_64}
  529. {$ifdef cpu8086}
  530. {$ifdef embedded}
  531. set_source_info(system_i8086_embedded_info);
  532. {$endif embedded}
  533. {$endif cpu8086}
  534. {$ifdef cpum68k}
  535. {$ifdef embedded}
  536. set_source_info(system_m68k_embedded_info);
  537. {$endif embedded}
  538. {$endif cpum68k}
  539. end.