Flash example for s32k116

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Flash example for s32k116

Jump to solution
2,001 Views
AbhiMR
Contributor II

Hi NXP ,

             In ld file i need to define section as below,

MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x000000C0
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0001F7E0
m_layout1  (RX) : ORIGIN = 0x0001FBF0, LENGTH = 0x00000400
m_layout2  (RX) : ORIGIN = 0x0001FFF0, LENGTH = 0x00000000

}

 

after which I started using flashdriver.c and .h file .

FLASH_DRV_Init()

/* For erase */

ret = FLASH_DRV_EraseSector(&flashSSDConfig, u32Address, BLOCK_SIZE);
DEV_ASSERT(STATUS_SUCCESS == ret);

 

/* Write data which are of 4 bytes minimum */
ret = FLASH_DRV_Program(&flashSSDConfig, u32Address, MAL_MEM_FLASH_SECTOR_SIZE, u16Data);
DEV_ASSERT(STATUS_SUCCESS == ret);

/* read */

memcpy(store  , linkarray, size );

 

In my code it will work only few time and not consistent with memcpy.

what will be the way to write properly , what are all we need to do config intially ?

Do we have any read function other than memcpy ?

 

Could you please help with better example for this usage ?

0 Kudos
Reply
1 Solution
1,877 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @AbhiMR,

If you generated the SDK code in S32DS 3.4 with SDK 4.0.3 installed, you would get this structure

/* Flash user configuration 0 */
const flash_user_config_t Flash_InitConfig0 =
{
.PFlashBase = 0x0U,
.PFlashSize = 0x20000U,
.DFlashBase = 0x10000000U,
.EERAMBase = 0x14000000U,
.CallBack = NULL_CALLBACK
};

in .../board/peripherals_flash_FTFC.c

Not this:

const flash_user_config_t Flash_InitConfig =
{
/*.PFlashBase = 0x0001FBF0U,
.PFlashSize = 0x0001FBF0U,
.DFlashBase = 0x1FFFFC00U,
.EERAMBase = 0x20000000U,
.CallBack = NULL_CALLBACK
*/
.PFlashBase = 0,
.PFlashSize = 0x20000U,
.DFlashBase = 0x0001FFF0U,
.EERAMBase = 0x20000000U,
.CallBack = NULL_CALLBACK
};

 

You need to:

  1. Install S32DS 3.4
  2. Install SDK 4.0.3
  3. Create flash_partitioning_s32k116 from example
  4. Generate the SDK configuration:

     

danielmartynek_1-1734953451248.png

 

Regards,

Daniel

 

 

View solution in original post

0 Kudos
Reply
5 Replies
1,979 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @AbhiMR,

I'm not sure I understand the issue here.

You can refer to the S32K1xx RTD drivers.

There is Ftfc_Mem_InFls_Ip_Read() in Ftfc_Mem_InFls_Ip.c

The flash can be read through a pointer, simply like this:

  for(uint32_t i = 0; i < size; i++){
    read_buffer[i] = *((volatile uint8_t *)(address + i));
  }

Check the memory with the debugger after each write.

 

Regards,

Daniel

0 Kudos
Reply
1,959 Views
AbhiMR
Contributor II
extern const flash_user_config_t Flash_InitConfig0;
/* Flash user configuration 0 */
const flash_user_config_t Flash_InitConfig =
{
/*.PFlashBase = 0x0001FBF0U,
.PFlashSize = 0x0001FBF0U,
.DFlashBase = 0x1FFFFC00U,
.EERAMBase = 0x20000000U,
.CallBack = NULL_CALLBACK
*/
.PFlashBase = 0,
.PFlashSize = 0x20000U,
.DFlashBase = 0x0001FFF0U,
.EERAMBase = 0x20000000U,
.CallBack = NULL_CALLBACK
};
How to configure this? I f I change, erase will fail. Can you please provide me an example I can be able to read write above designed layout. Or how i can customise and use in s32k116 please let me know?

Basically i need to do read, write and earse operation on this
m_layout1 (RX) : ORIGIN = 0x0001FBF0, LENGTH = 0x00000400
m_layout2 (RX) : ORIGIN = 0x0001FFF0, LENGTH = 0x00000000
0 Kudos
Reply
1,955 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @AbhiMR,

Where did you get the Flash_InitConfig and the flashdriver.c and .h files? It does not mach the S32K116 memory map (S32K1xx_Memory_Map.xlsx attached to the Reference Manual).

Please use either the S32DS 3.4 IDE with the SDK drivers, or preferably the S32DS3.5 IDE with the  RTD drivers.

There is a GUI that allows you to configure the structures such as Flash_InitConfig.

 

Regards,

Daniel

0 Kudos
Reply
1,925 Views
AbhiMR
Contributor II

/* * Copyright 2020 NXP * All rights reserved. * * NXP Confidential. This software is owned or controlled by NXP and may only be * used strictly in accordance with the applicable license terms. By expressly * accepting such terms or by downloading, installing, activating and/or otherwise * using the software, you are agreeing that you have read, and that you agree to * comply with and are bound by, such license terms. If you do not agree to be * bound by the applicable license terms, then you may not retain, install, * activate or otherwise use the software. The production use license in * Section 2.3 is expressly granted for this software. */ /* ################################################################### ** Filename : main.c ** Project : flash_partitioning_s32k116 ** Processor : s32k116 ** Abstract : ** Main module. ** This module contains user's application code. ** Settings : ** Contents : ** No public methods ** ** ###################################################################*/ /*! ** @file main.c ** @brief ** Main module. ** This module contains user's application code. */ /*! ** @addtogroup main_module main module documentation ** @{ */ /* MODULE main */ /* Including necessary configuration files. */ #include "sdk_project_config.h" #include "interrupt_manager.h" volatile int exit_code = 0; /* User includes */ /* Declare a FLASH config struct which initialized by FlashInit, and will be used by all flash operations */ flash_ssd_config_t flashSSDConfig; /* Data source for program operation */ #define BUFFER_SIZE 0x100u /* Size of data source */ uint8_t sourceBuffer[BUFFER_SIZE]; /* Function declarations */ void CCIF_Handler(void); /* If target is flash, insert this macro to locate callback function into RAM */ START_FUNCTION_DECLARATION_RAMSECTION void CCIF_Callback(void) END_FUNCTION_DECLARATION_RAMSECTION /*! \brief The main function for the project. \details The startup initialization sequence is the following: * - startup asm routine * - main() */ int main(void) { /* Write your local variable definition here */ status_t ret; /* Store the driver APIs return code */ uint32_t address; uint32_t size; uint32_t failAddr; uint32_t i; flash_callback_t pCallBack; #if (FEATURE_FLS_HAS_PROGRAM_PHRASE_CMD == 1u) #ifndef FLASH_TARGET uint8_t unsecure_key[FTFx_PHRASE_SIZE] = {0xFFu, 0xFFu, 0xFFu, 0xFFu, 0xFEu, 0xFFu, 0xFFu, 0xFFu}; #endif #else /* FEATURE_FLASH_HAS_PROGRAM_LONGWORD_CMD */ uint8_t unsecure_key[FTFx_LONGWORD_SIZE] = {0xFEu, 0xFFu, 0xFFu, 0xFFu}; #endif /* FEATURE_FLS_HAS_PROGRAM_PHRASE_CMD */ /* Write your code here */ /* Initialize and configure clocks * - see clock manager component for details */ CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT); CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT); /* Init source data */ for (i = 0u; i < BUFFER_SIZE; i++) { sourceBuffer[i] = i; } /* Disable cache to ensure that all flash operations will take effect instantly, * this is device dependent */ #ifndef FLASH_TARGET #ifdef S32K11x_SERIES MSCM->OCMDR[0u] |= MSCM_OCMDR_OCM1(0x3u); MSCM->OCMDR[1u] |= MSCM_OCMDR_OCM1(0x3u); #endif /* S32K11x_SERIES */ #endif /* FLASH_TARGET */ /* 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 */ ret = FLASH_DRV_Init(&Flash_InitConfig0, &flashSSDConfig); DEV_ASSERT(STATUS_SUCCESS == ret); /* Erase a sector in DFlash */ address = flashSSDConfig.DFlashBase; size = FEATURE_FLS_DF_BLOCK_SECTOR_SIZE; ret = FLASH_DRV_EraseSector(&flashSSDConfig, address, size); DEV_ASSERT(STATUS_SUCCESS == ret); /* Verify the erase operation at margin level value of 1, user read */ ret = FLASH_DRV_VerifySection(&flashSSDConfig, address, size / FTFx_PHRASE_SIZE, 1u); DEV_ASSERT(STATUS_SUCCESS == ret); /* Write some data to the erased DFlash sector */ address = flashSSDConfig.DFlashBase; size = BUFFER_SIZE; ret = FLASH_DRV_Program(&flashSSDConfig, address, size, sourceBuffer); DEV_ASSERT(STATUS_SUCCESS == ret); /* Verify the program operation at margin level value of 1, user margin */ ret = FLASH_DRV_ProgramCheck(&flashSSDConfig, address, size, sourceBuffer, &failAddr, 1u); DEV_ASSERT(STATUS_SUCCESS == ret); /* Remove warning for unused variable */ (void)ret; for(;;) { if(exit_code != 0) { break; } } return exit_code; }

 

 

Its hitting Device assert. 

In this I want to explore how to use dflash 

0 Kudos
Reply
1,878 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @AbhiMR,

If you generated the SDK code in S32DS 3.4 with SDK 4.0.3 installed, you would get this structure

/* Flash user configuration 0 */
const flash_user_config_t Flash_InitConfig0 =
{
.PFlashBase = 0x0U,
.PFlashSize = 0x20000U,
.DFlashBase = 0x10000000U,
.EERAMBase = 0x14000000U,
.CallBack = NULL_CALLBACK
};

in .../board/peripherals_flash_FTFC.c

Not this:

const flash_user_config_t Flash_InitConfig =
{
/*.PFlashBase = 0x0001FBF0U,
.PFlashSize = 0x0001FBF0U,
.DFlashBase = 0x1FFFFC00U,
.EERAMBase = 0x20000000U,
.CallBack = NULL_CALLBACK
*/
.PFlashBase = 0,
.PFlashSize = 0x20000U,
.DFlashBase = 0x0001FFF0U,
.EERAMBase = 0x20000000U,
.CallBack = NULL_CALLBACK
};

 

You need to:

  1. Install S32DS 3.4
  2. Install SDK 4.0.3
  3. Create flash_partitioning_s32k116 from example
  4. Generate the SDK configuration:

     

danielmartynek_1-1734953451248.png

 

Regards,

Daniel

 

 

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2014928%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EFlash%20example%20for%20s32k116%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2014928%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20NXP%20%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BIn%20ld%20file%20i%20need%20to%20define%20section%20as%20below%2C%3C%2FP%3E%3CP%3EMEMORY%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%2F*%20Flash%20*%2F%3CBR%20%2F%3Em_interrupts%20(RX)%20%3A%20ORIGIN%20%3D%200x00000000%2C%20LENGTH%20%3D%200x000000C0%3CBR%20%2F%3Em_flash_config%20(RX)%20%3A%20ORIGIN%20%3D%200x00000400%2C%20LENGTH%20%3D%200x00000010%3CBR%20%2F%3Em_text%20(RX)%20%3A%20ORIGIN%20%3D%200x00000410%2C%20LENGTH%20%3D%200x0001F7E0%3CBR%20%2F%3Em_layout1%26nbsp%3B%20(RX)%20%3A%20ORIGIN%20%3D%200x0001FBF0%2C%20LENGTH%20%3D%200x00000400%3CBR%20%2F%3Em_layout2%26nbsp%3B%20(RX)%20%3A%20ORIGIN%20%3D%200x0001FFF0%2C%20LENGTH%20%3D%200x00000000%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Eafter%20which%20I%20started%20using%20flashdriver.c%20and%20.h%20file%20.%3C%2FP%3E%3CP%3EFLASH_DRV_Init()%3C%2FP%3E%3CP%3E%2F*%20For%20erase%20*%2F%3C%2FP%3E%3CP%3Eret%20%3D%20FLASH_DRV_EraseSector(%26amp%3BflashSSDConfig%2C%20u32Address%2C%20BLOCK_SIZE)%3B%3CBR%20%2F%3EDEV_ASSERT(STATUS_SUCCESS%20%3D%3D%20ret)%3B%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%2F*%20Write%20data%20which%20are%20of%204%20bytes%20minimum%20*%2F%3CBR%20%2F%3Eret%20%3D%20FLASH_DRV_Program(%26amp%3BflashSSDConfig%2C%20u32Address%2C%20MAL_MEM_FLASH_SECTOR_SIZE%2C%20u16Data)%3B%3CBR%20%2F%3EDEV_ASSERT(STATUS_SUCCESS%20%3D%3D%20ret)%3B%3C%2FP%3E%3CP%3E%2F*%20read%20*%2F%3C%2FP%3E%3CP%3Ememcpy(store%26nbsp%3B%20%2C%20linkarray%2C%20size%20)%3B%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EIn%20my%20code%20it%20will%20work%20only%20few%20time%20and%20not%20consistent%20with%20memcpy.%3C%2FP%3E%3CP%3Ewhat%20will%20be%20the%20way%20to%20write%20properly%20%2C%20what%20are%20all%20we%20need%20to%20do%20config%20intially%20%3F%3C%2FP%3E%3CP%3EDo%20we%20have%20any%20read%20function%20other%20than%20memcpy%20%3F%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ECould%20you%20please%20help%20with%20better%20example%20for%20this%20usage%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2018575%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Flash%20example%20for%20s32k116%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2018575%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F242862%22%20target%3D%22_blank%22%3E%40AbhiMR%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EIf%20you%20generated%20the%20SDK%20code%20in%20S32DS%203.4%20with%20SDK%204.0.3%20installed%2C%20you%20would%20get%20this%20structure%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3E%2F*%20Flash%20user%20configuration%200%20*%2F%0Aconst%20flash_user_config_t%20Flash_InitConfig0%20%3D%0A%7B%0A.PFlashBase%20%3D%200x0U%2C%0A.PFlashSize%20%3D%200x20000U%2C%0A.DFlashBase%20%3D%200x10000000U%2C%0A.EERAMBase%20%3D%200x14000000U%2C%0A.CallBack%20%3D%20NULL_CALLBACK%0A%7D%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Ein%20...%2Fboard%2Fperipherals_flash_FTFC.c%3C%2FP%3E%0A%3CP%3ENot%20this%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3Econst%20flash_user_config_t%20Flash_InitConfig%20%3D%0A%7B%0A%2F*.PFlashBase%20%3D%200x0001FBF0U%2C%0A.PFlashSize%20%3D%200x0001FBF0U%2C%0A.DFlashBase%20%3D%200x1FFFFC00U%2C%0A.EERAMBase%20%3D%200x20000000U%2C%0A.CallBack%20%3D%20NULL_CALLBACK%0A*%2F%0A.PFlashBase%20%3D%200%2C%0A.PFlashSize%20%3D%200x20000U%2C%0A.DFlashBase%20%3D%200x0001FFF0U%2C%0A.EERAMBase%20%3D%200x20000000U%2C%0A.CallBack%20%3D%20NULL_CALLBACK%0A%7D%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CBR%20%2F%3E%0A%3CP%3EYou%20need%20to%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EInstall%20S32DS%203.4%3C%2FLI%3E%0A%3CLI%3EInstall%20SDK%204.0.3%3C%2FLI%3E%0A%3CLI%3ECreate%20flash_partitioning_s32k116%20from%20example%3C%2FLI%3E%0A%3CLI%3EGenerate%20the%20SDK%20configuration%3A%3CBR%20%2F%3E%0A%3CBR%20%2F%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22danielmartynek_1-1734953451248.png%22%20style%3D%22width%3A%20566px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22danielmartynek_1-1734953451248.png%22%20style%3D%22width%3A%20566px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F317071i33790B800D73E016%2Fimage-dimensions%2F566x281%3Fv%3Dv2%22%20width%3D%22566%22%20height%3D%22281%22%20role%3D%22button%22%20title%3D%22danielmartynek_1-1734953451248.png%22%20alt%3D%22danielmartynek_1-1734953451248.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3EDaniel%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2017336%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Flash%20example%20for%20s32k116%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2017336%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%2F*%20*%20Copyright%202020%20NXP%20*%20All%20rights%20reserved.%20*%20*%20NXP%20Confidential.%20This%20software%20is%20owned%20or%20controlled%20by%20NXP%20and%20may%20only%20be%20*%20used%20strictly%20in%20accordance%20with%20the%20applicable%20license%20terms.%20By%20expressly%20*%20accepting%20such%20terms%20or%20by%20downloading%2C%20installing%2C%20activating%20and%2For%20otherwise%20*%20using%20the%20software%2C%20you%20are%20agreeing%20that%20you%20have%20read%2C%20and%20that%20you%20agree%20to%20*%20comply%20with%20and%20are%20bound%20by%2C%20such%20license%20terms.%20If%20you%20do%20not%20agree%20to%20be%20*%20bound%20by%20the%20applicable%20license%20terms%2C%20then%20you%20may%20not%20retain%2C%20install%2C%20*%20activate%20or%20otherwise%20use%20the%20software.%20The%20production%20use%20license%20in%20*%20Section%202.3%20is%20expressly%20granted%20for%20this%20software.%20*%2F%20%2F*%20%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%20**%20Filename%20%3A%20main.c%20**%20Project%20%3A%20flash_partitioning_s32k116%20**%20Processor%20%3A%20s32k116%20**%20Abstract%20%3A%20**%20Main%20module.%20**%20This%20module%20contains%20user's%20application%20code.%20**%20Settings%20%3A%20**%20Contents%20%3A%20**%20No%20public%20methods%20**%20**%20%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23*%2F%20%2F*!%20**%20%40file%20main.c%20**%20%40brief%20**%20Main%20module.%20**%20This%20module%20contains%20user's%20application%20code.%20*%2F%20%2F*!%20**%20%40addtogroup%20main_module%20main%20module%20documentation%20**%20%40%7B%20*%2F%20%2F*%20MODULE%20main%20*%2F%20%2F*%20Including%20necessary%20configuration%20files.%20*%2F%20%23include%20%22sdk_project_config.h%22%20%23include%20%22interrupt_manager.h%22%20volatile%20int%20exit_code%20%3D%200%3B%20%2F*%20User%20includes%20*%2F%20%2F*%20Declare%20a%20FLASH%20config%20struct%20which%20initialized%20by%20FlashInit%2C%20and%20will%20be%20used%20by%20all%20flash%20operations%20*%2F%20flash_ssd_config_t%20flashSSDConfig%3B%20%2F*%20Data%20source%20for%20program%20operation%20*%2F%20%23define%20BUFFER_SIZE%200x100u%20%2F*%20Size%20of%20data%20source%20*%2F%20uint8_t%20sourceBuffer%5BBUFFER_SIZE%5D%3B%20%2F*%20Function%20declarations%20*%2F%20void%20CCIF_Handler(void)%3B%20%2F*%20If%20target%20is%20flash%2C%20insert%20this%20macro%20to%20locate%20callback%20function%20into%20RAM%20*%2F%20START_FUNCTION_DECLARATION_RAMSECTION%20void%20CCIF_Callback(void)%20END_FUNCTION_DECLARATION_RAMSECTION%20%2F*!%20%5Cbrief%20The%20main%20function%20for%20the%20project.%20%5Cdetails%20The%20startup%20initialization%20sequence%20is%20the%20following%3A%20*%20-%20startup%20asm%20routine%20*%20-%20main()%20*%2F%20int%20main(void)%20%7B%20%2F*%20Write%20your%20local%20variable%20definition%20here%20*%2F%20status_t%20ret%3B%20%2F*%20Store%20the%20driver%20APIs%20return%20code%20*%2F%20uint32_t%20address%3B%20uint32_t%20size%3B%20uint32_t%20failAddr%3B%20uint32_t%20i%3B%20flash_callback_t%20pCallBack%3B%20%23if%20(FEATURE_FLS_HAS_PROGRAM_PHRASE_CMD%20%3D%3D%201u)%20%23ifndef%20FLASH_TARGET%20uint8_t%20unsecure_key%5BFTFx_PHRASE_SIZE%5D%20%3D%20%7B0xFFu%2C%200xFFu%2C%200xFFu%2C%200xFFu%2C%200xFEu%2C%200xFFu%2C%200xFFu%2C%200xFFu%7D%3B%20%23endif%20%23else%20%2F*%20FEATURE_FLASH_HAS_PROGRAM_LONGWORD_CMD%20*%2F%20uint8_t%20unsecure_key%5BFTFx_LONGWORD_SIZE%5D%20%3D%20%7B0xFEu%2C%200xFFu%2C%200xFFu%2C%200xFFu%7D%3B%20%23endif%20%2F*%20FEATURE_FLS_HAS_PROGRAM_PHRASE_CMD%20*%2F%20%2F*%20Write%20your%20code%20here%20*%2F%20%2F*%20Initialize%20and%20configure%20clocks%20*%20-%20see%20clock%20manager%20component%20for%20details%20*%2F%20CLOCK_SYS_Init(g_clockManConfigsArr%2C%20CLOCK_MANAGER_CONFIG_CNT%2C%20g_clockManCallbacksArr%2C%20CLOCK_MANAGER_CALLBACK_CNT)%3B%20CLOCK_SYS_UpdateConfiguration(0U%2C%20CLOCK_MANAGER_POLICY_AGREEMENT)%3B%20%2F*%20Init%20source%20data%20*%2F%20for%20(i%20%3D%200u%3B%20i%20%26lt%3B%20BUFFER_SIZE%3B%20i%2B%2B)%20%7B%20sourceBuffer%5Bi%5D%20%3D%20i%3B%20%7D%20%2F*%20Disable%20cache%20to%20ensure%20that%20all%20flash%20operations%20will%20take%20effect%20instantly%2C%20*%20this%20is%20device%20dependent%20*%2F%20%23ifndef%20FLASH_TARGET%20%23ifdef%20S32K11x_SERIES%20MSCM-%26gt%3BOCMDR%5B0u%5D%20%7C%3D%20MSCM_OCMDR_OCM1(0x3u)%3B%20MSCM-%26gt%3BOCMDR%5B1u%5D%20%7C%3D%20MSCM_OCMDR_OCM1(0x3u)%3B%20%23endif%20%2F*%20S32K11x_SERIES%20*%2F%20%23endif%20%2F*%20FLASH_TARGET%20*%2F%20%2F*%20Install%20interrupt%20for%20Flash%20Command%20Complete%20event%20*%2F%20INT_SYS_InstallHandler(FTFC_IRQn%2C%20CCIF_Handler%2C%20(isr_t*)%200)%3B%20INT_SYS_EnableIRQ(FTFC_IRQn)%3B%20%2F*%20Enable%20global%20interrupt%20*%2F%20INT_SYS_EnableIRQGlobal()%3B%20%2F*%20Always%20initialize%20the%20driver%20before%20calling%20other%20functions%20*%2F%20ret%20%3D%20FLASH_DRV_Init(%26amp%3BFlash_InitConfig0%2C%20%26amp%3BflashSSDConfig)%3B%20DEV_ASSERT(STATUS_SUCCESS%20%3D%3D%20ret)%3B%20%2F*%20Erase%20a%20sector%20in%20DFlash%20*%2F%20address%20%3D%20flashSSDConfig.DFlashBase%3B%20size%20%3D%20FEATURE_FLS_DF_BLOCK_SECTOR_SIZE%3B%20ret%20%3D%20FLASH_DRV_EraseSector(%26amp%3BflashSSDConfig%2C%20address%2C%20size)%3B%20DEV_ASSERT(STATUS_SUCCESS%20%3D%3D%20ret)%3B%20%2F*%20Verify%20the%20erase%20operation%20at%20margin%20level%20value%20of%201%2C%20user%20read%20*%2F%20ret%20%3D%20FLASH_DRV_VerifySection(%26amp%3BflashSSDConfig%2C%20address%2C%20size%20%2F%20FTFx_PHRASE_SIZE%2C%201u)%3B%20DEV_ASSERT(STATUS_SUCCESS%20%3D%3D%20ret)%3B%20%2F*%20Write%20some%20data%20to%20the%20erased%20DFlash%20sector%20*%2F%20address%20%3D%20flashSSDConfig.DFlashBase%3B%20size%20%3D%20BUFFER_SIZE%3B%20ret%20%3D%20FLASH_DRV_Program(%26amp%3BflashSSDConfig%2C%20address%2C%20size%2C%20sourceBuffer)%3B%20DEV_ASSERT(STATUS_SUCCESS%20%3D%3D%20ret)%3B%20%2F*%20Verify%20the%20program%20operation%20at%20margin%20level%20value%20of%201%2C%20user%20margin%20*%2F%20ret%20%3D%20FLASH_DRV_ProgramCheck(%26amp%3BflashSSDConfig%2C%20address%2C%20size%2C%20sourceBuffer%2C%20%26amp%3BfailAddr%2C%201u)%3B%20DEV_ASSERT(STATUS_SUCCESS%20%3D%3D%20ret)%3B%20%2F*%20Remove%20warning%20for%20unused%20variable%20*%2F%20(void)ret%3B%20for(%3B%3B)%20%7B%20if(exit_code%20!%3D%200)%20%7B%20break%3B%20%7D%20%7D%20return%20exit_code%3B%20%7D%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CP%3EIts%20hitting%20Device%20assert.%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20this%20I%20want%20to%20explore%20how%20to%20use%20dflash%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2017240%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Flash%20example%20for%20s32k116%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2017240%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F242862%22%20target%3D%22_blank%22%3E%40AbhiMR%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EWhere%20did%20you%20get%20the%20Flash_InitConfig%20and%20the%20flashdriver.c%20and%20.h%20files%3F%20It%20does%20not%20mach%20the%20S32K116%20memory%20map%20(S32K1xx_Memory_Map.xlsx%20attached%20to%20the%20Reference%20Manual).%3C%2FP%3E%0A%3CP%3EPlease%20use%20either%20the%20S32DS%203.4%20IDE%20with%20the%20SDK%20drivers%2C%20or%20preferably%20the%20S32DS3.5%20IDE%20with%20the%26nbsp%3B%20RTD%20drivers.%3C%2FP%3E%0A%3CP%3EThere%20is%20a%20GUI%20that%20allows%20you%20to%20configure%20the%20structures%20such%20as%20Flash_InitConfig.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3EDaniel%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2017228%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Flash%20example%20for%20s32k116%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2017228%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Eextern%20const%20flash_user_config_t%20Flash_InitConfig0%3B%3CBR%20%2F%3E%2F*%20Flash%20user%20configuration%200%20*%2F%3CBR%20%2F%3Econst%20flash_user_config_t%20Flash_InitConfig%20%3D%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%2F*.PFlashBase%20%3D%200x0001FBF0U%2C%3CBR%20%2F%3E.PFlashSize%20%3D%200x0001FBF0U%2C%3CBR%20%2F%3E.DFlashBase%20%3D%200x1FFFFC00U%2C%3CBR%20%2F%3E.EERAMBase%20%3D%200x20000000U%2C%3CBR%20%2F%3E.CallBack%20%3D%20NULL_CALLBACK%3CBR%20%2F%3E*%2F%3CBR%20%2F%3E.PFlashBase%20%3D%200%2C%3CBR%20%2F%3E.PFlashSize%20%3D%200x20000U%2C%3CBR%20%2F%3E.DFlashBase%20%3D%200x0001FFF0U%2C%3CBR%20%2F%3E.EERAMBase%20%3D%200x20000000U%2C%3CBR%20%2F%3E.CallBack%20%3D%20NULL_CALLBACK%3CBR%20%2F%3E%7D%3B%3CBR%20%2F%3EHow%20to%20configure%20this%3F%20I%20f%20I%20change%2C%20erase%20will%20fail.%20Can%20you%20please%20provide%20me%20an%20example%20I%20can%20be%20able%20to%20read%20write%20above%20designed%20layout.%20Or%20how%20i%20can%20customise%20and%20use%20in%20s32k116%20please%20let%20me%20know%3F%3CBR%20%2F%3E%3CBR%20%2F%3EBasically%20i%20need%20to%20do%20read%2C%20write%20and%20earse%20operation%20on%20this%3CBR%20%2F%3Em_layout1%20(RX)%20%3A%20ORIGIN%20%3D%200x0001FBF0%2C%20LENGTH%20%3D%200x00000400%3CBR%20%2F%3Em_layout2%20(RX)%20%3A%20ORIGIN%20%3D%200x0001FFF0%2C%20LENGTH%20%3D%200x00000000%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2015388%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Flash%20example%20for%20s32k116%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2015388%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F242862%22%20target%3D%22_blank%22%3E%40AbhiMR%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EI'm%20not%20sure%20I%20understand%20the%20issue%20here.%3C%2FP%3E%0A%3CP%3EYou%20can%20refer%20to%20the%20S32K1xx%20RTD%20drivers.%3C%2FP%3E%0A%3CP%3EThere%20is%20%3CSTRONG%3EFtfc_Mem_InFls_Ip_Read()%3C%2FSTRONG%3E%20in%20%3CSTRONG%3EFtfc_Mem_InFls_Ip.c%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThe%20flash%20can%20be%20read%20through%20a%20pointer%2C%20simply%20like%20this%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3E%20%20for(uint32_t%20i%20%3D%200%3B%20i%20%26lt%3B%20size%3B%20i%2B%2B)%7B%0A%20%20%20%20read_buffer%5Bi%5D%20%3D%20*((volatile%20uint8_t%20*)(address%20%2B%20i))%3B%0A%20%20%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3ECheck%20the%20memory%20with%20the%20debugger%20after%20each%20write.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3EDaniel%3C%2FP%3E%3C%2FLINGO-BODY%3E