ef_cfg.h 4.0 KB

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