t_embed.pas 67 KB

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