|
| 1 | +/* |
| 2 | + * Copyright 2022-2023 NXP |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: BSD-3-Clause |
| 5 | + */ |
| 6 | + |
| 7 | +#ifndef _FWK_CONFIG_H_ |
| 8 | +#define _FWK_CONFIG_H_ |
| 9 | + |
| 10 | +#include "fwk_platform_definitions.h" |
| 11 | + |
| 12 | +/********************************************************************* |
| 13 | + * General |
| 14 | + *********************************************************************/ |
| 15 | + |
| 16 | +/* Defines the calibration duration of the ADC, it will block the task during this time in milisec before trigger the |
| 17 | + * ADC on a channel*/ |
| 18 | +#define gSensorsAdcCalibrationDurationInMs_c 4U |
| 19 | + |
| 20 | +/* |
| 21 | + * KW45/K32W148 CM33 core has the DSP extension (__DSP_PRESENT), which allows the use of the NXP UltraFast EC P256 |
| 22 | + * library The flags may be set to 0 if this library is not required. It mainly makes sense for Matter SPAKE2P |
| 23 | + * procedures and for BLE point validation. |
| 24 | + */ |
| 25 | +#define gSecLibUseDspExtension_d 1 |
| 26 | + |
| 27 | +/********************************************************************* |
| 28 | + * HW parameters enablement and placement |
| 29 | + *********************************************************************/ |
| 30 | + |
| 31 | +#if !defined(gPlatformUseHwParameter_d) |
| 32 | +#define gPlatformUseHwParameter_d 1 |
| 33 | +#endif |
| 34 | +/* |
| 35 | + * gHwParamsProdDataMainFlashMode_c HWParameters PROD_DATA remain at top of main flash, |
| 36 | + * where the linker script defines PROD_DATA_BASE_ADDR. |
| 37 | + * When transiting from MainFlashMode to IfrMode, an interim mode MainFlash2IfrMode is used to |
| 38 | + * enable the transfer of HWParameters from the main flash to the IFR. |
| 39 | + * After this has been applied the size of the PROD_DATA reserved space in the linker script |
| 40 | + * will be made 0 in order to gain a sector. |
| 41 | + * These modes are used to configure gHwParamsProdDataPlacement_c |
| 42 | + */ |
| 43 | +#define gHwParamsProdDataMainFlashMode_c 0 |
| 44 | +#define gHwParamsProdDataMainFlash2IfrMode_c 1 |
| 45 | +#define gHwParamsProdDataIfrMode_c 2 |
| 46 | + |
| 47 | +/* |
| 48 | + * Place Application FactoryData in same sector as ProdData. |
| 49 | + * HWParameters and App Factory Data being colocated has an implication on the life cycle of information stored in the |
| 50 | + * sector. |
| 51 | + */ |
| 52 | +#ifndef gHwParamsAppFactoryDataExtension_d |
| 53 | +#define gHwParamsAppFactoryDataExtension_d 0 |
| 54 | +#endif |
| 55 | + |
| 56 | +/* |
| 57 | + * To be defined as 1 if NV_WriteHWParameters is liable to be invoked after Application Factory Data were written, |
| 58 | + * and you intend not to have to preprogram them. Default to 0, assuming that this can happne in the context of |
| 59 | + * a factory reset. Not needed if gHwParamsAppFactoryDataExtension_d is not set. |
| 60 | + */ |
| 61 | +#if (gHwParamsAppFactoryDataExtension_d != 0) |
| 62 | +#ifndef gHwParamsAppFactoryDataPreserveOnHwParamUpdate_d |
| 63 | +#define gHwParamsAppFactoryDataPreserveOnHwParamUpdate_d 0 |
| 64 | +#endif |
| 65 | +#else |
| 66 | +#define gHwParamsAppFactoryDataPreserveOnHwParamUpdate_d 0 |
| 67 | +#endif |
| 68 | +/* |
| 69 | + * Define gHwParamsProdDataPlacement_c as : |
| 70 | + * - gHwParamsProdDataMainFlash_c if you mean to remain backward compatible. |
| 71 | + * - gHwParamsProdDataMainFlash2IfrMode_c if you wish to conserve previous |
| 72 | + * HWParameter setting (MAC addresses, xtal trimming data) during migration phase. |
| 73 | + * - gHwParamsProdDataPlacementIfrMode_c for new devices or once gHwParamsProdDataMainFlash2IfrMode_c |
| 74 | + * mode has populated the IFR with legacy values. -> after this phase update linker script to remove |
| 75 | + * flash space reserved for PROD_DATA. |
| 76 | + */ |
| 77 | +#ifndef gHwParamsProdDataPlacement_c |
| 78 | +#define gHwParamsProdDataPlacement_c gHwParamsProdDataMainFlashMode_c |
| 79 | +//#define gHwParamsProdDataPlacement_c gHwParamsProdDataMainFlash2IfrMode_c |
| 80 | +//#define gHwParamsProdDataPlacement_c gHwParamsProdDataIfrMode_c |
| 81 | +#endif |
| 82 | + |
| 83 | +#if (gHwParamsProdDataPlacement_c == gHwParamsProdDataMainFlashMode_c) |
| 84 | +#define PROD_DATA_FLASH_ADDR (MAIN_FLASH_PROD_DATA_ADDR + PROD_DATA_OFFSET) |
| 85 | +#define USER_DATA_SECTOR PROD_DATA_FLASH_ADDR |
| 86 | +#else |
| 87 | +/* |
| 88 | + * IFR_RSVD_SZ may be undefined or set to 0 if no reserved space is required. |
| 89 | + * However keep it as 0x600 during the internal development phase. |
| 90 | + */ |
| 91 | +#define IFR_RSVD_SZ 0x600 |
| 92 | + |
| 93 | +#if (defined IFR_RSVD_SZ) && (IFR_RSVD_SZ > 0) |
| 94 | +#define PROD_DATA_FLASH_ADDR (IFR_USER_ADDR + IFR_RSVD_SZ + PROD_DATA_OFFSET) |
| 95 | +#else |
| 96 | +#define PROD_DATA_FLASH_ADDR (IFR_USER_ADDR + PROD_DATA_OFFSET) |
| 97 | +#endif |
| 98 | +#define USER_DATA_SECTOR PROD_DATA_FLASH_ADDR |
| 99 | +#endif |
| 100 | + |
| 101 | +#ifdef gHwParamsAppFactoryDataExtension_d |
| 102 | +#define APP_FACTORY_DATA_FLASH_ADDR (PROD_DATA_FLASH_ADDR + APP_FACTORY_DATA_OFFSET) |
| 103 | +#endif |
| 104 | + |
| 105 | +/********************************************************************* |
| 106 | + * Reset Method |
| 107 | + * Define the alternative method from warm reset to use for Device reset |
| 108 | + * when calling PLATFORM_ResetCpu() |
| 109 | + *********************************************************************/ |
| 110 | +#define gUseResetByNvicReset_c 1 |
| 111 | +#define gUseResetByLvdForce_c 2 |
| 112 | +#define gUseResetByDeepPowerDown_c 3 |
| 113 | + |
| 114 | +#if !defined(gPlatResetMethod_c) |
| 115 | +#if defined(FPGA_SUPPORT) && (FPGA_SUPPORT == 1) |
| 116 | +#define gPlatResetMethod_c gUseResetByNvicReset_c |
| 117 | +#else |
| 118 | +#define gPlatResetMethod_c gUseResetByDeepPowerDown_c |
| 119 | +#endif |
| 120 | +#endif |
| 121 | + |
| 122 | +/********************************************************************* |
| 123 | + * Flash check for ECC error after IFR OT_CFG programming. |
| 124 | + * |
| 125 | + * Defaults to 1 to avoid bus fault in case of error |
| 126 | + * Temporarily leave as 0 to before full OTA testing is done. |
| 127 | + *********************************************************************/ |
| 128 | +#ifndef gOtaCheckEccFaults_d |
| 129 | +#define gOtaCheckEccFaults_d 1 |
| 130 | +#endif |
| 131 | + |
| 132 | +/********************************************************************* |
| 133 | + * NVS Sector size is necessarily a multiple of physical flash sector size. |
| 134 | + * |
| 135 | + * Defaults to 1 because 8kB is already pretty large. cannot exceed 8 sectors. |
| 136 | + * |
| 137 | + *********************************************************************/ |
| 138 | +#ifndef gPlatNvsSectorSize_c |
| 139 | +#define gPlatNvsSectorSize_c (PLATFORM_INTFLASH_SECTOR_SIZE * 1u) |
| 140 | +#endif |
| 141 | + |
| 142 | +/********************************************************************* |
| 143 | + * RNG source of entropy |
| 144 | + *********************************************************************/ |
| 145 | + |
| 146 | +/* On connected_mcu platform the only source of entropy disponible is the S200 */ |
| 147 | +#ifndef gRngUseSecureSubSystem_d |
| 148 | +#define gRngUseSecureSubSystem_d 1 |
| 149 | +#endif |
| 150 | + |
| 151 | +#if defined(gRngUseSecureSubSystem_d) && (gRngUseSecureSubSystem_d == 0) |
| 152 | +#warning \ |
| 153 | + "On connected_mcu the only source of entropy is the S200, RNG will not be properly initialized if this flag is not enabled" |
| 154 | +#endif |
| 155 | + |
| 156 | +#endif /* _FWK_CONFIG_H_ */ |
0 commit comments