<?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: Initial PC address for KL25 does not match? in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-PC-address-for-KL25-does-not-match/m-p/282470#M10587</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both. I am aware that M0+ is a "thumb-exclusive" machine, but I thought that for this reason, it would not be necessary to use the "thumb bit", so I forgot about it. Anyway I suppose that CW keeps using odd-address calls so code can be ported to ARM machines with the full ARM set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich, the lecture you provided is really nice :smileyhappy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once more, thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 20 Jul 2013 13:10:26 GMT</pubDate>
    <dc:creator>quevedo</dc:creator>
    <dc:date>2013-07-20T13:10:26Z</dc:date>
    <item>
      <title>Initial PC address for KL25 does not match?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-PC-address-for-KL25-does-not-match/m-p/282467#M10584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using the FRDM-KL25 board as a tool for teaching basic software in an engineering course. As I am creating experiments, and executing them myself, I found something strange.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At Reset, Kinetis L processors first fetch the initial SP address at 0x00000000 position. Then, it fetchse initial PC address at 0x00000004 position. When I created a project in CodeWarrior 10.4, I used Debugger Shell to read memory contents, and found the following values (corrected for endianess):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SP: 0x20003000; PC: 0x0000085D&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Strange, PC address does not seem to be aligned in a 4-byte boundary. And when I look in the assembly code, at the Disassembly window, I see startup code (label __thumb_startup) at 0x0000085C address.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone explain why CodeWarrior generates a code that commands CPU to fetch one memory position after the one it should? And why the program runs OK even with this supposed error? I expect to comment that on my course.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Antonio Quevedo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 20:04:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-PC-address-for-KL25-does-not-match/m-p/282467#M10584</guid>
      <dc:creator>quevedo</dc:creator>
      <dc:date>2013-07-19T20:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Initial PC address for KL25 does not match?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-PC-address-for-KL25-does-not-match/m-p/282468#M10585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Somewhere i read: "PC bit 0 is set in order to enforce Thumb mode". You can find the details somewhere else.&lt;/P&gt;&lt;P&gt;I first encountered this "odd" behaviour when i wrote a procedure to copy other procedures into SRAM for benchmark purposes, because it applies to all function pointers. As long as you use function pointers for calling and for nothing else, the linker automatically does the right thing .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 20 Jul 2013 10:53:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-PC-address-for-KL25-does-not-match/m-p/282468#M10585</guid>
      <dc:creator>dieterteuchert</dc:creator>
      <dc:date>2013-07-20T10:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: Initial PC address for KL25 does not match?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-PC-address-for-KL25-does-not-match/m-p/282469#M10586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Antonio,&lt;/P&gt;&lt;P&gt;the FRDM-KL25Z is using an ARM Cortex-M0+. This core only supports the 'thumb' instructions. Other cores can support the 'thumb' or normal ARM instructions. In order for the core to distinguish between thumb and non-thumb instructions, the least significant bit is used for addresses. This is the so called 'thumb bit'. So if an address is odd (with that bit set), the core knows that it jumps to a thumb address.&lt;/P&gt;&lt;P&gt;It is just for the Cortex M0+ that it only supports thumb, so all function pointer values have that thumb bit set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I recommend that you have a look at the ARM documenation, or maybe at (&lt;A href="http://paulkilloran.com/arm/Lecture_7.pdf" title="http://paulkilloran.com/arm/Lecture_7.pdf"&gt;http://paulkilloran.com/arm/Lecture_7.pdf&lt;/A&gt;) as this provides a nice lecture :-)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 20 Jul 2013 10:53:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-PC-address-for-KL25-does-not-match/m-p/282469#M10586</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2013-07-20T10:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Initial PC address for KL25 does not match?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-PC-address-for-KL25-does-not-match/m-p/282470#M10587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both. I am aware that M0+ is a "thumb-exclusive" machine, but I thought that for this reason, it would not be necessary to use the "thumb bit", so I forgot about it. Anyway I suppose that CW keeps using odd-address calls so code can be ported to ARM machines with the full ARM set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich, the lecture you provided is really nice :smileyhappy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once more, thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 20 Jul 2013 13:10:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Initial-PC-address-for-KL25-does-not-match/m-p/282470#M10587</guid>
      <dc:creator>quevedo</dc:creator>
      <dc:date>2013-07-20T13:10:26Z</dc:date>
    </item>
  </channel>
</rss>

