fal_cfg.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2018-12-5 SummerGift first version
  9. */
  10. #ifndef _FAL_CFG_H_
  11. #define _FAL_CFG_H_
  12. #include <rtthread.h>
  13. #include <board.h>
  14. #ifdef BSP_USING_SPI_FLASH_LITTLEFS
  15. extern struct fal_flash_dev w25q128;
  16. #else
  17. #define FLASH_SIZE_GRANULARITY_16K (4 * 16 * 1024)
  18. #define FLASH_SIZE_GRANULARITY_64K (64 * 1024)
  19. #define FLASH_SIZE_GRANULARITY_128K (7 * 128 * 1024)
  20. #define STM32_FLASH_START_ADRESS_16K STM32_FLASH_START_ADRESS
  21. #define STM32_FLASH_START_ADRESS_64K (STM32_FLASH_START_ADRESS_16K + FLASH_SIZE_GRANULARITY_16K)
  22. #define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_64K + FLASH_SIZE_GRANULARITY_64K)
  23. extern const struct fal_flash_dev stm32_onchip_flash_16k;
  24. extern const struct fal_flash_dev stm32_onchip_flash_64k;
  25. extern const struct fal_flash_dev stm32_onchip_flash_128k;
  26. #endif
  27. /* flash device table */
  28. #ifdef BSP_USING_SPI_FLASH_LITTLEFS
  29. #define FAL_FLASH_DEV_TABLE \
  30. { \
  31. &w25q128, \
  32. }
  33. #else
  34. #define FAL_FLASH_DEV_TABLE \
  35. { \
  36. &stm32_onchip_flash_16k, \
  37. &stm32_onchip_flash_64k, \
  38. &stm32_onchip_flash_128k, \
  39. }
  40. #endif
  41. /* ====================== Partition Configuration ========================== */
  42. #ifdef FAL_PART_HAS_TABLE_CFG
  43. /* partition table */
  44. #ifdef BSP_USING_SPI_FLASH_LITTLEFS
  45. #define FAL_PART_TABLE \
  46. { \
  47. {FAL_PART_MAGIC_WROD, "spiflash0", "W25Q128", 0 , 16 * 1024 * 1024, 0}, \
  48. }
  49. #else
  50. #define FAL_PART_TABLE \
  51. { \
  52. {FAL_PART_MAGIC_WROD, "bootloader", "onchip_flash_16k", 0 , FLASH_SIZE_GRANULARITY_16K , 0}, \
  53. {FAL_PART_MAGIC_WROD, "param", "onchip_flash_64k", 0 , FLASH_SIZE_GRANULARITY_64K , 0}, \
  54. {FAL_PART_MAGIC_WROD, "app", "onchip_flash_128k", 0 , FLASH_SIZE_GRANULARITY_128K, 0}, \
  55. }
  56. #endif
  57. #endif /* FAL_PART_HAS_TABLE_CFG */
  58. #endif /* _FAL_CFG_H_ */