<?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: FLASH_DRV_CommandSequence throw a signal handler which end up in DefaultISR in S32 SDK</title>
    <link>https://community.nxp.com/t5/S32-SDK/FLASH-DRV-CommandSequence-throw-a-signal-handler-which-end-up-in/m-p/1500776#M2597</link>
    <description>&lt;P&gt;Hi Brice,&lt;/P&gt;
&lt;P&gt;isn't that caused by read-while-write error? Is there any interrupt that could be triggered during the erase the operation while its handler accesses that flash block? As a first step, I would try to disable all interrupts before calling the erase function.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Lukas&lt;/P&gt;</description>
    <pubDate>Thu, 04 Aug 2022 05:30:23 GMT</pubDate>
    <dc:creator>lukaszadrapa</dc:creator>
    <dc:date>2022-08-04T05:30:23Z</dc:date>
    <item>
      <title>FLASH_DRV_CommandSequence throw a signal handler which end up in DefaultISR</title>
      <link>https://community.nxp.com/t5/S32-SDK/FLASH-DRV-CommandSequence-throw-a-signal-handler-which-end-up-in/m-p/1499678#M2592</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;We are a team of 3 developers, and i had a project using your example "flash_partitioning_s32k146" working well. We have a S32K146_100 pins, 16 MHZ clock in our project. Others component already presents were : canCom1:flexcan, intMan1:interrut_manager, watchdog1:wdog and clockMan1:clock_manager which i already talk about.&lt;/P&gt;&lt;P&gt;And my collegue just added somes components, such as: lpit1:lpit, pdb0:pdb, adCinv0:adc, trgmux1:trgmux, flexTimer_Task:ftm_mc and flexTimer_pwm1:ftm_pwm.&lt;/P&gt;&lt;P&gt;Somehow, something is broken now. And it throw a DefaultISR after i try to do&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void vInitFlashMemory()
{
    status_t ret;        /* Store the driver APIs return code */

    /* Install interrupt for Flash Command Complete event */
    INT_SYS_InstallHandler(FTFC_IRQn, CCIF_Handler, (isr_t*) 0);
    INT_SYS_EnableIRQ(FTFC_IRQn);

    /* Enable global interrupt */
    INT_SYS_EnableIRQGlobal();

    /* Always initialize the driver before calling other functions */
    FLASH_DRV_Init(&amp;amp;FlashEEPROM_InitConfig0, &amp;amp;flashSSDConfig);

    /* Config FlexRAM as EEPROM if it is currently used as traditional RAM */
    if (flashSSDConfig.EEESize == 0u)
    {
#ifndef FLASH_TARGET
        /* First, erase all Flash blocks if code is placed in RAM to ensure
         * the IFR region is blank before partitioning FLexNVM and FlexRAM */
        ret = FLASH_DRV_EraseAllBlock(&amp;amp;flashSSDConfig);
        DEV_ASSERT(STATUS_SUCCESS == ret);

        /* Verify the erase operation at margin level value of 1 */
        ret = FLASH_DRV_VerifyAllBlock(&amp;amp;flashSSDConfig, 1u);
        DEV_ASSERT(STATUS_SUCCESS == ret);
#endif

	 /* Configure FlexRAM as EEPROM and FlexNVM as EEPROM backup region,
          * DEFlashPartition will be failed if the IFR region isn't blank.
	  * Refer to the device document for valid EEPROM Data Size Code
	  * and FlexNVM Partition Code. For example on S32K144:
	  * - EEEDataSizeCode = 0x02u: EEPROM size = 4 Kbytes
	  * - DEPartitionCode = 0x08u: EEPROM backup size = 64 Kbytes */
	 ret = FLASH_DRV_DEFlashPartition(&amp;amp;flashSSDConfig, 0x02u, 0x08u, 0x0u, false, true);

	 /* Re-initialize the driver to update the new EEPROM configuration */
	 ret = FLASH_DRV_Init(&amp;amp;FlashEEPROM_InitConfig0, &amp;amp;flashSSDConfig);
    }

    /* Make FlexRAM available for EEPROM */
    ret = FLASH_DRV_SetFlexRamFunction(&amp;amp;flashSSDConfig, EEE_ENABLE, 0x00u, &amp;amp;EEPROM_status);
}&lt;/LI-CODE&gt;&lt;P&gt;It goes inside&amp;nbsp;FLASH_DRV_EraseAllBlock function, then FLASH_DRV_CommandSequence, and at the end of the function throw a &amp;lt;signal handler called&amp;gt;() at 0xfffffff9&lt;/P&gt;&lt;P&gt;Which give me on View Disassembly ( i dunno if it's help)&lt;/P&gt;&lt;LI-CODE lang="c"&gt;fffffff1:   movs    r0, r0
fffffff3:   movs    r0, r0
fffffff5:   movs    r0, r0
fffffff7:   movs    r0, r0
fffffff9:   Unable to retrieve disassembly data from backend.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have set in my linker a RAM0 bloc m_data_RAM0:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/* Entry Point */
ENTRY(Reset_Handler)

HEAP_SIZE  = DEFINED(__heap_size__)  ? __heap_size__  : 0x00000400;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x00000400;

/* If symbol __flash_vector_table__=1 is defined at link time
 * the interrupt vector will not be copied to RAM.
 * Warning: Using the interrupt vector from Flash will not allow
 * INT_SYS_InstallHandler because the section is Read Only.
 */
M_VECTOR_RAM_SIZE = DEFINED(__flash_vector_table__) ? 0x0 : 0x0400;

/* Specify the memory areas */
MEMORY
{
  /* Flash */
  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400
  m_flash_config        (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000010
  m_text                (RX)  : ORIGIN = 0x00000410, LENGTH = 0x0006FBF0
  
  ROM_CALIBRATION       (RW)  : ORIGIN = 0x00070000, LENGTH = 0x0000F000 /* 60k */

  /* data_flash */
  eeprom_dat            (RW)  : ORIGIN = 0x10008000, LENGTH = 0x00001000 /* 4K */
  
  /* SRAM_L */
  m_data                (RW)  : ORIGIN = 0x1FFF0000, LENGTH = 0x00008000 /* 32k */
  m_data_2              (RW)  : ORIGIN = 0x1FFF8000, LENGTH = 0x00004000 /* 16k */
  
  m_data_RAM0           (RW)  : ORIGIN = 0x1FFFC000, LENGTH = 0x00004000 /* 16k  */

  /* SRAM_U */
  RAM_CALIBRATION       (RW)  : ORIGIN = 0x20000000, LENGTH = 0x0000F000 /* 60k */
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With .SRAM0 defined as:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;  .SRAM0 ORIGIN(m_data_RAM0) :/*6K*/
  {
    . = ALIGN(4);  
    KEEP(*(.SRAM0))    /*  Keep section even if not referenced. */
      . = ALIGN(4);  
  } &amp;gt; m_data_RAM0&lt;/LI-CODE&gt;&lt;P&gt;And defined two functions as in the example:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void CCIF_Handler(void);
/* If target is flash, insert this macro to locate callback function into RAM */
void CCIF_Callback(void) __attribute__((section (".SRAM0")));

/*!
  \brief Interrupt handler for Flash Command Complete event
*/
void CCIF_Handler(void)
{
    /* Disable Flash Command Complete interrupt */
    FTFx_FCNFG &amp;amp;= (~FTFx_FCNFG_CCIE_MASK);

    return;
}

/*!
  \brief Callback function for Flash operations
*/
void CCIF_Callback(void)
{
    /* Enable interrupt for Flash Command Complete */
    if ((FTFx_FCNFG &amp;amp; FTFx_FCNFG_CCIE_MASK) == 0u)
    {
        FTFx_FCNFG |= FTFx_FCNFG_CCIE_MASK;
    }
}&lt;/LI-CODE&gt;&lt;P&gt;I am compiling with GCC.&lt;/P&gt;&lt;P&gt;If i look at my .map file i have:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;.SRAM0          0x1fffc000       0x7c
                0x1fffc000                . = ALIGN (0x4)
 *(.SRAM0)
 .SRAM0         0x1fffc000       0x30 ./Sources/EEPROM/EEPROM_manager.o
                0x1fffc000                CCIF_Callback
 .SRAM0         0x1fffc030       0x4a ./Sources/CAN/Com/App_Com.o
                0x1fffc07c                . = ALIGN (0x4)
 *fill*         0x1fffc07a        0x2 &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have any ideas, about what could have broke the project and give me this issue ? I am searching for a week now, and i am running out of ideas of where to look.&lt;/P&gt;&lt;P&gt;I have read some topics from other projects, which are saying that the Vector table must be in RAM too for some cases, as VTOR, but i don't know how to do that.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Brice&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 15:15:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-SDK/FLASH-DRV-CommandSequence-throw-a-signal-handler-which-end-up-in/m-p/1499678#M2592</guid>
      <dc:creator>BriceC</dc:creator>
      <dc:date>2022-08-02T15:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: FLASH_DRV_CommandSequence throw a signal handler which end up in DefaultISR</title>
      <link>https://community.nxp.com/t5/S32-SDK/FLASH-DRV-CommandSequence-throw-a-signal-handler-which-end-up-in/m-p/1500318#M2593</link>
      <description>&lt;P&gt;I found in SHCSR register a value that indicates me a MemFault&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MemFaultError.PNG" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/188974iA0A300E09C8745BA/image-size/large?v=v2&amp;amp;px=999" role="button" title="MemFaultError.PNG" alt="MemFaultError.PNG" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;MemFaultError.PNG&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2022 13:49:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-SDK/FLASH-DRV-CommandSequence-throw-a-signal-handler-which-end-up-in/m-p/1500318#M2593</guid>
      <dc:creator>BriceC</dc:creator>
      <dc:date>2022-08-03T13:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: FLASH_DRV_CommandSequence throw a signal handler which end up in DefaultISR</title>
      <link>https://community.nxp.com/t5/S32-SDK/FLASH-DRV-CommandSequence-throw-a-signal-handler-which-end-up-in/m-p/1500776#M2597</link>
      <description>&lt;P&gt;Hi Brice,&lt;/P&gt;
&lt;P&gt;isn't that caused by read-while-write error? Is there any interrupt that could be triggered during the erase the operation while its handler accesses that flash block? As a first step, I would try to disable all interrupts before calling the erase function.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Lukas&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 05:30:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-SDK/FLASH-DRV-CommandSequence-throw-a-signal-handler-which-end-up-in/m-p/1500776#M2597</guid>
      <dc:creator>lukaszadrapa</dc:creator>
      <dc:date>2022-08-04T05:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: FLASH_DRV_CommandSequence throw a signal handler which end up in DefaultISR</title>
      <link>https://community.nxp.com/t5/S32-SDK/FLASH-DRV-CommandSequence-throw-a-signal-handler-which-end-up-in/m-p/1501129#M2600</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for your answer. I tried to disable interrupts but it was not the issue.&lt;/P&gt;&lt;P&gt;At the end we have just removed EraseAllBlock and VerifyAllBlock function, and the program seems to run. I didn't tested so much right now, so maybe theses functions are not needed.&lt;/P&gt;&lt;P&gt;About read-while-write, we didn't defined asynchrones functions and this part of the code is almost at the top of the main.c, just after Clock initialisation. So it should not have this kind of issues i guess ?&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 12:36:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-SDK/FLASH-DRV-CommandSequence-throw-a-signal-handler-which-end-up-in/m-p/1501129#M2600</guid>
      <dc:creator>BriceC</dc:creator>
      <dc:date>2022-08-04T12:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: FLASH_DRV_CommandSequence throw a signal handler which end up in DefaultISR</title>
      <link>https://community.nxp.com/t5/S32-SDK/FLASH-DRV-CommandSequence-throw-a-signal-handler-which-end-up-in/m-p/1501657#M2605</link>
      <description>&lt;P&gt;I'm confused now. Is the project executed from RAM or from flash? If you run it from flash,it doesn't make sense to run FLASH_DRV_EraseAllBlock command because it will erase everything and even if FLASH_DRV_EraseAllBlock&amp;nbsp; runs from RAM, there's no code you can return to.&lt;/P&gt;
&lt;P&gt;Because there's &lt;/P&gt;
&lt;PRE class="lia-code-sample  language-c"&gt;&lt;CODE&gt;#ifndef FLASH_TARGET&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;... it should be executed only when the project is running from RAM using the debugger. &lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Lukas&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 07:59:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-SDK/FLASH-DRV-CommandSequence-throw-a-signal-handler-which-end-up-in/m-p/1501657#M2605</guid>
      <dc:creator>lukaszadrapa</dc:creator>
      <dc:date>2022-08-05T07:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: FLASH_DRV_CommandSequence throw a signal handler which end up in DefaultISR</title>
      <link>https://community.nxp.com/t5/S32-SDK/FLASH-DRV-CommandSequence-throw-a-signal-handler-which-end-up-in/m-p/1501677#M2606</link>
      <description>&lt;P&gt;Hi Lukas,&lt;/P&gt;&lt;P&gt;It was in FLASH configuration yes.&lt;/P&gt;&lt;P&gt;I am a bit confused too, so if i understood, FLASH_DRV_EraseAllBlock will Erase P-Flash, D-Flash and EERAM, and if the code isn't in RAM, it will be erased, meaning we erased ourself and lead to a Hardfault error with memory RAM error.&lt;/P&gt;&lt;P&gt;But if the code is in RAM it can return to the RAM and keep being executed. What i don't get is why it was working the first time when we didn't used RAM configuration.&lt;/P&gt;&lt;P&gt;I have another question, from where are executed FLASH_DRV_EraseSector and FLASH_DRV_EraseAllBlock ? It depend of theses lines ?&lt;/P&gt;&lt;LI-CODE lang="c"&gt;  .code : AT(__CODE_ROM)
  {
    . = ALIGN(4);
    __CODE_RAM = .;
    __code_start__ = .;      /* Create a global symbol at code start. */
    __code_ram_start__ = .;
    *(.code_ram)             /* Custom section for storing code in RAM */
    . = ALIGN(4);
    __code_end__ = .;        /* Define a global symbol at code end. */
    __code_ram_end__ = .;
  } &amp;gt; m_data

  __CODE_END = __CODE_ROM + (__code_end__ - __code_start__);
  __CUSTOM_ROM = __CODE_END;&lt;/LI-CODE&gt;&lt;P&gt;or with RAM configuration&lt;/P&gt;&lt;LI-CODE lang="c"&gt;  /* Section for storing functions that needs to execute from RAM */
  .code_ram :
  {
    . = ALIGN(4);
    __CODE_RAM = .;
    __code_ram_start__ = .;
    *(.code_ram)               /* Custom section for storing code in RAM */
    __CODE_ROM = .;            /* Symbol is used by start-up for data initialization. */
    __CODE_END = .;            /* No copy */
    __code_ram_end__ = .;
    . = ALIGN(4);
  } &amp;gt; m_text

  __etext = .;    /* Define a global symbol at end of code. */
  __DATA_ROM = .; /* Symbol is used by startup for data initialization. */
  __DATA_END = __DATA_ROM; /* No copy */&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 05 Aug 2022 08:22:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-SDK/FLASH-DRV-CommandSequence-throw-a-signal-handler-which-end-up-in/m-p/1501677#M2606</guid>
      <dc:creator>BriceC</dc:creator>
      <dc:date>2022-08-05T08:22:05Z</dc:date>
    </item>
  </channel>
</rss>

