<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Encapsulate code into  header and trailer in ColdFire/68K Microcontrollers and Processors</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Encapsulate-code-into-header-and-trailer/m-p/157563#M4732</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;To place the trailer code&amp;nbsp;to the end of the application code, move the trailer code into separate file trailer.s.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;List the trailer.o at the end of linker list of the object files.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I am not familiar with any compiler directive, which provides ordering of the object files in&amp;nbsp;the linker list. You can edit the linker command line manually.&lt;/FONT&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT size="2"&gt;The alternative (dirty) way is to place label "_trailer:" at constant (big enough) address with .org directive.&lt;/FONT&gt;&lt;/P&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 May 2008 14:35:37 GMT</pubDate>
    <dc:creator>admin</dc:creator>
    <dc:date>2008-05-29T14:35:37Z</dc:date>
    <item>
      <title>Encapsulate code into  header and trailer</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Encapsulate-code-into-header-and-trailer/m-p/157560#M4729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;A target="_blank"&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;Hi,&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;I am trying to encapsulate the code into a header and trailer. Therefore, I used the following technique:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;In vectors.s, I have&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt; _DEF_SW_VERSION .set 5407 .global VECTOR_TABLE .global _VECTOR_TABLE .global start .extern _asm_startmeup .extern ___SP_INIT .extern _asm_exception_handler .extern _asm_isr_handler .extern _dbug_sc_handler .def _header .def _header_end .def _trailer .def _trailer_end .text "header"/* * Exception Vector Table */VECTOR_TABLE:_VECTOR_TABLE:INITSP:&amp;nbsp; .long ___SP_INIT&amp;nbsp; /* Initial SP&amp;nbsp;&amp;nbsp; */INITPC:&amp;nbsp; .long 0x400&amp;nbsp;&amp;nbsp; /* Initial PC&amp;nbsp;&amp;nbsp; */vector02: .long _asm_exception_handler /* Access Error&amp;nbsp; */vector03: .long _asm_exception_handler /* Address Error&amp;nbsp; */vector04: .long _asm_exception_handler /* Illegal Instruction */vector05: .long _asm_exception_handler /* Divide by Zero&amp;nbsp; */vector06: .long _asm_exception_handler /* Reserved&amp;nbsp;&amp;nbsp; */vector07: .long _asm_exception_handler /* Reserved&amp;nbsp;&amp;nbsp; *//* … etc … */vectorFF: .long _asm_isr_handlerstart: &lt;STRONG style=": ; color: #6633FF;"&gt;.long 12351236h&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; 2 word header signature .long _DEF_SW_VERSION ; 2 words for version identification .word 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; 1 word for n_words .word 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; 1 word for checksum .word 0, 0, 0, 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; 4 words for future expansion&lt;/STRONG&gt; move.w #0x2700,SR jmp&amp;nbsp; _asm_startmeup_header_end:/* -------- Trailer ------*/&lt;SPAN style="color: #6633FF;"&gt;&lt;STRONG&gt;.text "trailer"_trailer:&amp;nbsp; .long 0ABCEABCFh&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; 2 word trailer signature&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .word 0, 0, 0, 0, 0, 0&amp;nbsp; ; 6 words for future expansion _trailer_end:&lt;/STRONG&gt;&lt;/SPAN&gt;/* End of vector.s */ .end&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;In the memory, I can see header’s signature (12351236h) followed by (after some data) the trailer’s signature.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;How can I make the trailer part go at the end of the code in memory?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;Simon&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:02:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Encapsulate-code-into-header-and-trailer/m-p/157560#M4729</guid>
      <dc:creator>SVC1</dc:creator>
      <dc:date>2020-10-29T09:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: Encapsulate code into  header and trailer</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Encapsulate-code-into-header-and-trailer/m-p/157561#M4730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;The sequence of the relocatable modules in the target memory is defined in the linker command line.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Times New Roman"&gt;&lt;FONT size="3"&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;In your case, you need to place the object file of the trailer module&amp;nbsp;to the end of the linker's object file list.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Times New Roman"&gt;&lt;FONT size="3"&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 May 2008 13:22:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Encapsulate-code-into-header-and-trailer/m-p/157561#M4730</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2008-05-21T13:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: Encapsulate code into  header and trailer</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Encapsulate-code-into-header-and-trailer/m-p/157562#M4731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;How can I do that. In vector.s, I have&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;&lt;FONT size="1"&gt;&lt;FONT size="2"&gt;_DEF_SW_VERSION    .set 0x7777 .global VECTOR_TABLE .global _VECTOR_TABLE .global start .global _start .global _header .global _header_end  .global _trailer .global _trailer_end .extern _startup .extern ___SP_AFTER_RESET   .extern _asm_exception_handler .extern _asm_isr_handler .text /* * Exception Vector Table */    VECTOR_TABLE:_VECTOR_TABLE:INITSP:  .long ___SP_AFTER_RESET INITPC:  .long _start   vector02: .long _asm_exception_handler /*..... ........ .....*/vectorFF: .long _asm_isr_handler/* ------------------------------- */ .text "header"_header:  .long 12351236h ; signature .long _DEF_SW_VERSION ; version .long 0  ; Number of words .long 0  ; Checksum_header_end:/* ------------------------------- */_start:start: move.w #0x2700,SR jmp  _startup  /* ------------------------------- */ .text "trailer"_trailer: .long 0ABCEABCFh /* signature     */ .long 0, 0, 0,  /* for future expansion */_trailer_end:/* ------------------------------- */  .end&lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;How do I insert _header and _trailer into the lcf linker file?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks in advance,&lt;/DIV&gt;&lt;DIV&gt;Simon&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:02:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Encapsulate-code-into-header-and-trailer/m-p/157562#M4731</guid>
      <dc:creator>SVC1</dc:creator>
      <dc:date>2020-10-29T09:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Encapsulate code into  header and trailer</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Encapsulate-code-into-header-and-trailer/m-p/157563#M4732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;To place the trailer code&amp;nbsp;to the end of the application code, move the trailer code into separate file trailer.s.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;List the trailer.o at the end of linker list of the object files.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I am not familiar with any compiler directive, which provides ordering of the object files in&amp;nbsp;the linker list. You can edit the linker command line manually.&lt;/FONT&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT size="2"&gt;The alternative (dirty) way is to place label "_trailer:" at constant (big enough) address with .org directive.&lt;/FONT&gt;&lt;/P&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 14:35:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Encapsulate-code-into-header-and-trailer/m-p/157563#M4732</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2008-05-29T14:35:37Z</dc:date>
    </item>
  </channel>
</rss>

