i_embed.pas 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  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. constalignmin : 0;
  77. constalignmax : 4;
  78. varalignmin : 0;
  79. varalignmax : 4;
  80. localalignmin : 4;
  81. localalignmax : 4;
  82. recordalignmin : 0;
  83. recordalignmax : 4;
  84. maxCrecordalign : 4
  85. );
  86. first_parm_offset : 8;
  87. stacksize : 262144;
  88. stackalign : 4;
  89. abi : abi_default;
  90. 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';
  91. );
  92. system_avr_embedded_info : tsysteminfo =
  93. (
  94. system : system_avr_embedded;
  95. name : 'Embedded';
  96. shortname : 'embedded';
  97. flags : [tf_needs_symbol_size,tf_files_case_sensitive,
  98. tf_smartlink_sections];
  99. cpu : cpu_avr;
  100. unit_env : '';
  101. extradefines : '';
  102. exeext : '';
  103. defext : '.def';
  104. scriptext : '.sh';
  105. smartext : '.sl';
  106. unitext : '.ppu';
  107. unitlibext : '.ppl';
  108. asmext : '.s';
  109. objext : '.o';
  110. resext : '.res';
  111. resobjext : '.or';
  112. sharedlibext : '.so';
  113. staticlibext : '.a';
  114. staticlibprefix : 'libp';
  115. sharedlibprefix : 'lib';
  116. sharedClibext : '.so';
  117. staticClibext : '.a';
  118. staticClibprefix : 'lib';
  119. sharedClibprefix : 'lib';
  120. importlibprefix : 'libimp';
  121. importlibext : '.a';
  122. Cprefix : '';
  123. newline : #10;
  124. dirsep : '/';
  125. assem : as_gas;
  126. assemextern : as_gas;
  127. link : ld_none;
  128. linkextern : ld_embedded;
  129. ar : ar_gnu_ar;
  130. res : res_none;
  131. dbg : dbg_dwarf3;
  132. script : script_unix;
  133. endian : endian_little;
  134. alignment :
  135. (
  136. procalign : 1;
  137. loopalign : 1;
  138. jumpalign : 0;
  139. constalignmin : 0;
  140. constalignmax : 1;
  141. varalignmin : 0;
  142. varalignmax : 1;
  143. localalignmin : 0;
  144. localalignmax : 1;
  145. recordalignmin : 0;
  146. recordalignmax : 1;
  147. maxCrecordalign : 1
  148. );
  149. first_parm_offset : 0;
  150. stacksize : 1024;
  151. stackalign : 1;
  152. abi : abi_default;
  153. llvmdatalayout : 'todo';
  154. );
  155. system_mipsel_embedded_info : tsysteminfo =
  156. (
  157. system : system_mipsel_embedded;
  158. name : 'Embedded';
  159. shortname : 'embedded';
  160. flags : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,
  161. tf_smartlink_sections];
  162. cpu : cpu_mipsel;
  163. unit_env : '';
  164. extradefines : '';
  165. exeext : '';
  166. defext : '.def';
  167. scriptext : '.sh';
  168. smartext : '.sl';
  169. unitext : '.ppu';
  170. unitlibext : '.ppl';
  171. asmext : '.s';
  172. objext : '.o';
  173. resext : '.res';
  174. resobjext : '.or';
  175. sharedlibext : '.so';
  176. staticlibext : '.a';
  177. staticlibprefix : 'libp';
  178. sharedlibprefix : 'lib';
  179. sharedClibext : '.so';
  180. staticClibext : '.a';
  181. staticClibprefix : 'lib';
  182. sharedClibprefix : 'lib';
  183. importlibprefix : 'libimp';
  184. importlibext : '.a';
  185. Cprefix : '';
  186. newline : #10;
  187. dirsep : '/';
  188. assem : as_gas;
  189. assemextern : as_gas;
  190. link : ld_none;
  191. linkextern : ld_embedded;
  192. ar : ar_gnu_ar;
  193. res : res_none;
  194. dbg : dbg_dwarf2;
  195. script : script_unix;
  196. endian : endian_little;
  197. alignment :
  198. (
  199. procalign : 4;
  200. loopalign : 4;
  201. jumpalign : 0;
  202. constalignmin : 0;
  203. constalignmax : 4;
  204. varalignmin : 0;
  205. varalignmax : 4;
  206. localalignmin : 4;
  207. localalignmax : 8;
  208. recordalignmin : 0;
  209. recordalignmax : 8;
  210. maxCrecordalign : 4
  211. );
  212. first_parm_offset : 0;
  213. stacksize : 262144;
  214. stackalign : 8;
  215. abi : abi_default;
  216. llvmdatalayout : 'todo';
  217. );
  218. system_i386_embedded_info : tsysteminfo =
  219. (
  220. system : system_i386_embedded;
  221. name : 'Embedded';
  222. shortname : 'embedded';
  223. flags : [tf_needs_symbol_size,tf_files_case_sensitive,
  224. tf_smartlink_sections];
  225. cpu : cpu_i386;
  226. unit_env : '';
  227. extradefines : '';
  228. exeext : '';
  229. defext : '.def';
  230. scriptext : '.sh';
  231. smartext : '.sl';
  232. unitext : '.ppu';
  233. unitlibext : '.ppl';
  234. asmext : '.s';
  235. objext : '.o';
  236. resext : '.res';
  237. resobjext : '.or';
  238. sharedlibext : '.so';
  239. staticlibext : '.a';
  240. staticlibprefix : 'libp';
  241. sharedlibprefix : 'lib';
  242. sharedClibext : '.so';
  243. staticClibext : '.a';
  244. staticClibprefix : 'lib';
  245. sharedClibprefix : 'lib';
  246. importlibprefix : 'libimp';
  247. importlibext : '.a';
  248. Cprefix : '';
  249. newline : #10;
  250. dirsep : '/';
  251. assem : as_i386_elf32;
  252. assemextern : as_gas;
  253. link : ld_none;
  254. linkextern : ld_embedded;
  255. ar : ar_gnu_ar;
  256. res : res_none;
  257. dbg : dbg_stabs;
  258. script : script_unix;
  259. endian : endian_little;
  260. alignment :
  261. (
  262. procalign : 16;
  263. loopalign : 4;
  264. jumpalign : 0;
  265. constalignmin : 0;
  266. constalignmax : 16;
  267. varalignmin : 0;
  268. varalignmax : 16;
  269. localalignmin : 4;
  270. localalignmax : 8;
  271. recordalignmin : 0;
  272. recordalignmax : 16;
  273. maxCrecordalign : 4
  274. );
  275. first_parm_offset : 8;
  276. stacksize : 4096;
  277. stackalign : 4;
  278. abi : abi_default;
  279. 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';
  280. );
  281. system_x86_64_embedded_info : tsysteminfo =
  282. (
  283. system : system_x86_64_embedded;
  284. name : 'Embedded';
  285. shortname : 'embedded';
  286. flags : [tf_needs_symbol_size,tf_files_case_sensitive,
  287. tf_smartlink_sections];
  288. cpu : cpu_x86_64;
  289. unit_env : '';
  290. extradefines : '';
  291. exeext : '';
  292. defext : '.def';
  293. scriptext : '.sh';
  294. smartext : '.sl';
  295. unitext : '.ppu';
  296. unitlibext : '.ppl';
  297. asmext : '.s';
  298. objext : '.o';
  299. resext : '.res';
  300. resobjext : '.or';
  301. sharedlibext : '.so';
  302. staticlibext : '.a';
  303. staticlibprefix : 'libp';
  304. sharedlibprefix : 'lib';
  305. sharedClibext : '.so';
  306. staticClibext : '.a';
  307. staticClibprefix : 'lib';
  308. sharedClibprefix : 'lib';
  309. importlibprefix : 'libimp';
  310. importlibext : '.a';
  311. Cprefix : '';
  312. newline : #10;
  313. dirsep : '/';
  314. assem : as_x86_64_elf64;
  315. assemextern : as_gas;
  316. link : ld_none;
  317. linkextern : ld_embedded;
  318. ar : ar_gnu_ar;
  319. res : res_none;
  320. dbg : dbg_stabs;
  321. script : script_unix;
  322. endian : endian_little;
  323. alignment :
  324. (
  325. procalign : 16;
  326. loopalign : 8;
  327. jumpalign : 0;
  328. constalignmin : 0;
  329. constalignmax : 16;
  330. varalignmin : 0;
  331. varalignmax : 16;
  332. localalignmin : 4;
  333. localalignmax : 16;
  334. recordalignmin : 0;
  335. recordalignmax : 16;
  336. maxCrecordalign : 16
  337. );
  338. first_parm_offset : 16;
  339. stacksize : 8*1024*1024;
  340. stackalign : 16;
  341. abi : abi_default;
  342. 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';
  343. );
  344. system_i8086_embedded_info : tsysteminfo =
  345. (
  346. system : system_i8086_embedded;
  347. name : 'Embedded';
  348. shortname : 'embedded';
  349. flags : [tf_use_8_3,
  350. {$ifdef I8086_SMARTLINK_SECTIONS}
  351. tf_smartlink_sections,
  352. {$else I8086_SMARTLINK_SECTIONS}
  353. tf_smartlink_library,
  354. tf_no_objectfiles_when_smartlinking,
  355. {$endif I8086_SMARTLINK_SECTIONS}
  356. tf_cld,
  357. tf_no_generic_stackcheck,tf_emit_stklen];
  358. cpu : cpu_i8086;
  359. unit_env : '';
  360. extradefines : '';
  361. exeext : '.exe';
  362. defext : '.def';
  363. scriptext : '.bat';
  364. smartext : '.sl';
  365. unitext : '.ppu';
  366. unitlibext : '.ppl';
  367. asmext : '.s';
  368. objext : '.o';
  369. resext : '.res';
  370. resobjext : '.or';
  371. sharedlibext : '.dll';
  372. staticlibext : '.a';
  373. staticlibprefix : '';
  374. sharedlibprefix : '';
  375. sharedClibext : '.dll';
  376. staticClibext : '.a';
  377. staticClibprefix : 'lib';
  378. sharedClibprefix : '';
  379. importlibprefix : '';
  380. importlibext : '.al';
  381. Cprefix : '_';
  382. newline : #13#10;
  383. dirsep : '\';
  384. assem : as_i8086_omf;
  385. assemextern : as_i8086_nasmobj;
  386. link : ld_int_msdos;
  387. linkextern : ld_msdos;
  388. {$ifdef USE_SCRIPTED_WLIB}
  389. ar : ar_watcom_wlib_omf_scripted;
  390. {$else}
  391. ar : ar_watcom_wlib_omf;
  392. {$endif}
  393. res : res_none;
  394. dbg : dbg_dwarf2;
  395. script : script_dos;
  396. endian : endian_little;
  397. alignment :
  398. (
  399. procalign : 1;
  400. loopalign : 1;
  401. jumpalign : 0;
  402. constalignmin : 0;
  403. constalignmax : 2;
  404. varalignmin : 0;
  405. varalignmax : 2;
  406. localalignmin : 0;
  407. localalignmax : 2;
  408. recordalignmin : 0;
  409. recordalignmax : 2;
  410. maxCrecordalign : 2
  411. );
  412. first_parm_offset : 4;
  413. stacksize : 0;
  414. stackalign : 2;
  415. abi : abi_default;
  416. llvmdatalayout : 'todo';
  417. );
  418. system_m68k_embedded_info : tsysteminfo =
  419. (
  420. system : system_m68k_embedded;
  421. name : 'Embedded';
  422. shortname : 'embedded';
  423. flags : [tf_under_development,tf_needs_symbol_size,tf_files_case_sensitive,tf_requires_proper_alignment,
  424. tf_smartlink_sections];
  425. cpu : cpu_m68k;
  426. unit_env : '';
  427. extradefines : '';
  428. exeext : '';
  429. defext : '.def';
  430. scriptext : '.sh';
  431. smartext : '.sl';
  432. unitext : '.ppu';
  433. unitlibext : '.ppl';
  434. asmext : '.s';
  435. objext : '.o';
  436. resext : '.res';
  437. resobjext : '.or';
  438. sharedlibext : '.so';
  439. staticlibext : '.a';
  440. staticlibprefix : 'libp';
  441. sharedlibprefix : 'lib';
  442. sharedClibext : '.so';
  443. staticClibext : '.a';
  444. staticClibprefix : 'lib';
  445. sharedClibprefix : 'lib';
  446. importlibprefix : 'libimp';
  447. importlibext : '.a';
  448. Cprefix : '';
  449. newline : #10;
  450. dirsep : '/';
  451. assem : as_gas;
  452. assemextern : as_gas;
  453. link : ld_none;
  454. linkextern : ld_embedded;
  455. ar : ar_gnu_ar;
  456. res : res_none;
  457. dbg : dbg_dwarf2;
  458. script : script_unix;
  459. endian : endian_big;
  460. alignment :
  461. (
  462. procalign : 4;
  463. loopalign : 4;
  464. jumpalign : 0;
  465. constalignmin : 0;
  466. constalignmax : 4;
  467. varalignmin : 0;
  468. varalignmax : 4;
  469. localalignmin : 4;
  470. localalignmax : 4;
  471. recordalignmin : 0;
  472. recordalignmax : 4;
  473. maxCrecordalign : 4
  474. );
  475. first_parm_offset : 8;
  476. stacksize : 32768;
  477. stackalign : 4;
  478. abi : abi_default;
  479. llvmdatalayout : 'TODO';
  480. );
  481. implementation
  482. initialization
  483. {$ifdef CPUARM}
  484. {$ifdef embedded}
  485. set_source_info(system_arm_embedded_info);
  486. {$endif embedded}
  487. {$endif CPUARM}
  488. {$ifdef CPUAVR}
  489. {$ifdef embedded}
  490. set_source_info(system_avr_embedded_info);
  491. {$endif embedded}
  492. {$endif CPUAVR}
  493. {$ifdef CPUMIPSEL}
  494. {$ifdef embedded}
  495. set_source_info(system_mipsel_embedded_info);
  496. {$endif embedded}
  497. {$endif CPUMIPSEL}
  498. {$ifdef CPUI386}
  499. {$ifdef embedded}
  500. set_source_info(system_i386_embedded_info);
  501. {$endif embedded}
  502. {$endif CPUI386}
  503. {$ifdef CPUX86_64}
  504. {$ifdef embedded}
  505. set_source_info(system_x86_64_embedded_info);
  506. {$endif embedded}
  507. {$endif CPUX86_64}
  508. {$ifdef cpu8086}
  509. {$ifdef embedded}
  510. set_source_info(system_i8086_embedded_info);
  511. {$endif embedded}
  512. {$endif cpu8086}
  513. {$ifdef cpum68k}
  514. {$ifdef embedded}
  515. set_source_info(system_m68k_embedded_info);
  516. {$endif embedded}
  517. {$endif cpum68k}
  518. end.