ef_cfg.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * This file is part of the EasyFlash Library.
  3. *
  4. * Copyright (c) 2015-2019, Armink, <armink.ztl@gmail.com>
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining
  7. * a copy of this software and associated documentation files (the
  8. * 'Software'), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish,
  10. * distribute, sublicense, and/or sell copies of the Software, and to
  11. * permit persons to whom the Software is furnished to do so, subject to
  12. * the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be
  15. * included in all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  18. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  20. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  21. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  22. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  23. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. *
  25. * Function: It is the configure head file for this library.
  26. * Created on: 2015-07-14
  27. */
  28. #ifndef EF_CFG_H_
  29. #define EF_CFG_H_
  30. #include <board.h>
  31. /* using ENV function */
  32. #ifdef EASYFLASH_ENV
  33. #define EF_USING_ENV
  34. #ifdef EASYFLASH_ENV_AUTO_UPDATE
  35. /* Auto update ENV to latest default when current ENV version number is changed. */
  36. #define EF_ENV_AUTO_UPDATE
  37. /**
  38. * ENV version number defined by user.
  39. * Please change it when your firmware add a new ENV to default_env_set.
  40. */
  41. #define EF_ENV_VER_NUM EASYFLASH_ENV_VER_NUM
  42. #endif
  43. #endif /* EASYFLASH_ENV */
  44. /* using IAP function */
  45. #ifdef EASYFLASH_IAP
  46. #define EF_USING_IAP
  47. #endif
  48. /* using save log function */
  49. #ifdef EASYFLASH_LOG
  50. #define EF_USING_LOG
  51. /* saved log area size */
  52. #define LOG_AREA_SIZE (EASYFLASH_LOG_AREA_SIZE)
  53. #endif
  54. /* the minimum size of flash erasure */
  55. #define EF_ERASE_MIN_SIZE EASYFLASH_ERASE_GRAN
  56. /* the flash write granularity, unit: bit
  57. * only support 1(nor flash)/ 8(stm32f4)/ 32(stm32f1)/ 64(stm32l4) */
  58. #define EF_WRITE_GRAN (EASYFLASH_WRITE_GRAN)
  59. /*
  60. *
  61. * This all Backup Area Flash storage index. All used flash area configure is under here.
  62. * |----------------------------| Storage Size
  63. * | Environment variables area | ENV area size @see ENV_AREA_SIZE
  64. * |----------------------------|
  65. * | Saved log area | Log area size @see LOG_AREA_SIZE
  66. * |----------------------------|
  67. * |(IAP)Downloaded application | IAP already downloaded application, unfixed size
  68. * |----------------------------|
  69. *
  70. * @note all area sizes must be aligned with EF_ERASE_MIN_SIZE
  71. *
  72. * The EasyFlash add the NG (Next Generation) mode start from V4.0. All old mode before V4.0, called LEGACY mode.
  73. *
  74. * - NG (Next Generation) mode is default mode from V4.0. It's easy to settings, only defined the ENV_AREA_SIZE.
  75. * - The LEGACY mode has been DEPRECATED. It is NOT RECOMMENDED to continue using.
  76. * Beacuse it will use ram to buffer the ENV and spend more flash erase times.
  77. * If you want use it please using the V3.X version.
  78. */
  79. /* backup area start address */
  80. #define EF_START_ADDR EASYFLASH_START_ADDR
  81. /* ENV area size. It's at least one empty sector for GC. So it's definition must more then or equal 2 flash sector size. */
  82. #define ENV_AREA_SIZE (EF_ERASE_MIN_SIZE * 2) /* default is the double erase min size */
  83. /* print debug information of flash */
  84. #ifdef EASYFLASH_DEBUG
  85. #define PRINT_DEBUG
  86. #endif
  87. #endif /* EF_CFG_H_ */