t_embed.pas 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128
  1. {
  2. Copyright (c) 2005-2017 by Free Pascal Compiler team
  3. This unit implements support import, export, link routines
  4. for the Embedded Target
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit t_embed;
  19. {$i fpcdefs.inc}
  20. interface
  21. implementation
  22. uses
  23. SysUtils,
  24. cutils,cfileutl,cclasses,
  25. globtype,globals,systems,verbose,comphook,cscript,fmodule,i_embed,link,
  26. cpuinfo;
  27. type
  28. TlinkerEmbedded=class(texternallinker)
  29. private
  30. Function WriteResponseFile: Boolean;
  31. public
  32. constructor Create; override;
  33. procedure SetDefaultInfo; override;
  34. function MakeExecutable:boolean; override;
  35. function postprocessexecutable(const fn : string;isdll:boolean):boolean;
  36. end;
  37. { TlinkerEmbedded_SdccSdld - the sdld linker from the SDCC project ( http://sdcc.sourceforge.net/ ) }
  38. TlinkerEmbedded_SdccSdld=class(texternallinker)
  39. private
  40. Function WriteResponseFile: Boolean;
  41. public
  42. { constructor Create; override;}
  43. procedure SetDefaultInfo; override;
  44. function MakeExecutable:boolean; override;
  45. { function postprocessexecutable(const fn : string;isdll:boolean):boolean;}
  46. end;
  47. {*****************************************************************************
  48. TlinkerEmbedded
  49. *****************************************************************************}
  50. Constructor TlinkerEmbedded.Create;
  51. begin
  52. Inherited Create;
  53. SharedLibFiles.doubles:=true;
  54. StaticLibFiles.doubles:=true;
  55. end;
  56. procedure TlinkerEmbedded.SetDefaultInfo;
  57. const
  58. {$ifdef mips}
  59. {$ifdef mipsel}
  60. platform_select='-EL';
  61. {$else}
  62. platform_select='-EB';
  63. {$endif}
  64. {$else}
  65. platform_select='';
  66. {$endif}
  67. begin
  68. with Info do
  69. begin
  70. ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
  71. end;
  72. end;
  73. Function TlinkerEmbedded.WriteResponseFile: Boolean;
  74. Var
  75. linkres : TLinkRes;
  76. i : longint;
  77. HPath : TCmdStrListItem;
  78. s,s1,s2 : TCmdStr;
  79. prtobj,
  80. cprtobj : string[80];
  81. linklibc : boolean;
  82. found1,
  83. found2 : boolean;
  84. {$if defined(ARM)}
  85. LinkStr : string;
  86. {$endif}
  87. begin
  88. WriteResponseFile:=False;
  89. linklibc:=(SharedLibFiles.Find('c')<>nil);
  90. {$if defined(ARM) or defined(i386) or defined(x86_64) or defined(AVR) or defined(MIPSEL) or defined(RISCV32) or defined(XTENSA)}
  91. prtobj:='';
  92. {$else}
  93. prtobj:='prt0';
  94. {$endif}
  95. cprtobj:='cprt0';
  96. if linklibc then
  97. prtobj:=cprtobj;
  98. { Open link.res file }
  99. LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
  100. { Write path to search libraries }
  101. HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);
  102. while assigned(HPath) do
  103. begin
  104. s:=HPath.Str;
  105. if (cs_link_on_target in current_settings.globalswitches) then
  106. s:=ScriptFixFileName(s);
  107. LinkRes.Add('-L'+s);
  108. HPath:=TCmdStrListItem(HPath.Next);
  109. end;
  110. HPath:=TCmdStrListItem(LibrarySearchPath.First);
  111. while assigned(HPath) do
  112. begin
  113. s:=HPath.Str;
  114. if s<>'' then
  115. LinkRes.Add('SEARCH_DIR("'+s+'")');
  116. HPath:=TCmdStrListItem(HPath.Next);
  117. end;
  118. LinkRes.Add('INPUT (');
  119. { add objectfiles, start with prt0 always }
  120. //s:=FindObjectFile('prt0','',false);
  121. if prtobj<>'' then
  122. begin
  123. s:=FindObjectFile(prtobj,'',false);
  124. LinkRes.AddFileName(s);
  125. end;
  126. { try to add crti and crtbegin if linking to C }
  127. if linklibc then
  128. begin
  129. if librarysearchpath.FindFile('crtbegin.o',false,s) then
  130. LinkRes.AddFileName(s);
  131. if librarysearchpath.FindFile('crti.o',false,s) then
  132. LinkRes.AddFileName(s);
  133. end;
  134. while not ObjectFiles.Empty do
  135. begin
  136. s:=ObjectFiles.GetFirst;
  137. if s<>'' then
  138. begin
  139. { vlink doesn't use SEARCH_DIR for object files }
  140. if not(cs_link_on_target in current_settings.globalswitches) then
  141. s:=FindObjectFile(s,'',false);
  142. LinkRes.AddFileName((maybequoted(s)));
  143. end;
  144. end;
  145. { Write staticlibraries }
  146. if not StaticLibFiles.Empty then
  147. begin
  148. { vlink doesn't need, and doesn't support GROUP }
  149. if (cs_link_on_target in current_settings.globalswitches) then
  150. begin
  151. LinkRes.Add(')');
  152. LinkRes.Add('GROUP(');
  153. end;
  154. while not StaticLibFiles.Empty do
  155. begin
  156. S:=StaticLibFiles.GetFirst;
  157. LinkRes.AddFileName((maybequoted(s)));
  158. end;
  159. end;
  160. if (cs_link_on_target in current_settings.globalswitches) then
  161. begin
  162. LinkRes.Add(')');
  163. { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
  164. here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
  165. linklibc:=false;
  166. while not SharedLibFiles.Empty do
  167. begin
  168. S:=SharedLibFiles.GetFirst;
  169. if s<>'c' then
  170. begin
  171. i:=Pos(target_info.sharedlibext,S);
  172. if i>0 then
  173. Delete(S,i,255);
  174. LinkRes.Add('-l'+s);
  175. end
  176. else
  177. begin
  178. LinkRes.Add('-l'+s);
  179. linklibc:=true;
  180. end;
  181. end;
  182. { be sure that libc&libgcc is the last lib }
  183. if linklibc then
  184. begin
  185. LinkRes.Add('-lc');
  186. LinkRes.Add('-lgcc');
  187. end;
  188. end
  189. else
  190. begin
  191. while not SharedLibFiles.Empty do
  192. begin
  193. S:=SharedLibFiles.GetFirst;
  194. LinkRes.Add('lib'+s+target_info.staticlibext);
  195. end;
  196. LinkRes.Add(')');
  197. end;
  198. { objects which must be at the end }
  199. if linklibc then
  200. begin
  201. found1:=librarysearchpath.FindFile('crtend.o',false,s1);
  202. found2:=librarysearchpath.FindFile('crtn.o',false,s2);
  203. if found1 or found2 then
  204. begin
  205. LinkRes.Add('INPUT(');
  206. if found1 then
  207. LinkRes.AddFileName(s1);
  208. if found2 then
  209. LinkRes.AddFileName(s2);
  210. LinkRes.Add(')');
  211. end;
  212. end;
  213. {$ifdef ARM}
  214. case current_settings.controllertype of
  215. ct_none:
  216. begin
  217. end;
  218. ct_lpc810m021fn8,
  219. ct_lpc811m001fdh16,
  220. ct_lpc812m101fdh16,
  221. ct_lpc812m101fd20,
  222. ct_lpc812m101fdh20,
  223. ct_lpc1110fd20,
  224. ct_lpc1111fdh20_002,
  225. ct_lpc1111fhn33_101,
  226. ct_lpc1111fhn33_102,
  227. ct_lpc1111fhn33_103,
  228. ct_lpc1111fhn33_201,
  229. ct_lpc1111fhn33_202,
  230. ct_lpc1111fhn33_203,
  231. ct_lpc1112fd20_102,
  232. ct_lpc1112fdh20_102,
  233. ct_lpc1112fdh28_102,
  234. ct_lpc1112fhn33_101,
  235. ct_lpc1112fhn33_102,
  236. ct_lpc1112fhn33_103,
  237. ct_lpc1112fhn33_201,
  238. ct_lpc1112fhn24_202,
  239. ct_lpc1112fhn33_202,
  240. ct_lpc1112fhn33_203,
  241. ct_lpc1112fhi33_202,
  242. ct_lpc1112fhi33_203,
  243. ct_lpc1113fhn33_201,
  244. ct_lpc1113fhn33_202,
  245. ct_lpc1113fhn33_203,
  246. ct_lpc1113fhn33_301,
  247. ct_lpc1113fhn33_302,
  248. ct_lpc1113fhn33_303,
  249. ct_lpc1113bfd48_301,
  250. ct_lpc1113bfd48_302,
  251. ct_lpc1113bfd48_303,
  252. ct_lpc1114fdh28_102,
  253. ct_lpc1114fn28_102,
  254. ct_lpc1114fhn33_201,
  255. ct_lpc1114fhn33_202,
  256. ct_lpc1114fhn33_203,
  257. ct_lpc1114fhn33_301,
  258. ct_lpc1114fhn33_302,
  259. ct_lpc1114fhn33_303,
  260. ct_lpc1114fhn33_333,
  261. ct_lpc1114fhi33_302,
  262. ct_lpc1114fhi33_303,
  263. ct_lpc1114bfd48_301,
  264. ct_lpc1114bfd48_302,
  265. ct_lpc1114bfd48_303,
  266. ct_lpc1114bfd48_323,
  267. ct_lpc1114bfd48_333,
  268. ct_lpc1115bfd48_303,
  269. ct_lpc11c12fd48_301,
  270. ct_lpc11c14fd48_301,
  271. ct_lpc11c22fd48_301,
  272. ct_lpc11c24fd48_301,
  273. ct_lpc11d24fd48_301,
  274. ct_lpc1224fbd48_101,
  275. ct_lpc1224fbd48_121,
  276. ct_lpc1224fbd64_101,
  277. ct_lpc1224fbd64_121,
  278. ct_lpc1225fbd48_301,
  279. ct_lpc1225fbd48_321,
  280. ct_lpc1225fbd64_301,
  281. ct_lpc1225fbd64_321,
  282. ct_lpc1226fbd48_301,
  283. ct_lpc1226fbd64_301,
  284. ct_lpc1227fbd48_301,
  285. ct_lpc1227fbd64_301,
  286. ct_lpc12d27fbd100_301,
  287. ct_lpc1311fhn33,
  288. ct_lpc1311fhn33_01,
  289. ct_lpc1313fhn33,
  290. ct_lpc1313fhn33_01,
  291. ct_lpc1313fbd48,
  292. ct_lpc1313fbd48_01,
  293. ct_lpc1315fhn33,
  294. ct_lpc1315fbd48,
  295. ct_lpc1316fhn33,
  296. ct_lpc1316fbd48,
  297. ct_lpc1317fhn33,
  298. ct_lpc1317fbd48,
  299. ct_lpc1317fbd64,
  300. ct_lpc1342fhn33,
  301. ct_lpc1342fbd48,
  302. ct_lpc1343fhn33,
  303. ct_lpc1343fbd48,
  304. ct_lpc1345fhn33,
  305. ct_lpc1345fbd48,
  306. ct_lpc1346fhn33,
  307. ct_lpc1346fbd48,
  308. ct_lpc1347fhn33,
  309. ct_lpc1347fbd48,
  310. ct_lpc1347fbd64,
  311. ct_lpc2114,
  312. ct_lpc2124,
  313. ct_lpc2194,
  314. ct_lpc1768,
  315. ct_at91sam7s256,
  316. ct_at91sam7se256,
  317. ct_at91sam7x256,
  318. ct_at91sam7xc256,
  319. ct_stm32f030c6,
  320. ct_stm32f030c8,
  321. ct_stm32f030f4,
  322. ct_stm32f030k6,
  323. ct_stm32f030r8,
  324. ct_stm32f050c4,
  325. ct_stm32f050c6,
  326. ct_stm32f050f4,
  327. ct_stm32f050f6,
  328. ct_stm32f050g4,
  329. ct_stm32f050g6,
  330. ct_stm32f050k4,
  331. ct_stm32f050k6,
  332. ct_stm32f051c4,
  333. ct_stm32f051c6,
  334. ct_stm32f051c8,
  335. ct_stm32f051k4,
  336. ct_stm32f051k6,
  337. ct_stm32f051k8,
  338. ct_stm32f051r4,
  339. ct_stm32f051r6,
  340. ct_stm32f051r8,
  341. ct_stm32f091cc,
  342. ct_stm32f091cb,
  343. ct_stm32f091rc,
  344. ct_stm32f091rb,
  345. ct_stm32f091vc,
  346. ct_stm32f091vb,
  347. ct_stm32f100x4,
  348. ct_stm32f100x6,
  349. ct_stm32f100x8,
  350. ct_stm32f100xB,
  351. ct_stm32f100xC,
  352. ct_stm32f100xD,
  353. ct_stm32f100xE,
  354. ct_stm32f101x4,
  355. ct_stm32f101x6,
  356. ct_stm32f101x8,
  357. ct_stm32f101xB,
  358. ct_stm32f101xC,
  359. ct_stm32f101xD,
  360. ct_stm32f101xE,
  361. ct_stm32f101xF,
  362. ct_stm32f101xG,
  363. ct_stm32f102x4,
  364. ct_stm32f102x6,
  365. ct_stm32f102x8,
  366. ct_stm32f102xB,
  367. ct_stm32f103x4,
  368. ct_stm32f103x6,
  369. ct_stm32f103x8,
  370. ct_stm32f103xB,
  371. ct_stm32f103xC,
  372. ct_stm32f103xD,
  373. ct_stm32f103xE,
  374. ct_stm32f103xF,
  375. ct_stm32f103xG,
  376. ct_stm32f107x8,
  377. ct_stm32f107xB,
  378. ct_stm32f107xC,
  379. ct_stm32f105r8,
  380. ct_stm32f105rb,
  381. ct_stm32f105rc,
  382. ct_stm32f105v8,
  383. ct_stm32f105vb,
  384. ct_stm32f105vc,
  385. ct_stm32f107rb,
  386. ct_stm32f107rc,
  387. ct_stm32f107vb,
  388. ct_stm32f107vc,
  389. ct_stm32f401cb,
  390. ct_stm32f401rb,
  391. ct_stm32f401vb,
  392. ct_stm32f401cc,
  393. ct_stm32f401rc,
  394. ct_stm32f401vc,
  395. ct_discoveryf401vc,
  396. ct_stm32f401cd,
  397. ct_stm32f401rd,
  398. ct_stm32f401vd,
  399. ct_stm32f401ce,
  400. ct_stm32f401re,
  401. ct_nucleof401re,
  402. ct_stm32f401ve,
  403. ct_stm32f407vg,
  404. ct_discoveryf407vg,
  405. ct_stm32f407ig,
  406. ct_stm32f407zg,
  407. ct_stm32f407ve,
  408. ct_stm32f407ze,
  409. ct_stm32f407ie,
  410. ct_stm32f411cc,
  411. ct_stm32f411rc,
  412. ct_stm32f411vc,
  413. ct_stm32f411ce,
  414. ct_stm32f411re,
  415. ct_nucleof411re,
  416. ct_stm32f411ve,
  417. ct_discoveryf411ve,
  418. ct_stm32f429vg,
  419. ct_stm32f429zg,
  420. ct_stm32f429ig,
  421. ct_stm32f429vi,
  422. ct_stm32f429zi,
  423. ct_discoveryf429zi,
  424. ct_stm32f429ii,
  425. ct_stm32f429ve,
  426. ct_stm32f429ze,
  427. ct_stm32f429ie,
  428. ct_stm32f429bg,
  429. ct_stm32f429bi,
  430. ct_stm32f429be,
  431. ct_stm32f429ng,
  432. ct_stm32f429ni,
  433. ct_stm32f429ne,
  434. ct_stm32f446mc,
  435. ct_stm32f446rc,
  436. ct_stm32f446vc,
  437. ct_stm32f446zc,
  438. ct_stm32f446me,
  439. ct_stm32f446re,
  440. ct_nucleof446re,
  441. ct_stm32f446ve,
  442. ct_stm32f446ze,
  443. ct_stm32f745xe,
  444. ct_stm32f745xg,
  445. ct_stm32f746xe,
  446. ct_stm32f746xg,
  447. ct_stm32f756xe,
  448. ct_stm32f756xg,
  449. { TI - 64 K Flash, 16 K SRAM Devices }
  450. ct_lm3s1110,
  451. ct_lm3s1133,
  452. ct_lm3s1138,
  453. ct_lm3s1150,
  454. ct_lm3s1162,
  455. ct_lm3s1165,
  456. ct_lm3s1166,
  457. ct_lm3s2110,
  458. ct_lm3s2139,
  459. ct_lm3s6100,
  460. ct_lm3s6110,
  461. { TI 128 K Flash, 32 K SRAM devices - Fury Class }
  462. ct_lm3s1601,
  463. ct_lm3s1608,
  464. ct_lm3s1620,
  465. ct_lm3s1635,
  466. ct_lm3s1636,
  467. ct_lm3s1637,
  468. ct_lm3s1651,
  469. ct_lm3s2601,
  470. ct_lm3s2608,
  471. ct_lm3s2620,
  472. ct_lm3s2637,
  473. ct_lm3s2651,
  474. ct_lm3s6610,
  475. ct_lm3s6611,
  476. ct_lm3s6618,
  477. ct_lm3s6633,
  478. ct_lm3s6637,
  479. ct_lm3s8630,
  480. { TI 256 K Flase, 32 K SRAM devices - Fury Class }
  481. ct_lm3s1911,
  482. ct_lm3s1918,
  483. ct_lm3s1937,
  484. ct_lm3s1958,
  485. ct_lm3s1960,
  486. ct_lm3s1968,
  487. ct_lm3s1969,
  488. ct_lm3s2911,
  489. ct_lm3s2918,
  490. ct_lm3s2919,
  491. ct_lm3s2939,
  492. ct_lm3s2948,
  493. ct_lm3s2950,
  494. ct_lm3s2965,
  495. ct_lm3s6911,
  496. ct_lm3s6918,
  497. ct_lm3s6938,
  498. ct_lm3s6950,
  499. ct_lm3s6952,
  500. ct_lm3s6965,
  501. ct_lm3s8930,
  502. ct_lm3s8933,
  503. ct_lm3s8938,
  504. ct_lm3s8962,
  505. ct_lm3s8970,
  506. ct_lm3s8971,
  507. { TI - Tempest Tempest - 256 K Flash, 64 K SRAM }
  508. ct_lm3s5951,
  509. ct_lm3s5956,
  510. ct_lm3s1b21,
  511. ct_lm3s2b93,
  512. ct_lm3s5b91,
  513. ct_lm3s9b81,
  514. ct_lm3s9b90,
  515. ct_lm3s9b92,
  516. ct_lm3s9b95,
  517. ct_lm3s9b96,
  518. ct_lm3s5d51,
  519. { TI - Stellaris something }
  520. ct_lm4f120h5,
  521. { Infineon }
  522. ct_xmc4500x1024,
  523. ct_xmc4500x768,
  524. ct_xmc4502x768,
  525. ct_xmc4504x512,
  526. { Allwinner }
  527. ct_allwinner_a20,
  528. { Freescale }
  529. ct_mk20dx128vfm5,
  530. ct_mk20dx128vft5,
  531. ct_mk20dx128vlf5,
  532. ct_mk20dx128vlh5,
  533. ct_teensy30,
  534. ct_mk20dx128vmp5,
  535. ct_mk20dx32vfm5,
  536. ct_mk20dx32vft5,
  537. ct_mk20dx32vlf5,
  538. ct_mk20dx32vlh5,
  539. ct_mk20dx32vmp5,
  540. ct_mk20dx64vfm5,
  541. ct_mk20dx64vft5,
  542. ct_mk20dx64vlf5,
  543. ct_mk20dx64vlh5,
  544. ct_mk20dx64vmp5,
  545. ct_mk20dx128vlh7,
  546. ct_mk20dx128vlk7,
  547. ct_mk20dx128vll7,
  548. ct_mk20dx128vmc7,
  549. ct_mk20dx256vlh7,
  550. ct_mk20dx256vlk7,
  551. ct_mk20dx256vll7,
  552. ct_mk20dx256vmc7,
  553. ct_teensy31,
  554. ct_teensy32,
  555. ct_mk20dx64vlh7,
  556. ct_mk20dx64vlk7,
  557. ct_mk20dx64vmc7,
  558. ct_mk22fn512cap12,
  559. ct_mk22fn512cbp12,
  560. ct_mk22fn512vdc12,
  561. ct_mk22fn512vlh12,
  562. ct_mk22fn512vll12,
  563. ct_mk22fn512vmp12,
  564. ct_freedom_k22f,
  565. { Atmel }
  566. ct_sam3x8e,
  567. ct_arduino_due,
  568. ct_flip_n_click,
  569. { Nordic Semiconductor }
  570. ct_nrf51422_xxaa,
  571. ct_nrf51422_xxab,
  572. ct_nrf51422_xxac,
  573. ct_nrf51822_xxaa,
  574. ct_nrf51822_xxab,
  575. ct_nrf51822_xxac,
  576. ct_nrf52832_xxaa,
  577. ct_nrf52840_xxaa,
  578. ct_sc32442b,
  579. { Raspberry Pi 2 }
  580. ct_raspi2,
  581. ct_thumb2bare:
  582. begin
  583. with embedded_controllers[current_settings.controllertype] do
  584. with linkres do
  585. begin
  586. if (embedded_controllers[current_settings.controllertype].controllerunitstr='MK20D5')
  587. or (embedded_controllers[current_settings.controllertype].controllerunitstr='MK20D7')
  588. or (embedded_controllers[current_settings.controllertype].controllerunitstr='MK22F51212')
  589. or (embedded_controllers[current_settings.controllertype].controllerunitstr='MK64F12') then
  590. Add('ENTRY(_LOWLEVELSTART)')
  591. else
  592. Add('ENTRY(_START)');
  593. Add('MEMORY');
  594. Add('{');
  595. if flashsize<>0 then
  596. begin
  597. LinkStr := ' flash : ORIGIN = 0x' + IntToHex(flashbase,8)
  598. + ', LENGTH = 0x' + IntToHex(flashsize,8);
  599. Add(LinkStr);
  600. end;
  601. LinkStr := ' ram : ORIGIN = 0x' + IntToHex(srambase,8)
  602. + ', LENGTH = 0x' + IntToHex(sramsize,8);
  603. Add(LinkStr);
  604. Add('}');
  605. Add('_stack_top = 0x' + IntToHex(sramsize+srambase,8) + ';');
  606. // Add Checksum Calculation for LPC Controllers so that the bootloader starts the uploaded binary
  607. writeln(controllerunitstr);
  608. if (controllerunitstr = 'LPC8xx') or (controllerunitstr = 'LPC11XX') or (controllerunitstr = 'LPC122X') then
  609. Add('Startup_Checksum = 0 - (_stack_top + _START + 1 + NonMaskableInt_interrupt + 1 + Hardfault_interrupt + 1);');
  610. if (controllerunitstr = 'LPC13XX') then
  611. Add('Startup_Checksum = 0 - (_stack_top + _START + 1 + NonMaskableInt_interrupt + 1 + MemoryManagement_interrupt + 1 + BusFault_interrupt + 1 + UsageFault_interrupt + 1);');
  612. end;
  613. end
  614. else
  615. if not (cs_link_nolink in current_settings.globalswitches) then
  616. internalerror(200902011);
  617. end;
  618. with linkres do
  619. begin
  620. Add('SECTIONS');
  621. Add('{');
  622. Add(' .text :');
  623. Add(' {');
  624. Add(' _text_start = .;');
  625. Add(' KEEP(*(.init .init.*))');
  626. if (embedded_controllers[current_settings.controllertype].controllerunitstr='MK20D5')
  627. or (embedded_controllers[current_settings.controllertype].controllerunitstr='MK20D7')
  628. or (embedded_controllers[current_settings.controllertype].controllerunitstr='MK22F51212')
  629. or (embedded_controllers[current_settings.controllertype].controllerunitstr='MK64F12') then
  630. begin
  631. Add(' . = 0x400;');
  632. Add(' KEEP(*(.flash_config *.flash_config.*))');
  633. end;
  634. Add(' *(.text .text.*)');
  635. Add(' *(.strings)');
  636. Add(' *(.rodata .rodata.*)');
  637. Add(' *(.comment)');
  638. Add(' . = ALIGN(4);');
  639. Add(' _etext = .;');
  640. if embedded_controllers[current_settings.controllertype].flashsize<>0 then
  641. begin
  642. Add(' } >flash');
  643. Add(' .note.gnu.build-id : { *(.note.gnu.build-id) } >flash ');
  644. end
  645. else
  646. begin
  647. Add(' } >ram');
  648. Add(' .note.gnu.build-id : { *(.note.gnu.build-id) } >ram ');
  649. end;
  650. Add(' .data :');
  651. Add(' {');
  652. Add(' _data = .;');
  653. Add(' *(.data .data.*)');
  654. Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
  655. Add(' _edata = .;');
  656. if embedded_controllers[current_settings.controllertype].flashsize<>0 then
  657. begin
  658. Add(' } >ram AT >flash');
  659. end
  660. else
  661. begin
  662. Add(' } >ram');
  663. end;
  664. Add(' .bss :');
  665. Add(' {');
  666. Add(' _bss_start = .;');
  667. Add(' *(.bss .bss.*)');
  668. Add(' *(COMMON)');
  669. Add(' } >ram');
  670. Add('. = ALIGN(4);');
  671. Add('_bss_end = . ;');
  672. Add('}');
  673. Add('_end = .;');
  674. end;
  675. {$endif ARM}
  676. {$ifdef i386}
  677. with linkres do
  678. begin
  679. Add('ENTRY(_START)');
  680. Add('SECTIONS');
  681. Add('{');
  682. Add(' . = 0x100000;');
  683. Add(' .text ALIGN (0x1000) :');
  684. Add(' {');
  685. Add(' _text = .;');
  686. Add(' KEEP(*(.init .init.*))');
  687. Add(' *(.text .text.*)');
  688. Add(' *(.strings)');
  689. Add(' *(.rodata .rodata.*)');
  690. Add(' *(.comment)');
  691. Add(' _etext = .;');
  692. Add(' }');
  693. Add(' .data ALIGN (0x1000) :');
  694. Add(' {');
  695. Add(' _data = .;');
  696. Add(' *(.data .data.*)');
  697. Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
  698. Add(' _edata = .;');
  699. Add(' }');
  700. Add(' . = ALIGN(4);');
  701. Add(' .bss :');
  702. Add(' {');
  703. Add(' _bss_start = .;');
  704. Add(' *(.bss .bss.*)');
  705. Add(' *(COMMON)');
  706. Add(' }');
  707. Add('_bss_end = . ;');
  708. Add('}');
  709. Add('_end = .;');
  710. end;
  711. {$endif i386}
  712. {$ifdef x86_64}
  713. with linkres do
  714. begin
  715. Add('ENTRY(_START)');
  716. Add('SECTIONS');
  717. Add('{');
  718. Add(' . = 0x100000;');
  719. Add(' .text ALIGN (0x1000) :');
  720. Add(' {');
  721. Add(' _text = .;');
  722. Add(' KEEP(*(.init .init.*))');
  723. Add(' *(.text .text.*)');
  724. Add(' *(.strings)');
  725. Add(' *(.rodata .rodata.*)');
  726. Add(' *(.comment)');
  727. Add(' _etext = .;');
  728. Add(' }');
  729. Add(' .data ALIGN (0x1000) :');
  730. Add(' {');
  731. Add(' _data = .;');
  732. Add(' *(.data .data.*)');
  733. Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
  734. Add(' _edata = .;');
  735. Add(' }');
  736. Add(' . = ALIGN(4);');
  737. Add(' .bss :');
  738. Add(' {');
  739. Add(' _bss_start = .;');
  740. Add(' *(.bss .bss.*)');
  741. Add(' *(COMMON)');
  742. Add(' }');
  743. Add('_bss_end = . ;');
  744. Add('}');
  745. Add('_end = .;');
  746. end;
  747. {$endif x86_64}
  748. {$ifdef AVR}
  749. with linkres do
  750. begin
  751. { linker script from ld 2.19 }
  752. Add('ENTRY(_START)');
  753. Add('OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")');
  754. case current_settings.cputype of
  755. cpu_avr1:
  756. Add('OUTPUT_ARCH(avr:1)');
  757. cpu_avr2:
  758. Add('OUTPUT_ARCH(avr:2)');
  759. cpu_avr25:
  760. Add('OUTPUT_ARCH(avr:25)');
  761. cpu_avr3:
  762. Add('OUTPUT_ARCH(avr:3)');
  763. cpu_avr31:
  764. Add('OUTPUT_ARCH(avr:31)');
  765. cpu_avr35:
  766. Add('OUTPUT_ARCH(avr:35)');
  767. cpu_avr4:
  768. Add('OUTPUT_ARCH(avr:4)');
  769. cpu_avr5:
  770. Add('OUTPUT_ARCH(avr:5)');
  771. cpu_avr51:
  772. Add('OUTPUT_ARCH(avr:51)');
  773. cpu_avr6:
  774. Add('OUTPUT_ARCH(avr:6)');
  775. cpu_avrxmega3:
  776. Add('OUTPUT_ARCH(avr:103)');
  777. cpu_avrtiny:
  778. Add('OUTPUT_ARCH(avr:100)');
  779. else
  780. Internalerror(2015072701);
  781. end;
  782. Add('MEMORY');
  783. with embedded_controllers[current_settings.controllertype] do
  784. begin
  785. Add('{');
  786. Add(' text (rx) : ORIGIN = 0, LENGTH = 0x'+IntToHex(flashsize,6));
  787. Add(' data (rw!x) : ORIGIN = 0x'+IntToHex($800000+srambase,6)+', LENGTH = 0x'+IntToHex(sramsize,6));
  788. Add(' eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 0x'+IntToHex(eepromsize,6));
  789. Add(' fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K');
  790. Add(' lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K');
  791. Add(' signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K');
  792. Add('}');
  793. Add('_stack_top = 0x' + IntToHex(srambase+sramsize-1,4) + ';');
  794. end;
  795. Add('SECTIONS');
  796. Add('{');
  797. Add(' /* Read-only sections, merged into text segment: */');
  798. Add(' .hash : { *(.hash) }');
  799. Add(' .dynsym : { *(.dynsym) }');
  800. Add(' .dynstr : { *(.dynstr) }');
  801. Add(' .gnu.version : { *(.gnu.version) }');
  802. Add(' .gnu.version_d : { *(.gnu.version_d) }');
  803. Add(' .gnu.version_r : { *(.gnu.version_r) }');
  804. Add(' .rel.init : { *(.rel.init) }');
  805. Add(' .rela.init : { *(.rela.init) }');
  806. Add(' .rel.text :');
  807. Add(' {');
  808. Add(' *(.rel.text)');
  809. Add(' *(.rel.text.*)');
  810. Add(' *(.rel.gnu.linkonce.t*)');
  811. Add(' }');
  812. Add(' .rela.text :');
  813. Add(' {');
  814. Add(' *(.rela.text)');
  815. Add(' *(.rela.text.*)');
  816. Add(' *(.rela.gnu.linkonce.t*)');
  817. Add(' }');
  818. Add(' .rel.fini : { *(.rel.fini) }');
  819. Add(' .rela.fini : { *(.rela.fini) }');
  820. Add(' .rel.rodata :');
  821. Add(' {');
  822. Add(' *(.rel.rodata)');
  823. Add(' *(.rel.rodata.*)');
  824. Add(' *(.rel.gnu.linkonce.r*)');
  825. Add(' }');
  826. Add(' .rela.rodata :');
  827. Add(' {');
  828. Add(' *(.rela.rodata)');
  829. Add(' *(.rela.rodata.*)');
  830. Add(' *(.rela.gnu.linkonce.r*)');
  831. Add(' }');
  832. Add(' .rel.data :');
  833. Add(' {');
  834. Add(' *(.rel.data)');
  835. Add(' *(.rel.data.*)');
  836. Add(' *(.rel.gnu.linkonce.d*)');
  837. Add(' }');
  838. Add(' .rela.data :');
  839. Add(' {');
  840. Add(' *(.rela.data)');
  841. Add(' *(.rela.data.*)');
  842. Add(' *(.rela.gnu.linkonce.d*)');
  843. Add(' }');
  844. Add(' .rel.ctors : { *(.rel.ctors) }');
  845. Add(' .rela.ctors : { *(.rela.ctors) }');
  846. Add(' .rel.dtors : { *(.rel.dtors) }');
  847. Add(' .rela.dtors : { *(.rela.dtors) }');
  848. Add(' .rel.got : { *(.rel.got) }');
  849. Add(' .rela.got : { *(.rela.got) }');
  850. Add(' .rel.bss : { *(.rel.bss) }');
  851. Add(' .rela.bss : { *(.rela.bss) }');
  852. Add(' .rel.plt : { *(.rel.plt) }');
  853. Add(' .rela.plt : { *(.rela.plt) }');
  854. Add(' /* Internal text space or external memory. */');
  855. Add(' .text :');
  856. Add(' {');
  857. Add(' KEEP(*(.init .init.*))');
  858. Add(' /* For data that needs to reside in the lower 64k of progmem. */');
  859. Add(' *(.progmem.gcc*)');
  860. Add(' *(.progmem*)');
  861. Add(' . = ALIGN(2);');
  862. Add(' __trampolines_start = . ;');
  863. Add(' /* The jump trampolines for the 16-bit limited relocs will reside here. */');
  864. Add(' *(.trampolines)');
  865. Add(' *(.trampolines*)');
  866. Add(' __trampolines_end = . ;');
  867. Add(' /* For future tablejump instruction arrays for 3 byte pc devices.');
  868. Add(' We don''t relax jump/call instructions within these sections. */');
  869. Add(' *(.jumptables)');
  870. Add(' *(.jumptables*)');
  871. Add(' /* For code that needs to reside in the lower 128k progmem. */');
  872. Add(' *(.lowtext)');
  873. Add(' *(.lowtext*)');
  874. Add(' __ctors_start = . ;');
  875. Add(' *(.ctors)');
  876. Add(' __ctors_end = . ;');
  877. Add(' __dtors_start = . ;');
  878. Add(' *(.dtors)');
  879. Add(' __dtors_end = . ;');
  880. Add(' KEEP(SORT(*)(.ctors))');
  881. Add(' KEEP(SORT(*)(.dtors))');
  882. Add(' /* From this point on, we don''t bother about wether the insns are');
  883. Add(' below or above the 16 bits boundary. */');
  884. Add(' *(.init0) /* Start here after reset. */');
  885. Add(' KEEP (*(.init0))');
  886. Add(' *(.init1)');
  887. Add(' KEEP (*(.init1))');
  888. Add(' *(.init2) /* Clear __zero_reg__, set up stack pointer. */');
  889. Add(' KEEP (*(.init2))');
  890. Add(' *(.init3)');
  891. Add(' KEEP (*(.init3))');
  892. Add(' *(.init4) /* Initialize data and BSS. */');
  893. Add(' KEEP (*(.init4))');
  894. Add(' *(.init5)');
  895. Add(' KEEP (*(.init5))');
  896. Add(' *(.init6) /* C++ constructors. */');
  897. Add(' KEEP (*(.init6))');
  898. Add(' *(.init7)');
  899. Add(' KEEP (*(.init7))');
  900. Add(' *(.init8)');
  901. Add(' KEEP (*(.init8))');
  902. Add(' *(.init9) /* Call main(). */');
  903. Add(' KEEP (*(.init9))');
  904. Add(' *(.text)');
  905. Add(' . = ALIGN(2);');
  906. Add(' *(.text.*)');
  907. Add(' . = ALIGN(2);');
  908. Add(' *(.fini9) /* _exit() starts here. */');
  909. Add(' KEEP (*(.fini9))');
  910. Add(' *(.fini8)');
  911. Add(' KEEP (*(.fini8))');
  912. Add(' *(.fini7)');
  913. Add(' KEEP (*(.fini7))');
  914. Add(' *(.fini6) /* C++ destructors. */');
  915. Add(' KEEP (*(.fini6))');
  916. Add(' *(.fini5)');
  917. Add(' KEEP (*(.fini5))');
  918. Add(' *(.fini4)');
  919. Add(' KEEP (*(.fini4))');
  920. Add(' *(.fini3)');
  921. Add(' KEEP (*(.fini3))');
  922. Add(' *(.fini2)');
  923. Add(' KEEP (*(.fini2))');
  924. Add(' *(.fini1)');
  925. Add(' KEEP (*(.fini1))');
  926. Add(' *(.fini0) /* Infinite loop after program termination. */');
  927. Add(' KEEP (*(.fini0))');
  928. Add(' _etext = . ;');
  929. Add(' } > text');
  930. Add(' .data : AT (ADDR (.text) + SIZEOF (.text))');
  931. Add(' {');
  932. Add(' PROVIDE (__data_start = .) ;');
  933. Add(' *(.data)');
  934. Add(' *(.data*)');
  935. Add(' *(.rodata) /* We need to include .rodata here if gcc is used */');
  936. Add(' *(.rodata*) /* with -fdata-sections. */');
  937. Add(' *(.gnu.linkonce.d*)');
  938. Add(' . = ALIGN(2);');
  939. Add(' _edata = . ;');
  940. Add(' PROVIDE (__data_end = .) ;');
  941. Add(' } > data');
  942. Add(' .bss : AT (ADDR (.bss))');
  943. Add(' {');
  944. Add(' PROVIDE (__bss_start = .) ;');
  945. Add(' *(.bss)');
  946. Add(' *(.bss*)');
  947. Add(' *(COMMON)');
  948. Add(' PROVIDE (__bss_end = .) ;');
  949. Add(' } > data');
  950. Add(' __data_load_start = LOADADDR(.data);');
  951. Add(' __data_load_end = __data_load_start + SIZEOF(.data);');
  952. Add(' /* Global data not cleared after reset. */');
  953. Add(' .noinit :');
  954. Add(' {');
  955. Add(' PROVIDE (__noinit_start = .) ;');
  956. Add(' *(.noinit*)');
  957. Add(' PROVIDE (__noinit_end = .) ;');
  958. Add(' _end = . ;');
  959. Add(' PROVIDE (__heap_start = .) ;');
  960. Add(' } > data');
  961. Add(' .eeprom :');
  962. Add(' {');
  963. Add(' *(.eeprom*)');
  964. Add(' __eeprom_end = . ;');
  965. Add(' } > eeprom');
  966. Add(' .fuse :');
  967. Add(' {');
  968. Add(' KEEP(*(.fuse))');
  969. Add(' KEEP(*(.lfuse))');
  970. Add(' KEEP(*(.hfuse))');
  971. Add(' KEEP(*(.efuse))');
  972. Add(' } > fuse');
  973. Add(' .lock :');
  974. Add(' {');
  975. Add(' KEEP(*(.lock*))');
  976. Add(' } > lock');
  977. Add(' .signature :');
  978. Add(' {');
  979. Add(' KEEP(*(.signature*))');
  980. Add(' } > signature');
  981. Add(' /* Stabs debugging sections. */');
  982. Add(' .stab 0 : { *(.stab) }');
  983. Add(' .stabstr 0 : { *(.stabstr) }');
  984. Add(' .stab.excl 0 : { *(.stab.excl) }');
  985. Add(' .stab.exclstr 0 : { *(.stab.exclstr) }');
  986. Add(' .stab.index 0 : { *(.stab.index) }');
  987. Add(' .stab.indexstr 0 : { *(.stab.indexstr) }');
  988. Add(' .comment 0 : { *(.comment) }');
  989. Add(' /* DWARF debug sections.');
  990. Add(' Symbols in the DWARF debugging sections are relative to the beginning');
  991. Add(' of the section so we begin them at 0. */');
  992. Add(' /* DWARF 1 */');
  993. Add(' .debug 0 : { *(.debug) }');
  994. Add(' .line 0 : { *(.line) }');
  995. Add(' /* GNU DWARF 1 extensions */');
  996. Add(' .debug_srcinfo 0 : { *(.debug_srcinfo) }');
  997. Add(' .debug_sfnames 0 : { *(.debug_sfnames) }');
  998. Add(' /* DWARF 1.1 and DWARF 2 */');
  999. Add(' .debug_aranges 0 : { *(.debug_aranges) }');
  1000. Add(' .debug_pubnames 0 : { *(.debug_pubnames) }');
  1001. Add(' /* DWARF 2 */');
  1002. Add(' .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }');
  1003. Add(' .debug_abbrev 0 : { *(.debug_abbrev) }');
  1004. Add(' .debug_line 0 : { *(.debug_line) }');
  1005. Add(' .debug_frame 0 : { *(.debug_frame) }');
  1006. Add(' .debug_str 0 : { *(.debug_str) }');
  1007. Add(' .debug_loc 0 : { *(.debug_loc) }');
  1008. Add(' .debug_macinfo 0 : { *(.debug_macinfo) }');
  1009. Add('}');
  1010. end;
  1011. {$endif AVR}
  1012. {$ifdef MIPSEL}
  1013. case current_settings.controllertype of
  1014. ct_none:
  1015. begin
  1016. end;
  1017. ct_pic32mx110f016b,
  1018. ct_pic32mx110f016c,
  1019. ct_pic32mx110f016d,
  1020. ct_pic32mx120f032b,
  1021. ct_pic32mx120f032c,
  1022. ct_pic32mx120f032d,
  1023. ct_pic32mx130f064b,
  1024. ct_pic32mx130f064c,
  1025. ct_pic32mx130f064d,
  1026. ct_pic32mx150f128b,
  1027. ct_pic32mx150f128c,
  1028. ct_pic32mx150f128d,
  1029. ct_pic32mx210f016b,
  1030. ct_pic32mx210f016c,
  1031. ct_pic32mx210f016d,
  1032. ct_pic32mx220f032b,
  1033. ct_pic32mx220f032c,
  1034. ct_pic32mx220f032d,
  1035. ct_pic32mx230f064b,
  1036. ct_pic32mx230f064c,
  1037. ct_pic32mx230f064d,
  1038. ct_pic32mx250f128b,
  1039. ct_pic32mx250f128c,
  1040. ct_pic32mx250f128d,
  1041. ct_pic32mx775f256h,
  1042. ct_pic32mx775f256l,
  1043. ct_pic32mx775f512h,
  1044. ct_pic32mx775f512l,
  1045. ct_pic32mx795f512h,
  1046. ct_pic32mx795f512l:
  1047. begin
  1048. with embedded_controllers[current_settings.controllertype] do
  1049. with linkres do
  1050. begin
  1051. Add('OUTPUT_FORMAT("elf32-tradlittlemips")');
  1052. Add('OUTPUT_ARCH(pic32mx)');
  1053. Add('ENTRY(_reset)');
  1054. Add('PROVIDE(_vector_spacing = 0x00000001);');
  1055. Add('_ebase_address = 0x'+IntToHex(flashbase,8)+';');
  1056. Add('_RESET_ADDR = 0xBFC00000;');
  1057. Add('_BEV_EXCPT_ADDR = 0xBFC00380;');
  1058. Add('_DBG_EXCPT_ADDR = 0xBFC00480;');
  1059. Add('_GEN_EXCPT_ADDR = _ebase_address + 0x180;');
  1060. Add('MEMORY');
  1061. Add('{');
  1062. if flashsize<>0 then
  1063. begin
  1064. Add(' kseg0_program_mem : ORIGIN = 0x'+IntToHex(flashbase,8)+', LENGTH = 0x'+IntToHex(flashsize,8));
  1065. //TODO This should better be placed into the controllertype records
  1066. Add(' kseg1_boot_mem : ORIGIN = 0xBFC00000, LENGTH = 0xbef');
  1067. Add(' config3 : ORIGIN = 0xBFC00BF0, LENGTH = 0x4');
  1068. Add(' config2 : ORIGIN = 0xBFC00BF4, LENGTH = 0x4');
  1069. Add(' config1 : ORIGIN = 0xBFC00BF8, LENGTH = 0x4');
  1070. Add(' config0 : ORIGIN = 0xBFC00BFC, LENGTH = 0x4');
  1071. end;
  1072. Add(' ram : ORIGIN = 0x' + IntToHex(srambase,8)
  1073. + ', LENGTH = 0x' + IntToHex(sramsize,8));
  1074. Add('}');
  1075. Add('_stack_top = 0x' + IntToHex(sramsize+srambase,8) + ';');
  1076. end;
  1077. end
  1078. end;
  1079. with linkres do
  1080. begin
  1081. Add('SECTIONS');
  1082. Add('{');
  1083. Add(' .reset _RESET_ADDR :');
  1084. Add(' {');
  1085. Add(' KEEP(*(.reset .reset.*))');
  1086. Add(' KEEP(*(.startup .startup.*))');
  1087. Add(' } > kseg1_boot_mem');
  1088. Add(' .bev_excpt _BEV_EXCPT_ADDR :');
  1089. Add(' {');
  1090. Add(' KEEP(*(.bev_handler))');
  1091. Add(' } > kseg1_boot_mem');
  1092. Add(' .text :');
  1093. Add(' {');
  1094. Add(' _text_start = .;');
  1095. Add(' . = _text_start + 0x180;');
  1096. Add(' KEEP(*(.gen_handler))');
  1097. Add(' . = _text_start + 0x200;');
  1098. Add(' KEEP(*(.init .init.*))');
  1099. Add(' *(.text .text.*)');
  1100. Add(' *(.strings)');
  1101. Add(' *(.rodata .rodata.*)');
  1102. Add(' *(.comment)');
  1103. Add(' _etext = .;');
  1104. if embedded_controllers[current_settings.controllertype].flashsize<>0 then
  1105. begin
  1106. Add(' } >kseg0_program_mem');
  1107. end
  1108. else
  1109. begin
  1110. Add(' } >ram');
  1111. end;
  1112. Add(' .note.gnu.build-id : { *(.note.gnu.build-id) }');
  1113. Add(' .data :');
  1114. Add(' {');
  1115. Add(' _data = .;');
  1116. Add(' *(.data .data.*)');
  1117. Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
  1118. Add(' . = .;');
  1119. Add(' _gp = ALIGN(16) + 0x7ff0;');
  1120. Add(' _edata = .;');
  1121. if embedded_controllers[current_settings.controllertype].flashsize<>0 then
  1122. begin
  1123. Add(' } >ram AT >kseg0_program_mem');
  1124. end
  1125. else
  1126. begin
  1127. Add(' } >ram');
  1128. end;
  1129. Add(' .config_BFC00BF0 : {');
  1130. Add(' KEEP(*(.config_BFC00BF0))');
  1131. Add(' } > config3');
  1132. Add(' .config_BFC00BF4 : {');
  1133. Add(' KEEP(*(.config_BFC00BF4))');
  1134. Add(' } > config2');
  1135. Add(' .config_BFC00BF8 : {');
  1136. Add(' KEEP(*(.config_BFC00BF8))');
  1137. Add(' } > config1');
  1138. Add(' .config_BFC00BFC : {');
  1139. Add(' KEEP(*(.config_BFC00BFC))');
  1140. Add(' } > config0');
  1141. Add(' .bss :');
  1142. Add(' {');
  1143. Add(' _bss_start = .;');
  1144. Add(' *(.bss .bss.*)');
  1145. Add(' *(COMMON)');
  1146. Add(' } >ram');
  1147. Add('. = ALIGN(4);');
  1148. Add('_bss_end = . ;');
  1149. Add(' .comment 0 : { *(.comment) }');
  1150. Add(' /* DWARF debug sections.');
  1151. Add(' Symbols in the DWARF debugging sections are relative to the beginning');
  1152. Add(' of the section so we begin them at 0. */');
  1153. Add(' /* DWARF 1 */');
  1154. Add(' .debug 0 : { *(.debug) }');
  1155. Add(' .line 0 : { *(.line) }');
  1156. Add(' /* GNU DWARF 1 extensions */');
  1157. Add(' .debug_srcinfo 0 : { *(.debug_srcinfo) }');
  1158. Add(' .debug_sfnames 0 : { *(.debug_sfnames) }');
  1159. Add(' /* DWARF 1.1 and DWARF 2 */');
  1160. Add(' .debug_aranges 0 : { *(.debug_aranges) }');
  1161. Add(' .debug_pubnames 0 : { *(.debug_pubnames) }');
  1162. Add(' /* DWARF 2 */');
  1163. Add(' .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }');
  1164. Add(' .debug_abbrev 0 : { *(.debug_abbrev) }');
  1165. Add(' /DISCARD/ : { *(.debug_line) }');
  1166. Add(' .debug_frame 0 : { *(.debug_frame) }');
  1167. Add(' .debug_str 0 : { *(.debug_str) }');
  1168. Add(' /DISCARD/ : { *(.debug_loc) }');
  1169. Add(' .debug_macinfo 0 : { *(.debug_macinfo) }');
  1170. Add(' /* SGI/MIPS DWARF 2 extensions */');
  1171. Add(' .debug_weaknames 0 : { *(.debug_weaknames) }');
  1172. Add(' .debug_funcnames 0 : { *(.debug_funcnames) }');
  1173. Add(' .debug_typenames 0 : { *(.debug_typenames) }');
  1174. Add(' .debug_varnames 0 : { *(.debug_varnames) }');
  1175. Add(' /* DWARF 3 */');
  1176. Add(' .debug_pubtypes 0 : { *(.debug_pubtypes) }');
  1177. Add(' .debug_ranges 0 : { *(.debug_ranges) }');
  1178. Add(' .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }');
  1179. Add(' .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }');
  1180. Add(' .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }');
  1181. Add(' .mdebug.abi32 : { KEEP(*(.mdebug.abi32)) }');
  1182. Add(' .mdebug.abiN32 : { KEEP(*(.mdebug.abiN32)) }');
  1183. Add(' .mdebug.abi64 : { KEEP(*(.mdebug.abi64)) }');
  1184. Add(' .mdebug.abiO64 : { KEEP(*(.mdebug.abiO64)) }');
  1185. Add(' .mdebug.eabi32 : { KEEP(*(.mdebug.eabi32)) }');
  1186. Add(' .mdebug.eabi64 : { KEEP(*(.mdebug.eabi64)) }');
  1187. Add(' /DISCARD/ : { *(.rel.dyn) }');
  1188. Add(' /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }');
  1189. Add('}');
  1190. Add('_end = .;');
  1191. end;
  1192. {$endif MIPSEL}
  1193. {$ifdef RISCV32}
  1194. with linkres do
  1195. begin
  1196. Add('OUTPUT_ARCH("riscv")');
  1197. Add('ENTRY(_START)');
  1198. Add('MEMORY');
  1199. with embedded_controllers[current_settings.controllertype] do
  1200. begin
  1201. Add('{');
  1202. Add(' flash (rx) : ORIGIN = 0x'+IntToHex(flashbase,6)+', LENGTH = 0x'+IntToHex(flashsize,6));
  1203. Add(' ram (rw!x) : ORIGIN = 0x'+IntToHex(srambase,6)+', LENGTH = 0x'+IntToHex(sramsize,6));
  1204. Add('}');
  1205. Add('_stack_top = 0x' + IntToHex(srambase+sramsize-1,4) + ';');
  1206. end;
  1207. Add('SECTIONS');
  1208. Add('{');
  1209. Add(' .text :');
  1210. Add(' {');
  1211. Add(' _text_start = .;');
  1212. Add(' KEEP(*(.init .init.*))');
  1213. Add(' *(.text .text.*)');
  1214. Add(' *(.strings)');
  1215. Add(' *(.rodata .rodata.*)');
  1216. Add(' *(.comment)');
  1217. Add(' . = ALIGN(4);');
  1218. Add(' _etext = .;');
  1219. if embedded_controllers[current_settings.controllertype].flashsize<>0 then
  1220. begin
  1221. Add(' } >flash');
  1222. //Add(' .note.gnu.build-id : { *(.note.gnu.build-id) } >flash ');
  1223. end
  1224. else
  1225. begin
  1226. Add(' } >ram');
  1227. //Add(' .note.gnu.build-id : { *(.note.gnu.build-id) } >ram ');
  1228. end;
  1229. Add(' .data :');
  1230. Add(' {');
  1231. Add(' _data = .;');
  1232. Add(' *(.data .data.*)');
  1233. Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
  1234. Add(' _edata = .;');
  1235. if embedded_controllers[current_settings.controllertype].flashsize<>0 then
  1236. begin
  1237. Add(' } >ram AT >flash');
  1238. end
  1239. else
  1240. begin
  1241. Add(' } >ram');
  1242. end;
  1243. Add(' .bss :');
  1244. Add(' {');
  1245. Add(' _bss_start = .;');
  1246. Add(' *(.bss .bss.*)');
  1247. Add(' *(COMMON)');
  1248. Add(' } >ram');
  1249. Add(' . = ALIGN(4);');
  1250. Add(' _bss_end = . ;');
  1251. Add(' /* Stabs debugging sections. */');
  1252. Add(' .stab 0 : { *(.stab) }');
  1253. Add(' .stabstr 0 : { *(.stabstr) }');
  1254. Add(' .stab.excl 0 : { *(.stab.excl) }');
  1255. Add(' .stab.exclstr 0 : { *(.stab.exclstr) }');
  1256. Add(' .stab.index 0 : { *(.stab.index) }');
  1257. Add(' .stab.indexstr 0 : { *(.stab.indexstr) }');
  1258. Add(' .comment 0 : { *(.comment) }');
  1259. Add(' /* DWARF debug sections.');
  1260. Add(' Symbols in the DWARF debugging sections are relative to the beginning');
  1261. Add(' of the section so we begin them at 0. */');
  1262. Add(' /* DWARF 1 */');
  1263. Add(' .debug 0 : { *(.debug) }');
  1264. Add(' .line 0 : { *(.line) }');
  1265. Add(' /* GNU DWARF 1 extensions */');
  1266. Add(' .debug_srcinfo 0 : { *(.debug_srcinfo) }');
  1267. Add(' .debug_sfnames 0 : { *(.debug_sfnames) }');
  1268. Add(' /* DWARF 1.1 and DWARF 2 */');
  1269. Add(' .debug_aranges 0 : { *(.debug_aranges) }');
  1270. Add(' .debug_pubnames 0 : { *(.debug_pubnames) }');
  1271. Add(' /* DWARF 2 */');
  1272. Add(' .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }');
  1273. Add(' .debug_abbrev 0 : { *(.debug_abbrev) }');
  1274. Add(' .debug_line 0 : { *(.debug_line) }');
  1275. Add(' .debug_frame 0 : { *(.debug_frame) }');
  1276. Add(' .debug_str 0 : { *(.debug_str) }');
  1277. Add(' .debug_loc 0 : { *(.debug_loc) }');
  1278. Add(' .debug_macinfo 0 : { *(.debug_macinfo) }');
  1279. Add(' /* SGI/MIPS DWARF 2 extensions */');
  1280. Add(' .debug_weaknames 0 : { *(.debug_weaknames) }');
  1281. Add(' .debug_funcnames 0 : { *(.debug_funcnames) }');
  1282. Add(' .debug_typenames 0 : { *(.debug_typenames) }');
  1283. Add(' .debug_varnames 0 : { *(.debug_varnames) }');
  1284. Add(' /* DWARF 3 */');
  1285. Add(' .debug_pubtypes 0 : { *(.debug_pubtypes) }');
  1286. Add(' .debug_ranges 0 : { *(.debug_ranges) }');
  1287. Add('}');
  1288. Add('_end = .;');
  1289. end;
  1290. {$endif RISCV32}
  1291. {$ifdef XTENSA}
  1292. with linkres do
  1293. begin
  1294. Add('/* Script for -z combreloc: combine and sort reloc sections */');
  1295. Add('/* Copyright (C) 2014-2018 Free Software Foundation, Inc.');
  1296. Add(' Copying and distribution of this script, with or without modification,');
  1297. Add(' are permitted in any medium without royalty provided the copyright');
  1298. Add(' notice and this notice are preserved. */');
  1299. Add('ENTRY(_start)');
  1300. Add('SEARCH_DIR("=/builds/idf/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/lib"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");');
  1301. Add('SECTIONS');
  1302. Add('{');
  1303. Add(' /* Read-only sections, merged into text segment: */');
  1304. Add(' PROVIDE (__executable_start = 0x400000); . = 0x400000 + SIZEOF_HEADERS;');
  1305. Add(' .interp : { *(.interp) }');
  1306. Add(' .note.gnu.build-id : { *(.note.gnu.build-id) }');
  1307. Add(' .hash : { *(.hash) }');
  1308. Add(' .gnu.hash : { *(.gnu.hash) }');
  1309. Add(' .dynsym : { *(.dynsym) }');
  1310. Add(' .dynstr : { *(.dynstr) }');
  1311. Add(' .gnu.version : { *(.gnu.version) }');
  1312. Add(' .gnu.version_d : { *(.gnu.version_d) }');
  1313. Add(' .gnu.version_r : { *(.gnu.version_r) }');
  1314. Add(' .rela.dyn :');
  1315. Add(' {');
  1316. Add(' *(.rela.init)');
  1317. Add(' *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)');
  1318. Add(' *(.rela.fini)');
  1319. Add(' *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)');
  1320. Add(' *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)');
  1321. Add(' *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)');
  1322. Add(' *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)');
  1323. Add(' *(.rela.ctors)');
  1324. Add(' *(.rela.dtors)');
  1325. Add(' *(.rela.got)');
  1326. Add(' *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)');
  1327. Add(' }');
  1328. Add(' .rela.plt : { *(.rela.plt) }');
  1329. Add(' /* .plt* sections are embedded in .text */');
  1330. Add(' .text :');
  1331. Add(' {');
  1332. Add(' *(.got.plt* .plt*)');
  1333. Add(' KEEP (*(.init.literal))');
  1334. Add(' KEEP (*(SORT_NONE(.init)))');
  1335. Add(' *(.literal .text .stub .literal.* .text.* .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)');
  1336. Add(' /* .gnu.warning sections are handled specially by elf32.em. */');
  1337. Add(' *(.gnu.warning)');
  1338. Add(' KEEP (*(.fini.literal))');
  1339. Add(' KEEP (*(SORT_NONE(.fini)))');
  1340. Add(' } =0');
  1341. Add(' PROVIDE (__etext = .);');
  1342. Add(' PROVIDE (_etext = .);');
  1343. Add(' PROVIDE (etext = .);');
  1344. Add(' .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }');
  1345. Add(' .rodata1 : { *(.rodata1) }');
  1346. Add(' .got.loc : { *(.got.loc) }');
  1347. Add(' .xt_except_table : ONLY_IF_RO { KEEP (*(.xt_except_table .xt_except_table.* .gnu.linkonce.e.*)) }');
  1348. Add(' .eh_frame_hdr : { *(.eh_frame_hdr) }');
  1349. Add(' .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }');
  1350. Add(' .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }');
  1351. Add(' /* Adjust the address for the data segment. We want to adjust up to');
  1352. Add(' the same address within the page on the next page up. */');
  1353. Add(' . = ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1));');
  1354. Add(' /* Exception handling */');
  1355. Add(' .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }');
  1356. Add(' .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }');
  1357. Add(' /* Thread Local Storage sections */');
  1358. Add(' .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }');
  1359. Add(' .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }');
  1360. Add(' .preinit_array :');
  1361. Add(' {');
  1362. Add(' PROVIDE_HIDDEN (__preinit_array_start = .);');
  1363. Add(' KEEP (*(.preinit_array))');
  1364. Add(' PROVIDE_HIDDEN (__preinit_array_end = .);');
  1365. Add(' }');
  1366. Add(' .init_array :');
  1367. Add(' {');
  1368. Add(' PROVIDE_HIDDEN (__init_array_start = .);');
  1369. Add(' KEEP (*(SORT(.init_array.*)))');
  1370. Add(' KEEP (*(.init_array))');
  1371. Add(' PROVIDE_HIDDEN (__init_array_end = .);');
  1372. Add(' }');
  1373. Add(' .fini_array :');
  1374. Add(' {');
  1375. Add(' PROVIDE_HIDDEN (__fini_array_start = .);');
  1376. Add(' KEEP (*(SORT(.fini_array.*)))');
  1377. Add(' KEEP (*(.fini_array))');
  1378. Add(' PROVIDE_HIDDEN (__fini_array_end = .);');
  1379. Add(' }');
  1380. Add(' .ctors :');
  1381. Add(' {');
  1382. Add(' /* gcc uses crtbegin.o to find the start of');
  1383. Add(' the constructors, so we make sure it is');
  1384. Add(' first. Because this is a wildcard, it');
  1385. Add(' doesn''t matter if the user does not');
  1386. Add(' actually link against crtbegin.o; the');
  1387. Add(' linker won''t look for a file to match a');
  1388. Add(' wildcard. The wildcard also means that it');
  1389. Add(' doesn''t matter which directory crtbegin.o');
  1390. Add(' is in. */');
  1391. Add(' KEEP (*crtbegin.o(.ctors))');
  1392. Add(' KEEP (*crtbegin?.o(.ctors))');
  1393. Add(' /* We don''t want to include the .ctor section from');
  1394. Add(' the crtend.o file until after the sorted ctors.');
  1395. Add(' The .ctor section from the crtend file contains the');
  1396. Add(' end of ctors marker and it must be last */');
  1397. Add(' KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))');
  1398. Add(' KEEP (*(SORT(.ctors.*)))');
  1399. Add(' KEEP (*(.ctors))');
  1400. Add(' }');
  1401. Add(' .dtors :');
  1402. Add(' {');
  1403. Add(' KEEP (*crtbegin.o(.dtors))');
  1404. Add(' KEEP (*crtbegin?.o(.dtors))');
  1405. Add(' KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))');
  1406. Add(' KEEP (*(SORT(.dtors.*)))');
  1407. Add(' KEEP (*(.dtors))');
  1408. Add(' }');
  1409. Add(' .jcr : { KEEP (*(.jcr)) }');
  1410. Add(' .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }');
  1411. Add(' .xt_except_table : ONLY_IF_RW { KEEP (*(.xt_except_table .xt_except_table.* .gnu.linkonce.e.*)) }');
  1412. Add(' .dynamic : { *(.dynamic) }');
  1413. Add(' .got : { *(.got) }');
  1414. Add(' .data :');
  1415. Add(' {');
  1416. Add(' *(.data .data.* .gnu.linkonce.d.*)');
  1417. Add(' SORT(CONSTRUCTORS)');
  1418. Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
  1419. Add(' }');
  1420. Add(' .data1 : { *(.data1) }');
  1421. Add(' .xt_except_desc :');
  1422. Add(' {');
  1423. Add(' *(.xt_except_desc .xt_except_desc.* .gnu.linkonce.h.*)');
  1424. Add(' *(.xt_except_desc_end)');
  1425. Add(' }');
  1426. Add(' .lit4 :');
  1427. Add(' {');
  1428. Add(' PROVIDE (_lit4_start = .);');
  1429. Add(' *(.lit4 .lit4.* .gnu.linkonce.lit4.*)');
  1430. Add(' PROVIDE (_lit4_end = .);');
  1431. Add(' }');
  1432. Add(' _edata = .; PROVIDE (edata = .);');
  1433. Add(' __bss_start = .;');
  1434. Add(' .bss :');
  1435. Add(' {');
  1436. Add(' *(.dynbss)');
  1437. Add(' *(.bss .bss.* .gnu.linkonce.b.*)');
  1438. Add(' *(COMMON)');
  1439. Add(' /* Align here to ensure that the .bss section occupies space up to');
  1440. Add(' _end. Align after .bss to ensure correct alignment even if the');
  1441. Add(' .bss section disappears because there are no input sections.');
  1442. Add(' FIXME: Why do we need it? When there is no .bss section, we don''t');
  1443. Add(' pad the .data section. */');
  1444. Add(' . = ALIGN(. != 0 ? 32 / 8 : 1);');
  1445. Add(' }');
  1446. Add(' . = ALIGN(32 / 8);');
  1447. Add(' . = ALIGN(32 / 8);');
  1448. Add(' _end = .; PROVIDE (end = .);');
  1449. Add(' /* Stabs debugging sections. */');
  1450. Add(' .stab 0 : { *(.stab) }');
  1451. Add(' .stabstr 0 : { *(.stabstr) }');
  1452. Add(' .stab.excl 0 : { *(.stab.excl) }');
  1453. Add(' .stab.exclstr 0 : { *(.stab.exclstr) }');
  1454. Add(' .stab.index 0 : { *(.stab.index) }');
  1455. Add(' .stab.indexstr 0 : { *(.stab.indexstr) }');
  1456. Add(' .comment 0 : { *(.comment) }');
  1457. Add(' /* DWARF debug sections.');
  1458. Add(' Symbols in the DWARF debugging sections are relative to the beginning');
  1459. Add(' of the section so we begin them at 0. */');
  1460. Add(' /* DWARF 1 */');
  1461. Add(' .debug 0 : { *(.debug) }');
  1462. Add(' .line 0 : { *(.line) }');
  1463. Add(' /* GNU DWARF 1 extensions */');
  1464. Add(' .debug_srcinfo 0 : { *(.debug_srcinfo) }');
  1465. Add(' .debug_sfnames 0 : { *(.debug_sfnames) }');
  1466. Add(' /* DWARF 1.1 and DWARF 2 */');
  1467. Add(' .debug_aranges 0 : { *(.debug_aranges) }');
  1468. Add(' .debug_pubnames 0 : { *(.debug_pubnames) }');
  1469. Add(' /* DWARF 2 */');
  1470. Add(' .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }');
  1471. Add(' .debug_abbrev 0 : { *(.debug_abbrev) }');
  1472. Add(' .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }');
  1473. Add(' .debug_frame 0 : { *(.debug_frame) }');
  1474. Add(' .debug_str 0 : { *(.debug_str) }');
  1475. Add(' .debug_loc 0 : { *(.debug_loc) }');
  1476. Add(' .debug_macinfo 0 : { *(.debug_macinfo) }');
  1477. Add(' /* SGI/MIPS DWARF 2 extensions */');
  1478. Add(' .debug_weaknames 0 : { *(.debug_weaknames) }');
  1479. Add(' .debug_funcnames 0 : { *(.debug_funcnames) }');
  1480. Add(' .debug_typenames 0 : { *(.debug_typenames) }');
  1481. Add(' .debug_varnames 0 : { *(.debug_varnames) }');
  1482. Add(' /* DWARF 3 */');
  1483. Add(' .debug_pubtypes 0 : { *(.debug_pubtypes) }');
  1484. Add(' .debug_ranges 0 : { *(.debug_ranges) }');
  1485. Add(' /* DWARF Extension. */');
  1486. Add(' .debug_macro 0 : { *(.debug_macro) }');
  1487. Add(' .debug_addr 0 : { *(.debug_addr) }');
  1488. Add(' .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }');
  1489. Add(' .xt.lit 0 : { KEEP (*(.xt.lit .xt.lit.* .gnu.linkonce.p.*)) }');
  1490. Add(' .xt.insn 0 : { KEEP (*(.xt.insn .gnu.linkonce.x.*)) }');
  1491. Add(' .xt.prop 0 : { KEEP (*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*)) }');
  1492. Add(' /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }');
  1493. Add('}');
  1494. end;
  1495. {$endif XTENSA}
  1496. { Write and Close response }
  1497. linkres.writetodisk;
  1498. linkres.free;
  1499. WriteResponseFile:=True;
  1500. end;
  1501. function TlinkerEmbedded.MakeExecutable:boolean;
  1502. var
  1503. binstr,
  1504. cmdstr,
  1505. mapstr: TCmdStr;
  1506. success : boolean;
  1507. StaticStr,
  1508. GCSectionsStr,
  1509. DynLinkStr,
  1510. StripStr,
  1511. FixedExeFileName: string;
  1512. begin
  1513. { for future use }
  1514. StaticStr:='';
  1515. StripStr:='';
  1516. mapstr:='';
  1517. DynLinkStr:='';
  1518. FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')));
  1519. GCSectionsStr:='--gc-sections';
  1520. //if not(cs_link_extern in current_settings.globalswitches) then
  1521. if not(cs_link_nolink in current_settings.globalswitches) then
  1522. Message1(exec_i_linking,current_module.exefilename);
  1523. if (cs_link_map in current_settings.globalswitches) then
  1524. mapstr:='-Map '+maybequoted(ChangeFileExt(current_module.exefilename,'.map'));
  1525. { Write used files and libraries }
  1526. WriteResponseFile();
  1527. { Call linker }
  1528. SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
  1529. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  1530. if not(cs_link_on_target in current_settings.globalswitches) then
  1531. begin
  1532. Replace(cmdstr,'$EXE',FixedExeFileName);
  1533. Replace(cmdstr,'$RES',(maybequoted(ScriptFixFileName(outputexedir+Info.ResName))));
  1534. Replace(cmdstr,'$STATIC',StaticStr);
  1535. Replace(cmdstr,'$STRIP',StripStr);
  1536. Replace(cmdstr,'$MAP',mapstr);
  1537. Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
  1538. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  1539. end
  1540. else
  1541. begin
  1542. Replace(cmdstr,'$EXE',FixedExeFileName);
  1543. Replace(cmdstr,'$RES',maybequoted(ScriptFixFileName(outputexedir+Info.ResName)));
  1544. Replace(cmdstr,'$STATIC',StaticStr);
  1545. Replace(cmdstr,'$STRIP',StripStr);
  1546. Replace(cmdstr,'$MAP',mapstr);
  1547. Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
  1548. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  1549. end;
  1550. success:=DoExec(FindUtil(utilsprefix+BinStr),cmdstr,true,false);
  1551. { Remove ReponseFile }
  1552. if success and not(cs_link_nolink in current_settings.globalswitches) then
  1553. DeleteFile(outputexedir+Info.ResName);
  1554. { Post process }
  1555. if success and not(cs_link_nolink in current_settings.globalswitches) then
  1556. success:=PostProcessExecutable(FixedExeFileName,false);
  1557. if success and (target_info.system in [system_arm_embedded,system_avr_embedded,system_mipsel_embedded,system_xtensa_embedded]) then
  1558. begin
  1559. success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O ihex '+
  1560. FixedExeFileName+' '+
  1561. maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.hex'))),true,false);
  1562. if success then
  1563. success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+
  1564. FixedExeFileName+' '+
  1565. maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin'))),true,false);
  1566. end;
  1567. MakeExecutable:=success; { otherwise a recursive call to link method }
  1568. end;
  1569. function TLinkerEmbedded.postprocessexecutable(const fn : string;isdll:boolean):boolean;
  1570. type
  1571. TElf32header=packed record
  1572. magic0123 : longint;
  1573. file_class : byte;
  1574. data_encoding : byte;
  1575. file_version : byte;
  1576. padding : array[$07..$0f] of byte;
  1577. e_type : word;
  1578. e_machine : word;
  1579. e_version : longint;
  1580. e_entry : longint; { entrypoint }
  1581. e_phoff : longint; { program header offset }
  1582. e_shoff : longint; { sections header offset }
  1583. e_flags : longint;
  1584. e_ehsize : word; { elf header size in bytes }
  1585. e_phentsize : word; { size of an entry in the program header array }
  1586. e_phnum : word; { 0..e_phnum-1 of entrys }
  1587. e_shentsize : word; { size of an entry in sections header array }
  1588. e_shnum : word; { 0..e_shnum-1 of entrys }
  1589. e_shstrndx : word; { index of string section header }
  1590. end;
  1591. TElf32sechdr=packed record
  1592. sh_name : longint;
  1593. sh_type : longint;
  1594. sh_flags : longint;
  1595. sh_addr : longint;
  1596. sh_offset : longint;
  1597. sh_size : longint;
  1598. sh_link : longint;
  1599. sh_info : longint;
  1600. sh_addralign : longint;
  1601. sh_entsize : longint;
  1602. end;
  1603. function MayBeSwapHeader(h : telf32header) : telf32header;
  1604. begin
  1605. result:=h;
  1606. if source_info.endian<>target_info.endian then
  1607. with h do
  1608. begin
  1609. result.e_type:=swapendian(e_type);
  1610. result.e_machine:=swapendian(e_machine);
  1611. result.e_version:=swapendian(e_version);
  1612. result.e_entry:=swapendian(e_entry);
  1613. result.e_phoff:=swapendian(e_phoff);
  1614. result.e_shoff:=swapendian(e_shoff);
  1615. result.e_flags:=swapendian(e_flags);
  1616. result.e_ehsize:=swapendian(e_ehsize);
  1617. result.e_phentsize:=swapendian(e_phentsize);
  1618. result.e_phnum:=swapendian(e_phnum);
  1619. result.e_shentsize:=swapendian(e_shentsize);
  1620. result.e_shnum:=swapendian(e_shnum);
  1621. result.e_shstrndx:=swapendian(e_shstrndx);
  1622. end;
  1623. end;
  1624. function MaybeSwapSecHeader(h : telf32sechdr) : telf32sechdr;
  1625. begin
  1626. result:=h;
  1627. if source_info.endian<>target_info.endian then
  1628. with h do
  1629. begin
  1630. result.sh_name:=swapendian(sh_name);
  1631. result.sh_type:=swapendian(sh_type);
  1632. result.sh_flags:=swapendian(sh_flags);
  1633. result.sh_addr:=swapendian(sh_addr);
  1634. result.sh_offset:=swapendian(sh_offset);
  1635. result.sh_size:=swapendian(sh_size);
  1636. result.sh_link:=swapendian(sh_link);
  1637. result.sh_info:=swapendian(sh_info);
  1638. result.sh_addralign:=swapendian(sh_addralign);
  1639. result.sh_entsize:=swapendian(sh_entsize);
  1640. end;
  1641. end;
  1642. var
  1643. f : file;
  1644. function ReadSectionName(pos : longint) : String;
  1645. var
  1646. oldpos : longint;
  1647. c : char;
  1648. begin
  1649. oldpos:=filepos(f);
  1650. seek(f,pos);
  1651. Result:='';
  1652. while true do
  1653. begin
  1654. blockread(f,c,1);
  1655. if c=#0 then
  1656. break;
  1657. Result:=Result+c;
  1658. end;
  1659. seek(f,oldpos);
  1660. end;
  1661. var
  1662. elfheader : TElf32header;
  1663. secheader : TElf32sechdr;
  1664. i : longint;
  1665. stringoffset : longint;
  1666. secname : string;
  1667. begin
  1668. postprocessexecutable:=false;
  1669. { open file }
  1670. assign(f,fn);
  1671. {$push}{$I-}
  1672. reset(f,1);
  1673. if ioresult<>0 then
  1674. Message1(execinfo_f_cant_open_executable,fn);
  1675. { read header }
  1676. blockread(f,elfheader,sizeof(tElf32header));
  1677. elfheader:=MayBeSwapHeader(elfheader);
  1678. seek(f,elfheader.e_shoff);
  1679. { read string section header }
  1680. seek(f,elfheader.e_shoff+sizeof(TElf32sechdr)*elfheader.e_shstrndx);
  1681. blockread(f,secheader,sizeof(secheader));
  1682. secheader:=MaybeSwapSecHeader(secheader);
  1683. stringoffset:=secheader.sh_offset;
  1684. seek(f,elfheader.e_shoff);
  1685. status.datasize:=0;
  1686. for i:=0 to elfheader.e_shnum-1 do
  1687. begin
  1688. blockread(f,secheader,sizeof(secheader));
  1689. secheader:=MaybeSwapSecHeader(secheader);
  1690. secname:=ReadSectionName(stringoffset+secheader.sh_name);
  1691. if secname='.text' then
  1692. begin
  1693. Message1(execinfo_x_codesize,tostr(secheader.sh_size));
  1694. status.codesize:=secheader.sh_size;
  1695. end
  1696. else if secname='.data' then
  1697. begin
  1698. Message1(execinfo_x_initdatasize,tostr(secheader.sh_size));
  1699. inc(status.datasize,secheader.sh_size);
  1700. end
  1701. else if secname='.bss' then
  1702. begin
  1703. Message1(execinfo_x_uninitdatasize,tostr(secheader.sh_size));
  1704. inc(status.datasize,secheader.sh_size);
  1705. end;
  1706. end;
  1707. close(f);
  1708. {$pop}
  1709. if ioresult<>0 then
  1710. ;
  1711. postprocessexecutable:=true;
  1712. end;
  1713. {*****************************************************************************
  1714. TlinkerEmbedded_SdccSdld
  1715. *****************************************************************************}
  1716. function TlinkerEmbedded_SdccSdld.WriteResponseFile: Boolean;
  1717. Var
  1718. linkres : TLinkRes;
  1719. i : longint;
  1720. HPath : TCmdStrListItem;
  1721. s,s1,s2 : TCmdStr;
  1722. prtobj,
  1723. cprtobj : string[80];
  1724. linklibc : boolean;
  1725. found1,
  1726. found2 : boolean;
  1727. {$if defined(ARM)}
  1728. LinkStr : string;
  1729. {$endif}
  1730. begin
  1731. WriteResponseFile:=False;
  1732. linklibc:=(SharedLibFiles.Find('c')<>nil);
  1733. prtobj:='prt0';
  1734. cprtobj:='cprt0';
  1735. if linklibc then
  1736. prtobj:=cprtobj;
  1737. { Open link.res file }
  1738. LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
  1739. { Write path to search libraries }
  1740. (* HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);
  1741. while assigned(HPath) do
  1742. begin
  1743. s:=HPath.Str;
  1744. if (cs_link_on_target in current_settings.globalswitches) then
  1745. s:=ScriptFixFileName(s);
  1746. LinkRes.Add('-L'+s);
  1747. HPath:=TCmdStrListItem(HPath.Next);
  1748. end;
  1749. HPath:=TCmdStrListItem(LibrarySearchPath.First);
  1750. while assigned(HPath) do
  1751. begin
  1752. s:=HPath.Str;
  1753. if s<>'' then
  1754. LinkRes.Add('SEARCH_DIR("'+s+'")');
  1755. HPath:=TCmdStrListItem(HPath.Next);
  1756. end;
  1757. LinkRes.Add('INPUT (');
  1758. { add objectfiles, start with prt0 always }*)
  1759. //s:=FindObjectFile('prt0','',false);
  1760. if prtobj<>'' then
  1761. begin
  1762. s:=FindObjectFile(prtobj,'',false);
  1763. LinkRes.AddFileName(s);
  1764. end;
  1765. { try to add crti and crtbegin if linking to C }
  1766. if linklibc then
  1767. begin
  1768. if librarysearchpath.FindFile('crtbegin.o',false,s) then
  1769. LinkRes.AddFileName(s);
  1770. if librarysearchpath.FindFile('crti.o',false,s) then
  1771. LinkRes.AddFileName(s);
  1772. end;
  1773. while not ObjectFiles.Empty do
  1774. begin
  1775. s:=ObjectFiles.GetFirst;
  1776. if s<>'' then
  1777. begin
  1778. { vlink doesn't use SEARCH_DIR for object files }
  1779. if not(cs_link_on_target in current_settings.globalswitches) then
  1780. s:=FindObjectFile(s,'',false);
  1781. LinkRes.AddFileName((maybequoted(s)));
  1782. end;
  1783. end;
  1784. { Write staticlibraries }
  1785. if not StaticLibFiles.Empty then
  1786. begin
  1787. { vlink doesn't need, and doesn't support GROUP }
  1788. { if (cs_link_on_target in current_settings.globalswitches) then
  1789. begin
  1790. LinkRes.Add(')');
  1791. LinkRes.Add('GROUP(');
  1792. end;}
  1793. while not StaticLibFiles.Empty do
  1794. begin
  1795. S:=StaticLibFiles.GetFirst;
  1796. LinkRes.AddFileName((maybequoted(s)));
  1797. end;
  1798. end;
  1799. (* if (cs_link_on_target in current_settings.globalswitches) then
  1800. begin
  1801. LinkRes.Add(')');
  1802. { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
  1803. here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
  1804. linklibc:=false;
  1805. while not SharedLibFiles.Empty do
  1806. begin
  1807. S:=SharedLibFiles.GetFirst;
  1808. if s<>'c' then
  1809. begin
  1810. i:=Pos(target_info.sharedlibext,S);
  1811. if i>0 then
  1812. Delete(S,i,255);
  1813. LinkRes.Add('-l'+s);
  1814. end
  1815. else
  1816. begin
  1817. LinkRes.Add('-l'+s);
  1818. linklibc:=true;
  1819. end;
  1820. end;
  1821. { be sure that libc&libgcc is the last lib }
  1822. if linklibc then
  1823. begin
  1824. LinkRes.Add('-lc');
  1825. LinkRes.Add('-lgcc');
  1826. end;
  1827. end
  1828. else
  1829. begin
  1830. while not SharedLibFiles.Empty do
  1831. begin
  1832. S:=SharedLibFiles.GetFirst;
  1833. LinkRes.Add('lib'+s+target_info.staticlibext);
  1834. end;
  1835. LinkRes.Add(')');
  1836. end;*)
  1837. { objects which must be at the end }
  1838. (*if linklibc then
  1839. begin
  1840. found1:=librarysearchpath.FindFile('crtend.o',false,s1);
  1841. found2:=librarysearchpath.FindFile('crtn.o',false,s2);
  1842. if found1 or found2 then
  1843. begin
  1844. LinkRes.Add('INPUT(');
  1845. if found1 then
  1846. LinkRes.AddFileName(s1);
  1847. if found2 then
  1848. LinkRes.AddFileName(s2);
  1849. LinkRes.Add(')');
  1850. end;
  1851. end;*)
  1852. { Write and Close response }
  1853. linkres.writetodisk;
  1854. linkres.free;
  1855. WriteResponseFile:=True;
  1856. end;
  1857. procedure TlinkerEmbedded_SdccSdld.SetDefaultInfo;
  1858. const
  1859. {$if defined(Z80)}
  1860. ExeName='sdcc-sdldz80';
  1861. {$else}
  1862. ExeName='sdcc-sdld';
  1863. {$endif}
  1864. begin
  1865. with Info do
  1866. begin
  1867. ExeCmd[1]:=ExeName+' -n $OPT -i $MAP $EXE -f $RES'
  1868. //-g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
  1869. end;
  1870. end;
  1871. function TlinkerEmbedded_SdccSdld.MakeExecutable: boolean;
  1872. var
  1873. binstr,
  1874. cmdstr,
  1875. mapstr: TCmdStr;
  1876. success : boolean;
  1877. StaticStr,
  1878. GCSectionsStr,
  1879. DynLinkStr,
  1880. StripStr,
  1881. FixedExeFileName: string;
  1882. begin
  1883. { for future use }
  1884. StaticStr:='';
  1885. StripStr:='';
  1886. mapstr:='';
  1887. DynLinkStr:='';
  1888. FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.ihx')));
  1889. (* GCSectionsStr:='--gc-sections';
  1890. //if not(cs_link_extern in current_settings.globalswitches) then
  1891. if not(cs_link_nolink in current_settings.globalswitches) then
  1892. Message1(exec_i_linking,current_module.exefilename);*)
  1893. if (cs_link_map in current_settings.globalswitches) then
  1894. mapstr:='-mw';
  1895. { Write used files and libraries }
  1896. WriteResponseFile();
  1897. { Call linker }
  1898. SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
  1899. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  1900. if not(cs_link_on_target in current_settings.globalswitches) then
  1901. begin
  1902. Replace(cmdstr,'$EXE',FixedExeFileName);
  1903. Replace(cmdstr,'$RES',(maybequoted(ScriptFixFileName(outputexedir+Info.ResName))));
  1904. Replace(cmdstr,'$STATIC',StaticStr);
  1905. Replace(cmdstr,'$STRIP',StripStr);
  1906. Replace(cmdstr,'$MAP',mapstr);
  1907. Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
  1908. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  1909. end
  1910. else
  1911. begin
  1912. Replace(cmdstr,'$EXE',FixedExeFileName);
  1913. Replace(cmdstr,'$RES',maybequoted(ScriptFixFileName(outputexedir+Info.ResName)));
  1914. Replace(cmdstr,'$STATIC',StaticStr);
  1915. Replace(cmdstr,'$STRIP',StripStr);
  1916. Replace(cmdstr,'$MAP',mapstr);
  1917. Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
  1918. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  1919. end;
  1920. success:=DoExec(FindUtil(utilsprefix+BinStr),cmdstr,true,false);
  1921. { Remove ReponseFile }
  1922. if success and not(cs_link_nolink in current_settings.globalswitches) then
  1923. DeleteFile(outputexedir+Info.ResName);
  1924. (* { Post process }
  1925. if success and not(cs_link_nolink in current_settings.globalswitches) then
  1926. success:=PostProcessExecutable(FixedExeFileName,false);
  1927. if success and (target_info.system in [system_arm_embedded,system_avr_embedded,system_mipsel_embedded,system_xtensa_embedded]) then
  1928. begin
  1929. success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O ihex '+
  1930. FixedExeFileName+' '+
  1931. maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.hex'))),true,false);
  1932. if success then
  1933. success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+
  1934. FixedExeFileName+' '+
  1935. maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin'))),true,false);
  1936. end;*)
  1937. MakeExecutable:=success; { otherwise a recursive call to link method }
  1938. end;
  1939. {*****************************************************************************
  1940. Initialize
  1941. *****************************************************************************}
  1942. initialization
  1943. {$ifdef arm}
  1944. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1945. RegisterTarget(system_arm_embedded_info);
  1946. {$endif arm}
  1947. {$ifdef avr}
  1948. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1949. RegisterTarget(system_avr_embedded_info);
  1950. {$endif avr}
  1951. {$ifdef i386}
  1952. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1953. RegisterTarget(system_i386_embedded_info);
  1954. {$endif i386}
  1955. {$ifdef x86_64}
  1956. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1957. RegisterTarget(system_x86_64_embedded_info);
  1958. {$endif x86_64}
  1959. {$ifdef i8086}
  1960. { no need to register linker ld_embedded, because i8086_embedded uses the
  1961. regular msdos linker. In case a flat binary, relocated for a specific
  1962. segment address is needed (e.g. for a BIOS or a real mode bootloader), it
  1963. can be produced post-compilation with exe2bin or a similar tool. }
  1964. RegisterTarget(system_i8086_embedded_info);
  1965. {$endif i8086}
  1966. {$ifdef mipsel}
  1967. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1968. RegisterTarget(system_mipsel_embedded_info);
  1969. {$endif mipsel}
  1970. {$ifdef m68k}
  1971. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1972. RegisterTarget(system_m68k_embedded_info);
  1973. {$endif m68k}
  1974. {$ifdef riscv32}
  1975. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1976. RegisterTarget(system_riscv32_embedded_info);
  1977. {$endif riscv32}
  1978. {$ifdef riscv64}
  1979. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1980. RegisterTarget(system_riscv64_embedded_info);
  1981. {$endif riscv64}
  1982. {$ifdef xtensa}
  1983. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1984. RegisterTarget(system_xtensa_embedded_info);
  1985. {$endif xtensa}
  1986. {$ifdef z80}
  1987. RegisterLinker(ld_embedded,TlinkerEmbedded_SdccSdld);
  1988. RegisterTarget(system_z80_embedded_info);
  1989. {$endif z80}
  1990. end.