fal_cfg.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. * 2020-05-05 supperthomas this is sample you can change by yourself
  9. *
  10. */
  11. #ifndef _FAL_CFG_H_
  12. #define _FAL_CFG_H_
  13. #include <rtconfig.h>
  14. #include <board.h>
  15. #if (defined(BSP_USING_QSPI_FLASH)&&defined(BSP_USING_ON_CHIP_FLASH))
  16. #define ON_CHIP_FLASH_DEV_NAME "mcu_onchip"
  17. #define NOR_FLASH_DEV_NAME "norflash0"
  18. extern const struct fal_flash_dev mcu_onchip_flash;
  19. extern struct fal_flash_dev nor_flash0;
  20. /* flash device table */
  21. #define FAL_FLASH_DEV_TABLE \
  22. { \
  23. &mcu_onchip_flash, \
  24. &nor_flash0, \
  25. }
  26. /* ====================== Partition Configuration ========================== */
  27. #ifdef FAL_PART_HAS_TABLE_CFG
  28. /* partition table */
  29. #define FAL_PART_TABLE \
  30. { \
  31. {FAL_PART_MAGIC_WORD, "bl", ON_CHIP_FLASH_DEV_NAME, 0, 64*1024, 0}, \
  32. {FAL_PART_MAGIC_WORD, "app_flash", ON_CHIP_FLASH_DEV_NAME, 64*1024, 960*1024, 0}, \
  33. {FAL_PART_MAGIC_WORD, "nor_flash_part_0", NOR_FLASH_DEV_NAME, 0, 1024*1024, 0}, \
  34. {FAL_PART_MAGIC_WORD, "nor_flash_part_1", NOR_FLASH_DEV_NAME, 1024*1024, 7*1024*1024, 0}, \
  35. }
  36. #endif /* FAL_PART_HAS_TABLE_CFG */
  37. #elif defined(BSP_USING_QSPI_FLASH)
  38. #define NOR_FLASH_DEV_NAME "norflash0"
  39. extern struct fal_flash_dev nor_flash0;
  40. /* flash device table */
  41. #define FAL_FLASH_DEV_TABLE \
  42. { \
  43. &nor_flash0, \
  44. }
  45. /* ====================== Partition Configuration ========================== */
  46. #ifdef FAL_PART_HAS_TABLE_CFG
  47. /* partition table */
  48. #define FAL_PART_TABLE \
  49. { \
  50. {FAL_PART_MAGIC_WORD, "nor_flash_part_0", NOR_FLASH_DEV_NAME, 0, 1024*1024, 0}, \
  51. {FAL_PART_MAGIC_WORD, "nor_flash_part_1", NOR_FLASH_DEV_NAME, 1024*1024, 7*1024*1024, 0}, \
  52. }
  53. #endif
  54. #elif defined(BSP_USING_ON_CHIP_FLASH)
  55. extern const struct fal_flash_dev mcu_onchip_flash;
  56. #define ON_CHIP_FLASH_DEV_NAME "mcu_onchip"
  57. /* flash device table */
  58. #define FAL_FLASH_DEV_TABLE \
  59. { \
  60. &mcu_onchip_flash, \
  61. }
  62. /* ====================== Partition Configuration ========================== */
  63. #ifdef FAL_PART_HAS_TABLE_CFG
  64. /* partition table */
  65. #define FAL_PART_TABLE \
  66. { \
  67. {FAL_PART_MAGIC_WORD, "bl", ON_CHIP_FLASH_DEV_NAME, 0, 64*1024, 0}, \
  68. {FAL_PART_MAGIC_WORD, "app_flash", ON_CHIP_FLASH_DEV_NAME, 64*1024, 960*1024, 0}, \
  69. }
  70. #endif
  71. #endif
  72. #endif /* _FAL_CFG_H_ */