<?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: How to use CODE_SEG? in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-CODE-SEG/m-p/167435#M1032</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In case anyone else is reviewing this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I never figured out how to correctly use CODE_SEG. But, I did get closer to my goal using the following pragmas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#pragma define_section text_bootloader ".text_bootloader" far_abs RX&lt;BR /&gt;#pragma section text_bootloader begin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I said closer because I'm now having another issue. I'll create a new post as the topic is now a bit different.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Jun 2012 03:37:10 GMT</pubDate>
    <dc:creator>ignisuti</dc:creator>
    <dc:date>2012-06-01T03:37:10Z</dc:date>
    <item>
      <title>How to use CODE_SEG?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-CODE-SEG/m-p/167433#M1030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to understand how CODE_SEG is used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to have Bootloader and Application sections of code. Does this mean I have to use the CODE_SEG pragma with every function declaration AND definition&amp;nbsp;in each of those sections?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Can I use the pragma just once per file to keep my code clean?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it necessary for me to use the DEFAULT command to set things back to normal?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2012 07:02:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-CODE-SEG/m-p/167433#M1030</guid>
      <dc:creator>ignisuti</dc:creator>
      <dc:date>2012-05-30T07:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to use CODE_SEG?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-CODE-SEG/m-p/167434#M1031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm still struggling with this...&lt;/P&gt;&lt;P&gt;I believe I have everything setup correctly to place one small function in the .text_bootloader section, but that section appears with size 0 in my xmap file. Please help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my linker configuration file:&lt;/P&gt;&lt;PRE&gt;# Akita linker command file.MEMORY  { memory_map__vector_table  (RX) : ORIGIN = 0x00000000, LENGTH = 0x000001E0  memory_map__cfmprotrom  (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010  memory_map__bootloader  (RX) : ORIGIN = 0x00000C00, LENGTH = 0x00002800 # 10kB  memory_map__application  (RX) : ORIGIN = 0x00003400, LENGTH = 0x00080000-0x00003400   memory_map__ram_data    (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00020000 }# Keep linker from ever dead-stripping out section that may not be directly referenced.KEEP_SECTION { .vectortable, .cfmconfig }SECTIONS  { # Entry point symbols to be used in code development. Note: When used in code, use one less underscore!    __START__BOOTLOADER  = ADDR( memory_map__bootloader  );    __START__APPLICATION  = ADDR( memory_map__application );      .interrupts:  {     __vector_table = .;     * (.vectortable)     . = ALIGN (0x4);  } &amp;gt; memory_map__vector_table  .cfmprotect:  {     *(.cfmconfig)     . = ALIGN (0x4);  } &amp;gt; memory_map__cfmprotrom .bootloader_startup:     {   *(.startup_bootloader)    } &amp;gt; memory_map__bootloader  .bootloader:    {  * (.text_bootloader)    . = ALIGN (0x4);          * (.data_bootloader)    . = ALIGN (0x4);         } &amp;gt;&amp;gt; memory_map__bootloader  .application_startup:     {   *(.startup_application)    } &amp;gt; memory_map__application         .app_text:   {  ALIGNALL(4);     * (.init)      * (.text)  .= ALIGN(0x8) ;  * (.rodata)  .= ALIGN(0x4) ;      ___ROM_AT = .;  } &amp;gt;&amp;gt; memory_map__application   .app_data: AT(___ROM_AT)  {     * (.sdata)     * (.data)  .= ALIGN(0x4) ;     *(.ARM.extab)  .= ALIGN(0x4) ;         __exception_table_start__ = .;     EXCEPTION     __exception_table_end__ = .;  .= ALIGN(0x4) ;     __sinit__ = .;     STATICINIT   .= ALIGN(0x8) ;  } &amp;gt; memory_map__ram_data   .bss :  {  .= ALIGN(0x4) ;  __START_BSS = .;  * (.bss)  __END_BSS = .;  .= ALIGN(0x8) ;  } &amp;gt;&amp;gt; memory_map__ram_data  _romp_at = ___ROM_AT + SIZEOF(.app_data); .romp : AT(_romp_at)  {     __S_romp = _romp_at;     WRITEW(___ROM_AT);     WRITEW(ADDR(.app_data));     WRITEW(SIZEOF(.app_data));     WRITEW(0);     WRITEW(0);     WRITEW(0);  } # Heap and Stack sizes definition __SP_INIT = . + 0x00008000; __heap_addr = __SP_INIT; __heap_size = 0x00000000; }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my header file that contains my pragma:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;#ifndef __STARTUP__BOOTLOADER_H#define __STARTUP__BOOTLOADER_H#pragma CODE_SEG __FAR_SEG text_bootloadervoid STARTUP__bootloader  (  void  );#pragma CODE_SEG __FAR_SEG DEFAULT#endif /* __STARTUP__BOOTLOADER_H */&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is my c file that contains my pragma:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;#pragma CODE_SEG __FAR_SEG text_bootloader#include "STARTUP__BOOTLOADER.h"static u8 test_delete_me[1000];void STARTUP__bootloader  (  void  )    {         u16 idx = 0;    STARTUP__application();             /* Should never reach this point. */        while( !HELL_FROZEN_OVER )  {  test_delete_me[++idx] = idx; if( test_delete_me[idx] = 65000 )      {     break;     }      } //Endless loop            } /* STARTUP__bootloader() */&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the end of my xmap file:&lt;/P&gt;&lt;PRE&gt;# Memory map:  v_addr   p_addr   size     name  00000000 00000000 000001E0 .interrupts memory_map__vector_table  00000400 00000400 00000000 .cfmprotect memory_map__cfmprotrom  00000C00 00000C00 00000000 .bootloader_startup memory_map__bootloader  00000C00 00000C00 00000000 .bootloader memory_map__bootloader  00003400 00003400 00000000 .application_startup memory_map__application  00003400 00003400 00024AB0 .app_text  memory_map__application  1FFF0000 00027EB0 000044A8 .app_data  memory_map__ram_data  1FFF44A8 1FFF44A8 00004558 .bss       memory_map__ram_data  1FFF8A00 0002C358 00000018 .romp      memory_map__ram_data&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:14:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-CODE-SEG/m-p/167434#M1031</guid>
      <dc:creator>ignisuti</dc:creator>
      <dc:date>2020-10-29T09:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use CODE_SEG?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-CODE-SEG/m-p/167435#M1032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In case anyone else is reviewing this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I never figured out how to correctly use CODE_SEG. But, I did get closer to my goal using the following pragmas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#pragma define_section text_bootloader ".text_bootloader" far_abs RX&lt;BR /&gt;#pragma section text_bootloader begin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I said closer because I'm now having another issue. I'll create a new post as the topic is now a bit different.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jun 2012 03:37:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-use-CODE-SEG/m-p/167435#M1032</guid>
      <dc:creator>ignisuti</dc:creator>
      <dc:date>2012-06-01T03:37:10Z</dc:date>
    </item>
  </channel>
</rss>

