Skip to content

Commit 7c626ee

Browse files
hal/nxp: s32K344: flash_c40: add C40 features, IP aliases; init ret
- fsl_c40_flash.c: Initialize `ret` in FLASH_Erase() to `kStatus_FLASH_Success` to avoid potential use-before-set warnings on some toolchains/static analyzers (no functional change). - S32K344_features.h: Define C40 array geometry for S32K344 using unsigned constants: * FSL_FEATURE_FLASH_C40_BLOCK_SIZE_CODE (1 MiB) * FSL_FEATURE_FLASH_C40_BLOCK_COUNT_CODE (4) * FSL_FEATURE_FLASH_C40_BLOCK_SIZE_DATA (256 KiB) Note: erase/program granularities are controller-level and handled by driver. - S32K344_glue_mcux.h: Provide conditional aliases mapping FLASH↔IP_FLASH and PFLASH↔IP_PFLASH to harmonize SDK naming and improve build portability. Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
1 parent 6adb4c5 commit 7c626ee

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

mcux/mcux-sdk-ng/drivers/flash_c40/fsl_c40_flash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ status_t FLASH_Erase(flash_config_t *config, uint32_t start, uint32_t lengthInBy
818818

819819
status_t FLASH_Program(flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes)
820820
{
821-
status_t ret;
821+
status_t ret = kStatus_FLASH_Success;
822822
size_t chunkSize;
823823
size_t sizeLeft = lengthInBytes;
824824
uint8_t *src8 = (uint8_t *) src;

s32/mcux/devices/S32K344/S32K344_features.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,4 +236,13 @@
236236
/* @brief Memory map has offset between subsystems. */
237237
#define FSL_FEATURE_MEMORY_HAS_ADDRESS_OFFSET (1)
238238

239+
/* FLASH Module features */
240+
241+
/* @brief Code flash (PFLASH) implemented as 1 MiB blocks */
242+
#define FSL_FEATURE_FLASH_C40_BLOCK_SIZE_CODE (1024u * 1024u)
243+
/* @brief Code flash (PFLASH) has 4 blocks of 1 MiB each total size = 4 MiB */
244+
#define FSL_FEATURE_FLASH_C40_BLOCK_COUNT_CODE (4u)
245+
/* @brief Data flash (DFLASH) window: 256 KiB */
246+
#define FSL_FEATURE_FLASH_C40_BLOCK_SIZE_DATA (256u * 1024u)
247+
239248
#endif /* _S32K344_FEATURES_H_ */

s32/mcux/devices/S32K344/S32K344_glue_mcux.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,4 +208,14 @@
208208
#define FLEXIO_BASE_PTRS IP_FLEXIO_BASE_PTRS
209209
/** Interrupt vectors for the FLEXIO peripheral type */
210210
#define FLEXIO_IRQS { FLEXIO_IRQn }
211+
212+
/* FLASH, PFLASH IP base addresses */
213+
#if !defined(FLASH) && defined(IP_FLASH)
214+
/* C40 Flash Memory Base Address */
215+
#define FLASH IP_FLASH
216+
#endif
217+
#if !defined(PFLASH) && defined(IP_PFLASH)
218+
/* Flash Memory Controller Base Address */
219+
#define PFLASH IP_PFLASH
220+
#endif
211221
#endif /* _S32K344_GLUE_MCUX_H_ */

0 commit comments

Comments
 (0)