<?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: S32K144 - flash erase/write problem with S32DS and variable at specific location in S32K</title>
    <link>https://community.nxp.com/t5/S32K/S32K144-flash-erase-write-problem-with-S32DS-and-variable-at/m-p/1088258#M7828</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alexis,&lt;BR /&gt;I need it initialized, because it's part of bootloader and I need to know the data at the startup, I cannot assign them in runtime, because I will be overwriting this area by Cyclone programmer if necessary (but it should use defaults written by JTAG when flashing bootloader for the first time).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But anyway I tried it and just did&lt;/P&gt;&lt;P&gt;uint8_t tmpdata[8] __attribute__((section(".cfgdata"))) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and in main()&lt;BR /&gt;tmpdata[0]=7;&lt;/P&gt;&lt;P&gt;tmpdata[1]=6;&lt;/P&gt;&lt;P&gt;tmpdata[2]=5;&lt;/P&gt;&lt;P&gt;tmpdata[3]=4;&lt;/P&gt;&lt;P&gt;tmpdata[4]=3;&lt;/P&gt;&lt;P&gt;tmpdata[5]=2;&lt;/P&gt;&lt;P&gt;tmpdata[6]=1;&lt;/P&gt;&lt;P&gt;tmpdata[7]=0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it crashes (jumps into defaultISR) on the second line (because I am trying to write into flash area, not ram may be)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Still I don't understand what compiler has to do with MCU instruction for erasing flash/writing phrase into flash. This was working fine on MCF51JM.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Jun 2020 07:01:58 GMT</pubDate>
    <dc:creator>Novalis</dc:creator>
    <dc:date>2020-06-29T07:01:58Z</dc:date>
    <item>
      <title>S32K144 - flash erase/write problem with S32DS and variable at specific location</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-flash-erase-write-problem-with-S32DS-and-variable-at/m-p/1088256#M7826</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 have new section defined in linker file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cfgdata &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; (RW)&amp;nbsp; : ORIGIN = 0x00016000, LENGTH = 0x00001000 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.cfgdata :&lt;BR /&gt;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; . = ALIGN(4);&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; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *(.cfgdata)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; . = ALIGN (0x4);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; } &amp;gt; cfgdata&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in sourcecode:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint8_t tmpdata[8] __attribute__((section(".cfgdata"))) ={7,6,5,4,3,2,1,0} ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after startup I call this function:&lt;/P&gt;&lt;P&gt;void test_write()&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; uint8_t data[8]={0,1,2,3,4,5,6,7};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; uint8_t newdata[8];&lt;BR /&gt;&amp;nbsp;&amp;nbsp; uint32_t addr=0x16000;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; uint32_t ret = FLASH_DRV_Init(&amp;amp;Flash1_InitConfig0, &amp;amp;flashSSDConfig2);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ret = FLASH_DRV_EraseSector(&amp;amp;flashSSDConfig2, addr, 4096u);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ret = FLASH_DRV_Program(&amp;amp;flashSSDConfig2, addr, 8, data);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; memcpy(newdata,tmpdata,8);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when I check memory map , I see 76543210&amp;nbsp; at addr 0x16000 at startup&lt;BR /&gt;when I do FLASH_DRV_EraseSector, it's still there, EraseSector function returns 0, that is success, so why is it not erased?&lt;BR /&gt;when I do FLASH_DRV_Program, which also returns 0/success , still old data there ..&lt;/P&gt;&lt;P&gt;BUT!&lt;/P&gt;&lt;P&gt;when I do&amp;nbsp; memcpy(newdata,tmpdata,8);&amp;nbsp; then I have&amp;nbsp; 01234567 bytes in newdata variable ... &lt;BR /&gt;BUT - after program reset, I still only see old 76543210 in memory map at tmpdata location ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I define tmpdata without specific location (or force it into another location I have configured),&lt;/P&gt;&lt;P&gt;uint8_t tmpdata[8]&amp;nbsp; ={7,6,5,4,3,2,1,0} ;&lt;/P&gt;&lt;P&gt;then erase/flash write is working fine, I can see data at 0x16000 being erased, then written&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anybody have any idea why this is happening?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2020 13:20:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-flash-erase-write-problem-with-S32DS-and-variable-at/m-p/1088256#M7826</guid>
      <dc:creator>Novalis</dc:creator>
      <dc:date>2020-06-24T13:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 - flash erase/write problem with S32DS and variable at specific location</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-flash-erase-write-problem-with-S32DS-and-variable-at/m-p/1088257#M7827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you tried defining the structure in that location without initializing it? I think this could be due to the interpretation the compiler is doing about initializing the structure as a dependant address global variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Alexis Andalon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2020 22:58:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-flash-erase-write-problem-with-S32DS-and-variable-at/m-p/1088257#M7827</guid>
      <dc:creator>Alexis_A</dc:creator>
      <dc:date>2020-06-25T22:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 - flash erase/write problem with S32DS and variable at specific location</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-flash-erase-write-problem-with-S32DS-and-variable-at/m-p/1088258#M7828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alexis,&lt;BR /&gt;I need it initialized, because it's part of bootloader and I need to know the data at the startup, I cannot assign them in runtime, because I will be overwriting this area by Cyclone programmer if necessary (but it should use defaults written by JTAG when flashing bootloader for the first time).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But anyway I tried it and just did&lt;/P&gt;&lt;P&gt;uint8_t tmpdata[8] __attribute__((section(".cfgdata"))) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and in main()&lt;BR /&gt;tmpdata[0]=7;&lt;/P&gt;&lt;P&gt;tmpdata[1]=6;&lt;/P&gt;&lt;P&gt;tmpdata[2]=5;&lt;/P&gt;&lt;P&gt;tmpdata[3]=4;&lt;/P&gt;&lt;P&gt;tmpdata[4]=3;&lt;/P&gt;&lt;P&gt;tmpdata[5]=2;&lt;/P&gt;&lt;P&gt;tmpdata[6]=1;&lt;/P&gt;&lt;P&gt;tmpdata[7]=0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it crashes (jumps into defaultISR) on the second line (because I am trying to write into flash area, not ram may be)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Still I don't understand what compiler has to do with MCU instruction for erasing flash/writing phrase into flash. This was working fine on MCF51JM.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jun 2020 07:01:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-flash-erase-write-problem-with-S32DS-and-variable-at/m-p/1088258#M7828</guid>
      <dc:creator>Novalis</dc:creator>
      <dc:date>2020-06-29T07:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 - flash erase/write problem with S32DS and variable at specific location</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-flash-erase-write-problem-with-S32DS-and-variable-at/m-p/1088259#M7829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you try using the flash write command instead of writing directly to the array?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Alexis Andalon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jun 2020 17:35:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-flash-erase-write-problem-with-S32DS-and-variable-at/m-p/1088259#M7829</guid>
      <dc:creator>Alexis_A</dc:creator>
      <dc:date>2020-06-29T17:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 - flash erase/write problem with S32DS and variable at specific location</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-flash-erase-write-problem-with-S32DS-and-variable-at/m-p/1088260#M7830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alexis,&lt;BR /&gt;it's the same as at the beginig - FLASH_DRV_EraseSector returns 0, FLASH_DRV_Program returns 0, but flash is not erased nor written.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW: I should have written, that I am using J-Link EDU&lt;/P&gt;&lt;P&gt;Because now I also tried PEmicro Cyclone FX and it seems to be working fine ... so much time wasted because of that stupid J-Link EDU&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2020 10:42:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-flash-erase-write-problem-with-S32DS-and-variable-at/m-p/1088260#M7830</guid>
      <dc:creator>Novalis</dc:creator>
      <dc:date>2020-06-30T10:42:57Z</dc:date>
    </item>
  </channel>
</rss>

