ef_cfg.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 "../act_log_flash_buffer.h"
  31. /* using ENV function, default is NG (Next Generation) mode start from V4.0 */
  32. //#define EF_USING_ENV
  33. #ifdef EF_USING_ENV
  34. /* Auto update ENV to latest default when current ENV version number is changed. */
  35. /* #define EF_ENV_AUTO_UPDATE */
  36. /**
  37. * ENV version number defined by user.
  38. * Please change it when your firmware add a new ENV to default_env_set.
  39. */
  40. #define EF_ENV_VER_NUM /* @note you must define it for a value, such as 0 */
  41. /* MCU Endian Configuration, default is Little Endian Order. */
  42. /* #define EF_BIG_ENDIAN */
  43. #endif /* EF_USING_ENV */
  44. /* using IAP function */
  45. /* #define EF_USING_IAP */
  46. /* using save log function */
  47. #define EF_USING_LOG
  48. /* The minimum size of flash erasure. May be a flash sector size. */
  49. #define EF_ERASE_MIN_SIZE (4 * 1024) /* @note you must define it for a value */
  50. /* the flash write granularity, unit: bit
  51. * only support 1(nor flash)/ 8(stm32f4)/ 32(stm32f1) */
  52. #define EF_WRITE_GRAN /* @note you must define it for a value */
  53. /*
  54. *
  55. * This all Backup Area Flash storage index. All used flash area configure is under here.
  56. * |----------------------------| Storage Size
  57. * | Environment variables area | ENV area size @see ENV_AREA_SIZE
  58. * |----------------------------|
  59. * | Saved log area | Log area size @see LOG_AREA_SIZE
  60. * |----------------------------|
  61. * |(IAP)Downloaded application | IAP already downloaded application, unfixed size
  62. * |----------------------------|
  63. *
  64. * @note all area sizes must be aligned with EF_ERASE_MIN_SIZE
  65. *
  66. * The EasyFlash add the NG (Next Generation) mode start from V4.0. All old mode before V4.0, called LEGACY mode.
  67. *
  68. * - NG (Next Generation) mode is default mode from V4.0. It's easy to settings, only defined the ENV_AREA_SIZE.
  69. * - The LEGACY mode has been DEPRECATED. It is NOT RECOMMENDED to continue using.
  70. * Beacuse it will use ram to buffer the ENV and spend more flash erase times.
  71. * If you want use it please using the V3.X version.
  72. */
  73. /* backup area start address */
  74. #define EF_START_ADDR (ctx->base_addr)/* @note you must define it for a value */
  75. /* 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. */
  76. #define ENV_AREA_SIZE 0 /* @note you must define it for a value if you used ENV */
  77. /* saved log area size */
  78. #define LOG_AREA_SIZE (ctx->total_size)/* @note you must define it for a value if you used log */
  79. /* print debug information of flash */
  80. //#define PRINT_DEBUG
  81. #endif /* EF_CFG_H_ */