t_embed.pas 68 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092
  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(' /* DWARF 3 */');
  1013. Add(' .debug_pubtypes 0 : { *(.debug_pubtypes) }');
  1014. Add(' .debug_ranges 0 : { *(.debug_ranges) }');
  1015. Add(' /* DWARF Extension. */');
  1016. Add(' .debug_macro 0 : { *(.debug_macro) }');
  1017. Add('}');
  1018. end;
  1019. {$endif AVR}
  1020. {$ifdef MIPSEL}
  1021. case current_settings.controllertype of
  1022. ct_none:
  1023. begin
  1024. end;
  1025. ct_pic32mx110f016b,
  1026. ct_pic32mx110f016c,
  1027. ct_pic32mx110f016d,
  1028. ct_pic32mx120f032b,
  1029. ct_pic32mx120f032c,
  1030. ct_pic32mx120f032d,
  1031. ct_pic32mx130f064b,
  1032. ct_pic32mx130f064c,
  1033. ct_pic32mx130f064d,
  1034. ct_pic32mx150f128b,
  1035. ct_pic32mx150f128c,
  1036. ct_pic32mx150f128d,
  1037. ct_pic32mx210f016b,
  1038. ct_pic32mx210f016c,
  1039. ct_pic32mx210f016d,
  1040. ct_pic32mx220f032b,
  1041. ct_pic32mx220f032c,
  1042. ct_pic32mx220f032d,
  1043. ct_pic32mx230f064b,
  1044. ct_pic32mx230f064c,
  1045. ct_pic32mx230f064d,
  1046. ct_pic32mx250f128b,
  1047. ct_pic32mx250f128c,
  1048. ct_pic32mx250f128d,
  1049. ct_pic32mx775f256h,
  1050. ct_pic32mx775f256l,
  1051. ct_pic32mx775f512h,
  1052. ct_pic32mx775f512l,
  1053. ct_pic32mx795f512h,
  1054. ct_pic32mx795f512l:
  1055. begin
  1056. with embedded_controllers[current_settings.controllertype] do
  1057. with linkres do
  1058. begin
  1059. Add('OUTPUT_FORMAT("elf32-tradlittlemips")');
  1060. Add('OUTPUT_ARCH(pic32mx)');
  1061. Add('ENTRY(_reset)');
  1062. Add('PROVIDE(_vector_spacing = 0x00000001);');
  1063. Add('_ebase_address = 0x'+IntToHex(flashbase,8)+';');
  1064. Add('_RESET_ADDR = 0xBFC00000;');
  1065. Add('_BEV_EXCPT_ADDR = 0xBFC00380;');
  1066. Add('_DBG_EXCPT_ADDR = 0xBFC00480;');
  1067. Add('_GEN_EXCPT_ADDR = _ebase_address + 0x180;');
  1068. Add('MEMORY');
  1069. Add('{');
  1070. if flashsize<>0 then
  1071. begin
  1072. Add(' kseg0_program_mem : ORIGIN = 0x'+IntToHex(flashbase,8)+', LENGTH = 0x'+IntToHex(flashsize,8));
  1073. //TODO This should better be placed into the controllertype records
  1074. Add(' kseg1_boot_mem : ORIGIN = 0xBFC00000, LENGTH = 0xbef');
  1075. Add(' config3 : ORIGIN = 0xBFC00BF0, LENGTH = 0x4');
  1076. Add(' config2 : ORIGIN = 0xBFC00BF4, LENGTH = 0x4');
  1077. Add(' config1 : ORIGIN = 0xBFC00BF8, LENGTH = 0x4');
  1078. Add(' config0 : ORIGIN = 0xBFC00BFC, LENGTH = 0x4');
  1079. end;
  1080. Add(' ram : ORIGIN = 0x' + IntToHex(srambase,8)
  1081. + ', LENGTH = 0x' + IntToHex(sramsize,8));
  1082. Add('}');
  1083. Add('_stack_top = 0x' + IntToHex(sramsize+srambase,8) + ';');
  1084. end;
  1085. end
  1086. end;
  1087. with linkres do
  1088. begin
  1089. Add('SECTIONS');
  1090. Add('{');
  1091. Add(' .reset _RESET_ADDR :');
  1092. Add(' {');
  1093. Add(' KEEP(*(.reset .reset.*))');
  1094. Add(' KEEP(*(.startup .startup.*))');
  1095. Add(' } > kseg1_boot_mem');
  1096. Add(' .bev_excpt _BEV_EXCPT_ADDR :');
  1097. Add(' {');
  1098. Add(' KEEP(*(.bev_handler))');
  1099. Add(' } > kseg1_boot_mem');
  1100. Add(' .text :');
  1101. Add(' {');
  1102. Add(' _text_start = .;');
  1103. Add(' . = _text_start + 0x180;');
  1104. Add(' KEEP(*(.gen_handler))');
  1105. Add(' . = _text_start + 0x200;');
  1106. Add(' KEEP(*(.init .init.*))');
  1107. Add(' *(.text .text.*)');
  1108. Add(' *(.strings)');
  1109. Add(' *(.rodata .rodata.*)');
  1110. Add(' *(.comment)');
  1111. Add(' _etext = .;');
  1112. if embedded_controllers[current_settings.controllertype].flashsize<>0 then
  1113. begin
  1114. Add(' } >kseg0_program_mem');
  1115. end
  1116. else
  1117. begin
  1118. Add(' } >ram');
  1119. end;
  1120. Add(' .note.gnu.build-id : { *(.note.gnu.build-id) }');
  1121. Add(' .data :');
  1122. Add(' {');
  1123. Add(' _data = .;');
  1124. Add(' *(.data .data.*)');
  1125. Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
  1126. Add(' . = .;');
  1127. Add(' _gp = ALIGN(16) + 0x7ff0;');
  1128. Add(' _edata = .;');
  1129. if embedded_controllers[current_settings.controllertype].flashsize<>0 then
  1130. begin
  1131. Add(' } >ram AT >kseg0_program_mem');
  1132. end
  1133. else
  1134. begin
  1135. Add(' } >ram');
  1136. end;
  1137. Add(' .config_BFC00BF0 : {');
  1138. Add(' KEEP(*(.config_BFC00BF0))');
  1139. Add(' } > config3');
  1140. Add(' .config_BFC00BF4 : {');
  1141. Add(' KEEP(*(.config_BFC00BF4))');
  1142. Add(' } > config2');
  1143. Add(' .config_BFC00BF8 : {');
  1144. Add(' KEEP(*(.config_BFC00BF8))');
  1145. Add(' } > config1');
  1146. Add(' .config_BFC00BFC : {');
  1147. Add(' KEEP(*(.config_BFC00BFC))');
  1148. Add(' } > config0');
  1149. Add(' .bss :');
  1150. Add(' {');
  1151. Add(' _bss_start = .;');
  1152. Add(' *(.bss .bss.*)');
  1153. Add(' *(COMMON)');
  1154. Add(' } >ram');
  1155. Add('. = ALIGN(4);');
  1156. Add('_bss_end = . ;');
  1157. Add(' .comment 0 : { *(.comment) }');
  1158. Add(' /* DWARF debug sections.');
  1159. Add(' Symbols in the DWARF debugging sections are relative to the beginning');
  1160. Add(' of the section so we begin them at 0. */');
  1161. Add(' /* DWARF 1 */');
  1162. Add(' .debug 0 : { *(.debug) }');
  1163. Add(' .line 0 : { *(.line) }');
  1164. Add(' /* GNU DWARF 1 extensions */');
  1165. Add(' .debug_srcinfo 0 : { *(.debug_srcinfo) }');
  1166. Add(' .debug_sfnames 0 : { *(.debug_sfnames) }');
  1167. Add(' /* DWARF 1.1 and DWARF 2 */');
  1168. Add(' .debug_aranges 0 : { *(.debug_aranges) }');
  1169. Add(' .debug_pubnames 0 : { *(.debug_pubnames) }');
  1170. Add(' /* DWARF 2 */');
  1171. Add(' .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }');
  1172. Add(' .debug_abbrev 0 : { *(.debug_abbrev) }');
  1173. Add(' /DISCARD/ : { *(.debug_line) }');
  1174. Add(' .debug_frame 0 : { *(.debug_frame) }');
  1175. Add(' .debug_str 0 : { *(.debug_str) }');
  1176. Add(' /DISCARD/ : { *(.debug_loc) }');
  1177. Add(' .debug_macinfo 0 : { *(.debug_macinfo) }');
  1178. Add(' /* SGI/MIPS DWARF 2 extensions */');
  1179. Add(' .debug_weaknames 0 : { *(.debug_weaknames) }');
  1180. Add(' .debug_funcnames 0 : { *(.debug_funcnames) }');
  1181. Add(' .debug_typenames 0 : { *(.debug_typenames) }');
  1182. Add(' .debug_varnames 0 : { *(.debug_varnames) }');
  1183. Add(' /* DWARF 3 */');
  1184. Add(' .debug_pubtypes 0 : { *(.debug_pubtypes) }');
  1185. Add(' .debug_ranges 0 : { *(.debug_ranges) }');
  1186. Add(' .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }');
  1187. Add(' .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }');
  1188. Add(' .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }');
  1189. Add(' .mdebug.abi32 : { KEEP(*(.mdebug.abi32)) }');
  1190. Add(' .mdebug.abiN32 : { KEEP(*(.mdebug.abiN32)) }');
  1191. Add(' .mdebug.abi64 : { KEEP(*(.mdebug.abi64)) }');
  1192. Add(' .mdebug.abiO64 : { KEEP(*(.mdebug.abiO64)) }');
  1193. Add(' .mdebug.eabi32 : { KEEP(*(.mdebug.eabi32)) }');
  1194. Add(' .mdebug.eabi64 : { KEEP(*(.mdebug.eabi64)) }');
  1195. Add(' /DISCARD/ : { *(.rel.dyn) }');
  1196. Add(' /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }');
  1197. Add('}');
  1198. Add('_end = .;');
  1199. end;
  1200. {$endif MIPSEL}
  1201. {$ifdef RISCV32}
  1202. with linkres do
  1203. begin
  1204. Add('OUTPUT_ARCH("riscv")');
  1205. Add('ENTRY(_START)');
  1206. Add('MEMORY');
  1207. with embedded_controllers[current_settings.controllertype] do
  1208. begin
  1209. Add('{');
  1210. Add(' flash (rx) : ORIGIN = 0x'+IntToHex(flashbase,6)+', LENGTH = 0x'+IntToHex(flashsize,6));
  1211. Add(' ram (rw!x) : ORIGIN = 0x'+IntToHex(srambase,6)+', LENGTH = 0x'+IntToHex(sramsize,6));
  1212. Add('}');
  1213. Add('_stack_top = 0x' + IntToHex(srambase+sramsize-1,4) + ';');
  1214. end;
  1215. Add('SECTIONS');
  1216. Add('{');
  1217. Add(' .text :');
  1218. Add(' {');
  1219. Add(' _text_start = .;');
  1220. Add(' KEEP(*(.init .init.*))');
  1221. Add(' *(.text .text.*)');
  1222. Add(' *(.strings)');
  1223. Add(' *(.rodata .rodata.*)');
  1224. Add(' *(.comment)');
  1225. Add(' . = ALIGN(4);');
  1226. Add(' _etext = .;');
  1227. if embedded_controllers[current_settings.controllertype].flashsize<>0 then
  1228. begin
  1229. Add(' } >flash');
  1230. //Add(' .note.gnu.build-id : { *(.note.gnu.build-id) } >flash ');
  1231. end
  1232. else
  1233. begin
  1234. Add(' } >ram');
  1235. //Add(' .note.gnu.build-id : { *(.note.gnu.build-id) } >ram ');
  1236. end;
  1237. Add(' .data :');
  1238. Add(' {');
  1239. Add(' _data = .;');
  1240. Add(' *(.data .data.*)');
  1241. Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
  1242. Add(' _edata = .;');
  1243. if embedded_controllers[current_settings.controllertype].flashsize<>0 then
  1244. begin
  1245. Add(' } >ram AT >flash');
  1246. end
  1247. else
  1248. begin
  1249. Add(' } >ram');
  1250. end;
  1251. Add(' .bss :');
  1252. Add(' {');
  1253. Add(' _bss_start = .;');
  1254. Add(' *(.bss .bss.*)');
  1255. Add(' *(COMMON)');
  1256. Add(' } >ram');
  1257. Add(' . = ALIGN(4);');
  1258. Add(' _bss_end = . ;');
  1259. Add(' /* Stabs debugging sections. */');
  1260. Add(' .stab 0 : { *(.stab) }');
  1261. Add(' .stabstr 0 : { *(.stabstr) }');
  1262. Add(' .stab.excl 0 : { *(.stab.excl) }');
  1263. Add(' .stab.exclstr 0 : { *(.stab.exclstr) }');
  1264. Add(' .stab.index 0 : { *(.stab.index) }');
  1265. Add(' .stab.indexstr 0 : { *(.stab.indexstr) }');
  1266. Add(' .comment 0 : { *(.comment) }');
  1267. Add(' /* DWARF debug sections.');
  1268. Add(' Symbols in the DWARF debugging sections are relative to the beginning');
  1269. Add(' of the section so we begin them at 0. */');
  1270. Add(' /* DWARF 1 */');
  1271. Add(' .debug 0 : { *(.debug) }');
  1272. Add(' .line 0 : { *(.line) }');
  1273. Add(' /* GNU DWARF 1 extensions */');
  1274. Add(' .debug_srcinfo 0 : { *(.debug_srcinfo) }');
  1275. Add(' .debug_sfnames 0 : { *(.debug_sfnames) }');
  1276. Add(' /* DWARF 1.1 and DWARF 2 */');
  1277. Add(' .debug_aranges 0 : { *(.debug_aranges) }');
  1278. Add(' .debug_pubnames 0 : { *(.debug_pubnames) }');
  1279. Add(' /* DWARF 2 */');
  1280. Add(' .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }');
  1281. Add(' .debug_abbrev 0 : { *(.debug_abbrev) }');
  1282. Add(' .debug_line 0 : { *(.debug_line) }');
  1283. Add(' .debug_frame 0 : { *(.debug_frame) }');
  1284. Add(' .debug_str 0 : { *(.debug_str) }');
  1285. Add(' .debug_loc 0 : { *(.debug_loc) }');
  1286. Add(' .debug_macinfo 0 : { *(.debug_macinfo) }');
  1287. Add(' /* SGI/MIPS DWARF 2 extensions */');
  1288. Add(' .debug_weaknames 0 : { *(.debug_weaknames) }');
  1289. Add(' .debug_funcnames 0 : { *(.debug_funcnames) }');
  1290. Add(' .debug_typenames 0 : { *(.debug_typenames) }');
  1291. Add(' .debug_varnames 0 : { *(.debug_varnames) }');
  1292. Add(' /* DWARF 3 */');
  1293. Add(' .debug_pubtypes 0 : { *(.debug_pubtypes) }');
  1294. Add(' .debug_ranges 0 : { *(.debug_ranges) }');
  1295. Add('}');
  1296. Add('_end = .;');
  1297. end;
  1298. {$endif RISCV32}
  1299. {$ifdef XTENSA}
  1300. with linkres do
  1301. begin
  1302. Add('/* Script for -z combreloc: combine and sort reloc sections */');
  1303. Add('/* Copyright (C) 2014-2018 Free Software Foundation, Inc.');
  1304. Add(' Copying and distribution of this script, with or without modification,');
  1305. Add(' are permitted in any medium without royalty provided the copyright');
  1306. Add(' notice and this notice are preserved. */');
  1307. Add('ENTRY(_start)');
  1308. 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");');
  1309. Add('SECTIONS');
  1310. Add('{');
  1311. Add(' /* Read-only sections, merged into text segment: */');
  1312. Add(' PROVIDE (__executable_start = 0x400000); . = 0x400000 + SIZEOF_HEADERS;');
  1313. Add(' .interp : { *(.interp) }');
  1314. Add(' .note.gnu.build-id : { *(.note.gnu.build-id) }');
  1315. Add(' .hash : { *(.hash) }');
  1316. Add(' .gnu.hash : { *(.gnu.hash) }');
  1317. Add(' .dynsym : { *(.dynsym) }');
  1318. Add(' .dynstr : { *(.dynstr) }');
  1319. Add(' .gnu.version : { *(.gnu.version) }');
  1320. Add(' .gnu.version_d : { *(.gnu.version_d) }');
  1321. Add(' .gnu.version_r : { *(.gnu.version_r) }');
  1322. Add(' .rela.dyn :');
  1323. Add(' {');
  1324. Add(' *(.rela.init)');
  1325. Add(' *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)');
  1326. Add(' *(.rela.fini)');
  1327. Add(' *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)');
  1328. Add(' *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)');
  1329. Add(' *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)');
  1330. Add(' *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)');
  1331. Add(' *(.rela.ctors)');
  1332. Add(' *(.rela.dtors)');
  1333. Add(' *(.rela.got)');
  1334. Add(' *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)');
  1335. Add(' }');
  1336. Add(' .rela.plt : { *(.rela.plt) }');
  1337. Add(' /* .plt* sections are embedded in .text */');
  1338. Add(' .text :');
  1339. Add(' {');
  1340. Add(' *(.got.plt* .plt*)');
  1341. Add(' KEEP (*(.init.literal))');
  1342. Add(' KEEP (*(SORT_NONE(.init)))');
  1343. Add(' *(.literal .text .stub .literal.* .text.* .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)');
  1344. Add(' /* .gnu.warning sections are handled specially by elf32.em. */');
  1345. Add(' *(.gnu.warning)');
  1346. Add(' KEEP (*(.fini.literal))');
  1347. Add(' KEEP (*(SORT_NONE(.fini)))');
  1348. Add(' } =0');
  1349. Add(' PROVIDE (__etext = .);');
  1350. Add(' PROVIDE (_etext = .);');
  1351. Add(' PROVIDE (etext = .);');
  1352. Add(' .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }');
  1353. Add(' .rodata1 : { *(.rodata1) }');
  1354. Add(' .got.loc : { *(.got.loc) }');
  1355. Add(' .xt_except_table : ONLY_IF_RO { KEEP (*(.xt_except_table .xt_except_table.* .gnu.linkonce.e.*)) }');
  1356. Add(' .eh_frame_hdr : { *(.eh_frame_hdr) }');
  1357. Add(' .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }');
  1358. Add(' .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }');
  1359. Add(' /* Adjust the address for the data segment. We want to adjust up to');
  1360. Add(' the same address within the page on the next page up. */');
  1361. Add(' . = ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1));');
  1362. Add(' /* Exception handling */');
  1363. Add(' .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }');
  1364. Add(' .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }');
  1365. Add(' /* Thread Local Storage sections */');
  1366. Add(' .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }');
  1367. Add(' .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }');
  1368. Add(' .preinit_array :');
  1369. Add(' {');
  1370. Add(' PROVIDE_HIDDEN (__preinit_array_start = .);');
  1371. Add(' KEEP (*(.preinit_array))');
  1372. Add(' PROVIDE_HIDDEN (__preinit_array_end = .);');
  1373. Add(' }');
  1374. Add(' .init_array :');
  1375. Add(' {');
  1376. Add(' PROVIDE_HIDDEN (__init_array_start = .);');
  1377. Add(' KEEP (*(SORT(.init_array.*)))');
  1378. Add(' KEEP (*(.init_array))');
  1379. Add(' PROVIDE_HIDDEN (__init_array_end = .);');
  1380. Add(' }');
  1381. Add(' .fini_array :');
  1382. Add(' {');
  1383. Add(' PROVIDE_HIDDEN (__fini_array_start = .);');
  1384. Add(' KEEP (*(SORT(.fini_array.*)))');
  1385. Add(' KEEP (*(.fini_array))');
  1386. Add(' PROVIDE_HIDDEN (__fini_array_end = .);');
  1387. Add(' }');
  1388. Add(' .ctors :');
  1389. Add(' {');
  1390. Add(' /* gcc uses crtbegin.o to find the start of');
  1391. Add(' the constructors, so we make sure it is');
  1392. Add(' first. Because this is a wildcard, it');
  1393. Add(' doesn''t matter if the user does not');
  1394. Add(' actually link against crtbegin.o; the');
  1395. Add(' linker won''t look for a file to match a');
  1396. Add(' wildcard. The wildcard also means that it');
  1397. Add(' doesn''t matter which directory crtbegin.o');
  1398. Add(' is in. */');
  1399. Add(' KEEP (*crtbegin.o(.ctors))');
  1400. Add(' KEEP (*crtbegin?.o(.ctors))');
  1401. Add(' /* We don''t want to include the .ctor section from');
  1402. Add(' the crtend.o file until after the sorted ctors.');
  1403. Add(' The .ctor section from the crtend file contains the');
  1404. Add(' end of ctors marker and it must be last */');
  1405. Add(' KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))');
  1406. Add(' KEEP (*(SORT(.ctors.*)))');
  1407. Add(' KEEP (*(.ctors))');
  1408. Add(' }');
  1409. Add(' .dtors :');
  1410. Add(' {');
  1411. Add(' KEEP (*crtbegin.o(.dtors))');
  1412. Add(' KEEP (*crtbegin?.o(.dtors))');
  1413. Add(' KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))');
  1414. Add(' KEEP (*(SORT(.dtors.*)))');
  1415. Add(' KEEP (*(.dtors))');
  1416. Add(' }');
  1417. Add(' .jcr : { KEEP (*(.jcr)) }');
  1418. 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.*) }');
  1419. Add(' .xt_except_table : ONLY_IF_RW { KEEP (*(.xt_except_table .xt_except_table.* .gnu.linkonce.e.*)) }');
  1420. Add(' .dynamic : { *(.dynamic) }');
  1421. Add(' .got : { *(.got) }');
  1422. Add(' .data :');
  1423. Add(' {');
  1424. Add(' *(.data .data.* .gnu.linkonce.d.*)');
  1425. Add(' SORT(CONSTRUCTORS)');
  1426. Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
  1427. Add(' }');
  1428. Add(' .data1 : { *(.data1) }');
  1429. Add(' .xt_except_desc :');
  1430. Add(' {');
  1431. Add(' *(.xt_except_desc .xt_except_desc.* .gnu.linkonce.h.*)');
  1432. Add(' *(.xt_except_desc_end)');
  1433. Add(' }');
  1434. Add(' .lit4 :');
  1435. Add(' {');
  1436. Add(' PROVIDE (_lit4_start = .);');
  1437. Add(' *(.lit4 .lit4.* .gnu.linkonce.lit4.*)');
  1438. Add(' PROVIDE (_lit4_end = .);');
  1439. Add(' }');
  1440. Add(' _edata = .; PROVIDE (edata = .);');
  1441. Add(' __bss_start = .;');
  1442. Add(' .bss :');
  1443. Add(' {');
  1444. Add(' *(.dynbss)');
  1445. Add(' *(.bss .bss.* .gnu.linkonce.b.*)');
  1446. Add(' *(COMMON)');
  1447. Add(' /* Align here to ensure that the .bss section occupies space up to');
  1448. Add(' _end. Align after .bss to ensure correct alignment even if the');
  1449. Add(' .bss section disappears because there are no input sections.');
  1450. Add(' FIXME: Why do we need it? When there is no .bss section, we don''t');
  1451. Add(' pad the .data section. */');
  1452. Add(' . = ALIGN(. != 0 ? 32 / 8 : 1);');
  1453. Add(' }');
  1454. Add(' . = ALIGN(32 / 8);');
  1455. Add(' . = ALIGN(32 / 8);');
  1456. Add(' _end = .; PROVIDE (end = .);');
  1457. Add(' /* Stabs debugging sections. */');
  1458. Add(' .stab 0 : { *(.stab) }');
  1459. Add(' .stabstr 0 : { *(.stabstr) }');
  1460. Add(' .stab.excl 0 : { *(.stab.excl) }');
  1461. Add(' .stab.exclstr 0 : { *(.stab.exclstr) }');
  1462. Add(' .stab.index 0 : { *(.stab.index) }');
  1463. Add(' .stab.indexstr 0 : { *(.stab.indexstr) }');
  1464. Add(' .comment 0 : { *(.comment) }');
  1465. Add(' /* DWARF debug sections.');
  1466. Add(' Symbols in the DWARF debugging sections are relative to the beginning');
  1467. Add(' of the section so we begin them at 0. */');
  1468. Add(' /* DWARF 1 */');
  1469. Add(' .debug 0 : { *(.debug) }');
  1470. Add(' .line 0 : { *(.line) }');
  1471. Add(' /* GNU DWARF 1 extensions */');
  1472. Add(' .debug_srcinfo 0 : { *(.debug_srcinfo) }');
  1473. Add(' .debug_sfnames 0 : { *(.debug_sfnames) }');
  1474. Add(' /* DWARF 1.1 and DWARF 2 */');
  1475. Add(' .debug_aranges 0 : { *(.debug_aranges) }');
  1476. Add(' .debug_pubnames 0 : { *(.debug_pubnames) }');
  1477. Add(' /* DWARF 2 */');
  1478. Add(' .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }');
  1479. Add(' .debug_abbrev 0 : { *(.debug_abbrev) }');
  1480. Add(' .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }');
  1481. Add(' .debug_frame 0 : { *(.debug_frame) }');
  1482. Add(' .debug_str 0 : { *(.debug_str) }');
  1483. Add(' .debug_loc 0 : { *(.debug_loc) }');
  1484. Add(' .debug_macinfo 0 : { *(.debug_macinfo) }');
  1485. Add(' /* SGI/MIPS DWARF 2 extensions */');
  1486. Add(' .debug_weaknames 0 : { *(.debug_weaknames) }');
  1487. Add(' .debug_funcnames 0 : { *(.debug_funcnames) }');
  1488. Add(' .debug_typenames 0 : { *(.debug_typenames) }');
  1489. Add(' .debug_varnames 0 : { *(.debug_varnames) }');
  1490. Add(' /* DWARF 3 */');
  1491. Add(' .debug_pubtypes 0 : { *(.debug_pubtypes) }');
  1492. Add(' .debug_ranges 0 : { *(.debug_ranges) }');
  1493. Add(' /* DWARF Extension. */');
  1494. Add(' .debug_macro 0 : { *(.debug_macro) }');
  1495. Add(' .debug_addr 0 : { *(.debug_addr) }');
  1496. Add(' .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }');
  1497. Add(' .xt.lit 0 : { KEEP (*(.xt.lit .xt.lit.* .gnu.linkonce.p.*)) }');
  1498. Add(' .xt.insn 0 : { KEEP (*(.xt.insn .gnu.linkonce.x.*)) }');
  1499. Add(' .xt.prop 0 : { KEEP (*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*)) }');
  1500. Add(' /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }');
  1501. Add('}');
  1502. end;
  1503. {$endif XTENSA}
  1504. { Write and Close response }
  1505. linkres.writetodisk;
  1506. linkres.free;
  1507. WriteResponseFile:=True;
  1508. end;
  1509. function TlinkerEmbedded.MakeExecutable:boolean;
  1510. var
  1511. binstr,
  1512. cmdstr,
  1513. mapstr: TCmdStr;
  1514. success : boolean;
  1515. StaticStr,
  1516. GCSectionsStr,
  1517. DynLinkStr,
  1518. StripStr,
  1519. FixedExeFileName: string;
  1520. begin
  1521. { for future use }
  1522. StaticStr:='';
  1523. StripStr:='';
  1524. mapstr:='';
  1525. DynLinkStr:='';
  1526. FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')));
  1527. GCSectionsStr:='--gc-sections';
  1528. //if not(cs_link_extern in current_settings.globalswitches) then
  1529. if not(cs_link_nolink in current_settings.globalswitches) then
  1530. Message1(exec_i_linking,current_module.exefilename);
  1531. if (cs_link_map in current_settings.globalswitches) then
  1532. mapstr:='-Map '+maybequoted(ChangeFileExt(current_module.exefilename,'.map'));
  1533. { Write used files and libraries }
  1534. WriteResponseFile();
  1535. { Call linker }
  1536. SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
  1537. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  1538. if not(cs_link_on_target in current_settings.globalswitches) then
  1539. begin
  1540. Replace(cmdstr,'$EXE',FixedExeFileName);
  1541. Replace(cmdstr,'$RES',(maybequoted(ScriptFixFileName(outputexedir+Info.ResName))));
  1542. Replace(cmdstr,'$STATIC',StaticStr);
  1543. Replace(cmdstr,'$STRIP',StripStr);
  1544. Replace(cmdstr,'$MAP',mapstr);
  1545. Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
  1546. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  1547. end
  1548. else
  1549. begin
  1550. Replace(cmdstr,'$EXE',FixedExeFileName);
  1551. Replace(cmdstr,'$RES',maybequoted(ScriptFixFileName(outputexedir+Info.ResName)));
  1552. Replace(cmdstr,'$STATIC',StaticStr);
  1553. Replace(cmdstr,'$STRIP',StripStr);
  1554. Replace(cmdstr,'$MAP',mapstr);
  1555. Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
  1556. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  1557. end;
  1558. success:=DoExec(FindUtil(utilsprefix+BinStr),cmdstr,true,false);
  1559. { Remove ReponseFile }
  1560. if success and not(cs_link_nolink in current_settings.globalswitches) then
  1561. DeleteFile(outputexedir+Info.ResName);
  1562. { Post process }
  1563. if success and not(cs_link_nolink in current_settings.globalswitches) then
  1564. success:=PostProcessExecutable(FixedExeFileName,false);
  1565. if success and (target_info.system in [system_arm_embedded,system_avr_embedded,system_mipsel_embedded,system_xtensa_embedded]) then
  1566. begin
  1567. success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O ihex '+
  1568. FixedExeFileName+' '+
  1569. maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.hex'))),true,false);
  1570. if success then
  1571. success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+
  1572. FixedExeFileName+' '+
  1573. maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin'))),true,false);
  1574. if success and (target_info.system in systems_support_uf2) and (cs_generate_uf2 in current_settings.globalswitches) then
  1575. success := GenerateUF2(maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin'))),
  1576. maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.uf2'))),
  1577. embedded_controllers[current_settings.controllertype].flashbase);
  1578. {$ifdef ARM}
  1579. if success and (current_settings.controllertype = ct_raspi2) then
  1580. success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+ FixedExeFileName + ' kernel7.img',true,false);
  1581. {$endif ARM}
  1582. end;
  1583. MakeExecutable:=success; { otherwise a recursive call to link method }
  1584. end;
  1585. function TLinkerEmbedded.postprocessexecutable(const fn : string;isdll:boolean):boolean;
  1586. begin
  1587. Result:=PostProcessELFExecutable(fn,isdll);
  1588. end;
  1589. function TlinkerEmbedded.GenerateUF2(binFile,uf2File : string;baseAddress : longWord):boolean;
  1590. type
  1591. TFamilies= record
  1592. k : String;
  1593. v : longWord;
  1594. end;
  1595. tuf2Block = record
  1596. magicStart0,
  1597. magicStart1,
  1598. flags,
  1599. targetAddr,
  1600. payloadSize,
  1601. blockNo,
  1602. numBlocks,
  1603. familyid : longWord;
  1604. data : array[0..255] of byte;
  1605. padding : array[0..511-256-32-4] of byte;
  1606. magicEnd : longWord;
  1607. end;
  1608. const
  1609. Families : array of TFamilies = (
  1610. (k:'SAMD21'; v:$68ed2b88),
  1611. (k:'SAML21'; v:$1851780a),
  1612. (k:'SAMD51'; v:$55114460),
  1613. (k:'NRF52'; v:$1b57745f),
  1614. (k:'STM32F0';v:$647824b6),
  1615. (k:'STM32F1';v:$5ee21072),
  1616. (k:'STM32F2';v:$5d1a0a2e),
  1617. (k:'STM32F3';v:$6b846188),
  1618. (k:'STM32F4';v:$57755a57),
  1619. (k:'STM32F7';v:$53b80f00),
  1620. (k:'STM32G0';v:$300f5633),
  1621. (k:'STM32G4';v:$4c71240a),
  1622. (k:'STM32H7';v:$6db66082),
  1623. (k:'STM32L0';v:$202e3a91),
  1624. (k:'STM32L1';v:$1e1f432d),
  1625. (k:'STM32L4';v:$00ff6919),
  1626. (k:'STM32L5';v:$04240bdf),
  1627. (k:'STM32WB';v:$70d16653),
  1628. (k:'STM32WL';v:$21460ff0)
  1629. );
  1630. var
  1631. f,g : file;
  1632. uf2block : Tuf2Block;
  1633. totalRead,numRead : longWord;
  1634. familyId,i : longWord;
  1635. ExtraOptions : String;
  1636. begin
  1637. if pos('-Ttext=',Info.ExtraOptions) > 0 then
  1638. begin
  1639. ExtraOptions := copy(Info.ExtraOptions,pos('-Ttext=',Info.ExtraOptions)+7,length(Info.ExtraOptions));
  1640. for i := 1 to length(ExtraOptions) do
  1641. if pos(copy(ExtraOptions,i,1),'0123456789abcdefxABCDEFX') = 0 then
  1642. ExtraOptions := copy(ExtraOptions,1,i);
  1643. baseAddress := StrToIntDef(ExtraOptions,0);
  1644. end;
  1645. familyId := 0;
  1646. for i := 0 to length(Families)-1 do
  1647. begin
  1648. if pos(Families[i].k,embedded_controllers[current_settings.controllertype].controllerunitstr) = 1 then
  1649. familyId := Families[i].v;
  1650. end;
  1651. if (baseAddress and $07ffffff) <> 0 then
  1652. begin
  1653. totalRead := 0;
  1654. numRead := 0;
  1655. assign(f,binfile);
  1656. reset(f,1);
  1657. assign(g,uf2file);
  1658. rewrite(g,1);
  1659. repeat
  1660. fillchar(uf2block,sizeof(uf2block),0);
  1661. uf2block.magicStart0 := $0A324655; // "UF2\n"
  1662. uf2block.magicStart1 := $9E5D5157; // Randomly selected
  1663. if familyId = 0 then
  1664. uf2block.flags := 0
  1665. else
  1666. uf2block.flags := $2000;
  1667. uf2block.targetAddr := baseAddress + totalread;
  1668. uf2block.payloadSize := 256;
  1669. uf2block.blockNo := (totalRead div sizeOf(uf2block.data));
  1670. uf2block.numBlocks := (filesize(f) + 255) div 256;
  1671. uf2block.familyId := familyId;
  1672. uf2block.magicEnd := $0AB16F30; // Randomly selected
  1673. blockRead(f,uf2block.data,sizeof(uf2block.data),numRead);
  1674. blockwrite(g,uf2block,sizeof(uf2block));
  1675. inc(totalRead,numRead);
  1676. until (numRead=0) or (NumRead<>sizeOf(uf2block.data));
  1677. close(f);
  1678. close(g);
  1679. end;
  1680. Result := true;
  1681. end;
  1682. {*****************************************************************************
  1683. TlinkerEmbedded_SdccSdld
  1684. *****************************************************************************}
  1685. function TlinkerEmbedded_SdccSdld.WriteResponseFile: Boolean;
  1686. Var
  1687. linkres : TLinkRes;
  1688. //i : longint;
  1689. //HPath : TCmdStrListItem;
  1690. s{,s1,s2} : TCmdStr;
  1691. prtobj,
  1692. cprtobj : string[80];
  1693. linklibc : boolean;
  1694. //found1,
  1695. //found2 : boolean;
  1696. begin
  1697. WriteResponseFile:=False;
  1698. linklibc:=(SharedLibFiles.Find('c')<>nil);
  1699. prtobj:='prt0';
  1700. cprtobj:='cprt0';
  1701. if linklibc then
  1702. prtobj:=cprtobj;
  1703. { Open link.res file }
  1704. LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
  1705. { Write path to search libraries }
  1706. (* HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);
  1707. while assigned(HPath) do
  1708. begin
  1709. s:=HPath.Str;
  1710. if (cs_link_on_target in current_settings.globalswitches) then
  1711. s:=ScriptFixFileName(s);
  1712. LinkRes.Add('-L'+s);
  1713. HPath:=TCmdStrListItem(HPath.Next);
  1714. end;
  1715. HPath:=TCmdStrListItem(LibrarySearchPath.First);
  1716. while assigned(HPath) do
  1717. begin
  1718. s:=HPath.Str;
  1719. if s<>'' then
  1720. LinkRes.Add('SEARCH_DIR("'+s+'")');
  1721. HPath:=TCmdStrListItem(HPath.Next);
  1722. end;
  1723. LinkRes.Add('INPUT (');
  1724. { add objectfiles, start with prt0 always }*)
  1725. //s:=FindObjectFile('prt0','',false);
  1726. if prtobj<>'' then
  1727. begin
  1728. s:=FindObjectFile(prtobj,'',false);
  1729. LinkRes.AddFileName(s);
  1730. end;
  1731. { try to add crti and crtbegin if linking to C }
  1732. if linklibc then
  1733. begin
  1734. if librarysearchpath.FindFile('crtbegin.o',false,s) then
  1735. LinkRes.AddFileName(s);
  1736. if librarysearchpath.FindFile('crti.o',false,s) then
  1737. LinkRes.AddFileName(s);
  1738. end;
  1739. while not ObjectFiles.Empty do
  1740. begin
  1741. s:=ObjectFiles.GetFirst;
  1742. if s<>'' then
  1743. begin
  1744. { vlink doesn't use SEARCH_DIR for object files }
  1745. if not(cs_link_on_target in current_settings.globalswitches) then
  1746. s:=FindObjectFile(s,'',false);
  1747. LinkRes.AddFileName((maybequoted(s)));
  1748. end;
  1749. end;
  1750. { Write staticlibraries }
  1751. if not StaticLibFiles.Empty then
  1752. begin
  1753. { vlink doesn't need, and doesn't support GROUP }
  1754. { if (cs_link_on_target in current_settings.globalswitches) then
  1755. begin
  1756. LinkRes.Add(')');
  1757. LinkRes.Add('GROUP(');
  1758. end;}
  1759. while not StaticLibFiles.Empty do
  1760. begin
  1761. S:=StaticLibFiles.GetFirst;
  1762. LinkRes.Add('-l'+maybequoted(s));
  1763. end;
  1764. end;
  1765. (* if (cs_link_on_target in current_settings.globalswitches) then
  1766. begin
  1767. LinkRes.Add(')');
  1768. { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
  1769. here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
  1770. linklibc:=false;
  1771. while not SharedLibFiles.Empty do
  1772. begin
  1773. S:=SharedLibFiles.GetFirst;
  1774. if s<>'c' then
  1775. begin
  1776. i:=Pos(target_info.sharedlibext,S);
  1777. if i>0 then
  1778. Delete(S,i,255);
  1779. LinkRes.Add('-l'+s);
  1780. end
  1781. else
  1782. begin
  1783. LinkRes.Add('-l'+s);
  1784. linklibc:=true;
  1785. end;
  1786. end;
  1787. { be sure that libc&libgcc is the last lib }
  1788. if linklibc then
  1789. begin
  1790. LinkRes.Add('-lc');
  1791. LinkRes.Add('-lgcc');
  1792. end;
  1793. end
  1794. else
  1795. begin
  1796. while not SharedLibFiles.Empty do
  1797. begin
  1798. S:=SharedLibFiles.GetFirst;
  1799. LinkRes.Add('lib'+s+target_info.staticlibext);
  1800. end;
  1801. LinkRes.Add(')');
  1802. end;*)
  1803. { objects which must be at the end }
  1804. (*if linklibc then
  1805. begin
  1806. found1:=librarysearchpath.FindFile('crtend.o',false,s1);
  1807. found2:=librarysearchpath.FindFile('crtn.o',false,s2);
  1808. if found1 or found2 then
  1809. begin
  1810. LinkRes.Add('INPUT(');
  1811. if found1 then
  1812. LinkRes.AddFileName(s1);
  1813. if found2 then
  1814. LinkRes.AddFileName(s2);
  1815. LinkRes.Add(')');
  1816. end;
  1817. end;*)
  1818. { Write and Close response }
  1819. linkres.writetodisk;
  1820. linkres.free;
  1821. WriteResponseFile:=True;
  1822. end;
  1823. procedure TlinkerEmbedded_SdccSdld.SetDefaultInfo;
  1824. const
  1825. {$if defined(Z80)}
  1826. ExeName='sdldz80';
  1827. {$else}
  1828. ExeName='sdld';
  1829. {$endif}
  1830. begin
  1831. with Info do
  1832. begin
  1833. ExeCmd[1]:=ExeName+' -n $OPT -i $MAP $EXE -f $RES'
  1834. //-g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
  1835. end;
  1836. end;
  1837. function TlinkerEmbedded_SdccSdld.MakeExecutable: boolean;
  1838. var
  1839. binstr,
  1840. cmdstr,
  1841. mapstr: TCmdStr;
  1842. success : boolean;
  1843. StaticStr,
  1844. // GCSectionsStr,
  1845. DynLinkStr,
  1846. StripStr,
  1847. FixedExeFileName: string;
  1848. begin
  1849. { for future use }
  1850. StaticStr:='';
  1851. StripStr:='';
  1852. mapstr:='';
  1853. DynLinkStr:='';
  1854. FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.ihx')));
  1855. (* GCSectionsStr:='--gc-sections';
  1856. //if not(cs_link_extern in current_settings.globalswitches) then
  1857. if not(cs_link_nolink in current_settings.globalswitches) then
  1858. Message1(exec_i_linking,current_module.exefilename);*)
  1859. if (cs_link_map in current_settings.globalswitches) then
  1860. mapstr:='-mw';
  1861. { Write used files and libraries }
  1862. WriteResponseFile();
  1863. { Call linker }
  1864. SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
  1865. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  1866. if not(cs_link_on_target in current_settings.globalswitches) then
  1867. begin
  1868. Replace(cmdstr,'$EXE',FixedExeFileName);
  1869. Replace(cmdstr,'$RES',(maybequoted(ScriptFixFileName(outputexedir+Info.ResName))));
  1870. Replace(cmdstr,'$STATIC',StaticStr);
  1871. Replace(cmdstr,'$STRIP',StripStr);
  1872. Replace(cmdstr,'$MAP',mapstr);
  1873. // Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
  1874. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  1875. end
  1876. else
  1877. begin
  1878. Replace(cmdstr,'$EXE',FixedExeFileName);
  1879. Replace(cmdstr,'$RES',maybequoted(ScriptFixFileName(outputexedir+Info.ResName)));
  1880. Replace(cmdstr,'$STATIC',StaticStr);
  1881. Replace(cmdstr,'$STRIP',StripStr);
  1882. Replace(cmdstr,'$MAP',mapstr);
  1883. // Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
  1884. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  1885. end;
  1886. success:=DoExec(FindUtil(utilsprefix+BinStr),cmdstr,true,false);
  1887. { Remove ReponseFile }
  1888. if success and not(cs_link_nolink in current_settings.globalswitches) then
  1889. DeleteFile(outputexedir+Info.ResName);
  1890. (* { Post process }
  1891. if success and not(cs_link_nolink in current_settings.globalswitches) then
  1892. success:=PostProcessExecutable(FixedExeFileName,false);
  1893. if success and (target_info.system in [system_arm_embedded,system_avr_embedded,system_mipsel_embedded,system_xtensa_embedded]) then
  1894. begin
  1895. success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O ihex '+
  1896. FixedExeFileName+' '+
  1897. maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.hex'))),true,false);
  1898. if success then
  1899. success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+
  1900. FixedExeFileName+' '+
  1901. maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin'))),true,false);
  1902. end;*)
  1903. MakeExecutable:=success; { otherwise a recursive call to link method }
  1904. end;
  1905. {*****************************************************************************
  1906. Initialize
  1907. *****************************************************************************}
  1908. initialization
  1909. {$ifdef arm}
  1910. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1911. RegisterTarget(system_arm_embedded_info);
  1912. {$endif arm}
  1913. {$ifdef avr}
  1914. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1915. RegisterTarget(system_avr_embedded_info);
  1916. {$endif avr}
  1917. {$ifdef i386}
  1918. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1919. RegisterTarget(system_i386_embedded_info);
  1920. {$endif i386}
  1921. {$ifdef x86_64}
  1922. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1923. RegisterTarget(system_x86_64_embedded_info);
  1924. {$endif x86_64}
  1925. {$ifdef i8086}
  1926. { no need to register linker ld_embedded, because i8086_embedded uses the
  1927. regular msdos linker. In case a flat binary, relocated for a specific
  1928. segment address is needed (e.g. for a BIOS or a real mode bootloader), it
  1929. can be produced post-compilation with exe2bin or a similar tool. }
  1930. RegisterTarget(system_i8086_embedded_info);
  1931. {$endif i8086}
  1932. {$ifdef mipsel}
  1933. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1934. RegisterTarget(system_mipsel_embedded_info);
  1935. {$endif mipsel}
  1936. {$ifdef m68k}
  1937. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1938. RegisterTarget(system_m68k_embedded_info);
  1939. {$endif m68k}
  1940. {$ifdef riscv32}
  1941. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1942. RegisterTarget(system_riscv32_embedded_info);
  1943. {$endif riscv32}
  1944. {$ifdef riscv64}
  1945. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1946. RegisterTarget(system_riscv64_embedded_info);
  1947. {$endif riscv64}
  1948. {$ifdef xtensa}
  1949. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1950. RegisterTarget(system_xtensa_embedded_info);
  1951. {$endif xtensa}
  1952. {$ifdef z80}
  1953. RegisterLinker(ld_embedded,TlinkerEmbedded_SdccSdld);
  1954. RegisterTarget(system_z80_embedded_info);
  1955. {$endif z80}
  1956. end.