<?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>MPC5xxxのトピックMPC5645S Bootloader problem</title>
    <link>https://community.nxp.com/t5/MPC5xxx/MPC5645S-Bootloader-problem/m-p/566250#M4036</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using the MPC5645S. I am trying to build a Boot-loader. I can store a Firmware in the flash and I am able to jump to the application.&lt;/P&gt;&lt;P&gt;The main run correctly. However, I have a problem when a function is executed in the main. The debugger says that I try to access on an illegal memory.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Should I set the functions to a section to had a proper access? &lt;/P&gt;&lt;P&gt;To set a function to a section we should use the following instruction?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#pragma push&lt;/P&gt;&lt;P&gt;#pragma section ".app_flash"&lt;/P&gt;&lt;P&gt;__declspec(section ".app_flash")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FUNCTION&lt;/P&gt;&lt;P&gt;#pragma pop&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Josep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Jul 2016 11:25:33 GMT</pubDate>
    <dc:creator>josepgorgues</dc:creator>
    <dc:date>2016-07-13T11:25:33Z</dc:date>
    <item>
      <title>MPC5645S Bootloader problem</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5645S-Bootloader-problem/m-p/566250#M4036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using the MPC5645S. I am trying to build a Boot-loader. I can store a Firmware in the flash and I am able to jump to the application.&lt;/P&gt;&lt;P&gt;The main run correctly. However, I have a problem when a function is executed in the main. The debugger says that I try to access on an illegal memory.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Should I set the functions to a section to had a proper access? &lt;/P&gt;&lt;P&gt;To set a function to a section we should use the following instruction?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#pragma push&lt;/P&gt;&lt;P&gt;#pragma section ".app_flash"&lt;/P&gt;&lt;P&gt;__declspec(section ".app_flash")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FUNCTION&lt;/P&gt;&lt;P&gt;#pragma pop&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Josep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2016 11:25:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5645S-Bootloader-problem/m-p/566250#M4036</guid>
      <dc:creator>josepgorgues</dc:creator>
      <dc:date>2016-07-13T11:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5645S Bootloader problem</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5645S-Bootloader-problem/m-p/566251#M4037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Are you aware that every compiler use different #pragma definitions?&lt;/P&gt;&lt;P&gt;Is good to specify at least basic information about your project.&lt;/P&gt;&lt;P&gt;What is the last instruction before your program crash?&lt;/P&gt;&lt;P&gt;Check instruction and core registers to find out if you are accessing memory which can be accessed.&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2016 11:46:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5645S-Bootloader-problem/m-p/566251#M4037</guid>
      <dc:creator>petervlna</dc:creator>
      <dc:date>2016-07-13T11:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5645S Bootloader problem</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5645S-Bootloader-problem/m-p/566252#M4038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The memory map of my project is:&lt;/P&gt;&lt;P&gt;MEMORY&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; resetvector:&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;&amp;nbsp;&amp;nbsp; org = 0x00000000,&amp;nbsp;&amp;nbsp; len = 0x00000008&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; init:&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;&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;&amp;nbsp;&amp;nbsp; org = 0x00000020,&amp;nbsp;&amp;nbsp; len = 0x00000FE0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exception_handlers:&amp;nbsp;&amp;nbsp; org = 0x00001000,&amp;nbsp;&amp;nbsp; len = 0x00001000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; EE_group:&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; org = 0x00002000,&amp;nbsp;&amp;nbsp; len = 0x0000D000 /*&amp;nbsp;&amp;nbsp;&amp;nbsp; (Emulated EEprom)&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int_flash:&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; org = 0x00020000,&amp;nbsp;&amp;nbsp; len = 0x001E4000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; BOOT_FLASH:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; org = 0x00014000,&amp;nbsp;&amp;nbsp; len = 0x00008000&amp;nbsp; /*&amp;nbsp; Added Bootloader Block (48k)*&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; APP_FLASH:&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; org = 0x0001C000,&amp;nbsp;&amp;nbsp; len = 0x00004000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int_sram:&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; org = 0x40000000,&amp;nbsp;&amp;nbsp; len = 0x0000A000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; heap&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; org = 0x4000EC00,&amp;nbsp;&amp;nbsp; len = 0x00000400&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; stack :&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; org = 0x4000F000,&amp;nbsp;&amp;nbsp; len = 0x00001000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int_gram:&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; org = 0x60000000,&amp;nbsp;&amp;nbsp; len = 0x00100000 /* 1M */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ext_dram:&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; org = 0x20000000,&amp;nbsp;&amp;nbsp; len = 0x02000000 /* 32MB for now */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ext_qspi:&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; org = 0x70000000,&amp;nbsp;&amp;nbsp; len = 0x00800000 /* QSPI 8MB */&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the bootloader I upload the app_flash area and the int_flash area. On the app_flash area there are only the main function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#pragma push&lt;/P&gt;&lt;P&gt;#pragma section ".app_flash"&lt;/P&gt;&lt;P&gt;__declspec(section ".app_flash")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void main(void){&lt;/P&gt;&lt;P&gt;CODE&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;#pragma pop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The other functions are stored on int_flash area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My program crash when the program try to execute a function that is stored in int_flash section.&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;1. (*(APPFn)APP_ENTRY_ADDRESS)(); // jump to app and should not back&lt;/P&gt;&lt;P&gt;2. Enter in main (0x1c000 address)&lt;/P&gt;&lt;P&gt;2. Initialize local variables.&lt;/P&gt;&lt;P&gt;3. Open the first function. ==&amp;gt; Program Crash.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Josep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2016 12:42:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5645S-Bootloader-problem/m-p/566252#M4038</guid>
      <dc:creator>josepgorgues</dc:creator>
      <dc:date>2016-07-13T12:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5645S Bootloader problem</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5645S-Bootloader-problem/m-p/566253#M4039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can you check core registers values (registers which are used&amp;nbsp; by last instruction) and instruction which cause crash?&lt;/P&gt;&lt;P&gt;This is a simple way how to find out where you are trying to access and why it crash.&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2016 13:05:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5645S-Bootloader-problem/m-p/566253#M4039</guid>
      <dc:creator>petervlna</dc:creator>
      <dc:date>2016-07-13T13:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5645S Bootloader problem</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5645S-Bootloader-problem/m-p/566254#M4040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The core register values before crash are the followings:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Core_Register.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/10390i057CC336ACE12AB9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Core_Register.png" alt="Core_Register.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the program crash we can see this registers:&lt;span class="lia-inline-image-display-wrapper" image-alt="BootloaderCrash.PNG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/38107iD57F2A2148EFCDDD/image-size/large?v=v2&amp;amp;px=999" role="button" title="BootloaderCrash.PNG" alt="BootloaderCrash.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are a lot of instructions that can cause the crash. All functions and buffers that are stored in "int_flash" section could cause a crash. &lt;/P&gt;&lt;P&gt;Example 1:&lt;/P&gt;&lt;P&gt;1. Start bootloader.&lt;/P&gt;&lt;P&gt;2. Load and store application.&lt;/P&gt;&lt;P&gt;3. Jump to main.c (application).&lt;/P&gt;&lt;P&gt;4. Open a function that was been stored in "int_flash" section.&lt;/P&gt;&lt;P&gt;5. Program crash.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example 2:&lt;/P&gt;&lt;P&gt;1. Start bootloader.&lt;/P&gt;&lt;P&gt;2. Load and store application.&lt;/P&gt;&lt;P&gt;3. Jump to main.c (application).&lt;/P&gt;&lt;P&gt;4. Open a function that was been stored in "APP_FLASH" section.&lt;/P&gt;&lt;P&gt;5. Execute instructions.&lt;/P&gt;&lt;P&gt;6. Read a buffer that was stored in "int_flash" section.&lt;/P&gt;&lt;P&gt;7. Program crash.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2016 14:09:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5645S-Bootloader-problem/m-p/566254#M4040</guid>
      <dc:creator>josepgorgues</dc:creator>
      <dc:date>2016-07-13T14:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: MPC5645S Bootloader problem</title>
      <link>https://community.nxp.com/t5/MPC5xxx/MPC5645S-Bootloader-problem/m-p/566255#M4041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Just before executing the jump (where it crash) check if there are valid data on destination address of the jump which is 0x1D3C6.&lt;/P&gt;&lt;P&gt;If not (I expect not) then you are trying to access memory with no valid code or uninitialized memory at all.&lt;/P&gt;&lt;P&gt;Make sure when you are accessing memory that it contains valid code or it have no restrictions for access.&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jul 2016 11:05:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/MPC5645S-Bootloader-problem/m-p/566255#M4041</guid>
      <dc:creator>petervlna</dc:creator>
      <dc:date>2016-07-14T11:05:06Z</dc:date>
    </item>
  </channel>
</rss>

