<?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>CodeWarrior for MCU中的主题 CodeWarrior 8- &amp; 16-bit tools: Error message in the linker wheb using near</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-8-16-bit-tools-Error-message-in-the-linker-wheb/m-p/124922#M133</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #ff0000;"&gt;To help you find solutions to problems that have already been solved, we have posted this message. It contains an entire topic ported from a separate forum. The original message and all replies are in this single message.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; Posted: May 31, 2005 - 10:45 AM&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This is my case :&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CPU HC08 series AP08,&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;I wasn't using page 0, (I thought the compiler was assigning the adress so the linker will know which page the RAM is in ), So I put only one RAM variable into PAGE ZERO RAM area. this is what I do :&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;static UWORD_16 near m_uwTimer = 0;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I use a function to get the value of this variable that is incremented in an interrupt function:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;UWORD_16 uwGetTime(void)&lt;BR /&gt;{&lt;BR /&gt;UWORD_16 uwTmptimer;&lt;/DIV&gt;&lt;DIV&gt;Cpu_DisableInt();&lt;BR /&gt;(UWORD_16)uwTmptimer = (UWORD_16)m_uwTimer;&lt;BR /&gt;Cpu_EnableInt();&lt;BR /&gt;return(uwTmptimer);&lt;BR /&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;the linker give me this error when linking :&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Link Error : L1907: Fixup overflow in uwGetTime, to m_uwTimer type 1, at offset 0x1&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When not using near (or when using #pragma DATA_SEG MY_ZEROPAGE ), the code is linking ok, do you know why ? I'm using the small memory model and don't want to used any #pragma&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;thank's&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; Posted: Jun 06, 2005 - 08:04 AM&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When building in small memory model, the only solution to tell the compiler to access a variable using direct addressing mode is to define the variable in a SHORT segment.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The variable definition should be made as follows:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#pragma DATA_SEG SHORT MY_ZEROPAGE&lt;BR /&gt;static UWORD_16 m_uwTimer = 0;&lt;BR /&gt;#pragma DATA_SEG DEFAULT&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Defining a variable as near will not allocate the variable in a segment located on the direct page.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Alternatively you can choose to use the tiny memory model if all your variables are allocated on the direct page.&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;In that case you do not need any pragma to force direct addressing mode.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I hope this helps.&lt;/DIV&gt;&lt;DIV&gt;mw_cbezy&lt;BR /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 28 Jan 2006 02:01:45 GMT</pubDate>
    <dc:creator>marc_paquette</dc:creator>
    <dc:date>2006-01-28T02:01:45Z</dc:date>
    <item>
      <title>CodeWarrior 8- &amp; 16-bit tools: Error message in the linker wheb using near</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-8-16-bit-tools-Error-message-in-the-linker-wheb/m-p/124922#M133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #ff0000;"&gt;To help you find solutions to problems that have already been solved, we have posted this message. It contains an entire topic ported from a separate forum. The original message and all replies are in this single message.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; Posted: May 31, 2005 - 10:45 AM&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This is my case :&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CPU HC08 series AP08,&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;I wasn't using page 0, (I thought the compiler was assigning the adress so the linker will know which page the RAM is in ), So I put only one RAM variable into PAGE ZERO RAM area. this is what I do :&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;static UWORD_16 near m_uwTimer = 0;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I use a function to get the value of this variable that is incremented in an interrupt function:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;UWORD_16 uwGetTime(void)&lt;BR /&gt;{&lt;BR /&gt;UWORD_16 uwTmptimer;&lt;/DIV&gt;&lt;DIV&gt;Cpu_DisableInt();&lt;BR /&gt;(UWORD_16)uwTmptimer = (UWORD_16)m_uwTimer;&lt;BR /&gt;Cpu_EnableInt();&lt;BR /&gt;return(uwTmptimer);&lt;BR /&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;the linker give me this error when linking :&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Link Error : L1907: Fixup overflow in uwGetTime, to m_uwTimer type 1, at offset 0x1&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When not using near (or when using #pragma DATA_SEG MY_ZEROPAGE ), the code is linking ok, do you know why ? I'm using the small memory model and don't want to used any #pragma&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;thank's&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; Posted: Jun 06, 2005 - 08:04 AM&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When building in small memory model, the only solution to tell the compiler to access a variable using direct addressing mode is to define the variable in a SHORT segment.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The variable definition should be made as follows:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#pragma DATA_SEG SHORT MY_ZEROPAGE&lt;BR /&gt;static UWORD_16 m_uwTimer = 0;&lt;BR /&gt;#pragma DATA_SEG DEFAULT&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Defining a variable as near will not allocate the variable in a segment located on the direct page.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Alternatively you can choose to use the tiny memory model if all your variables are allocated on the direct page.&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;In that case you do not need any pragma to force direct addressing mode.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I hope this helps.&lt;/DIV&gt;&lt;DIV&gt;mw_cbezy&lt;BR /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Jan 2006 02:01:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-8-16-bit-tools-Error-message-in-the-linker-wheb/m-p/124922#M133</guid>
      <dc:creator>marc_paquette</dc:creator>
      <dc:date>2006-01-28T02:01:45Z</dc:date>
    </item>
  </channel>
</rss>

