mem_layout.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef MEMORY_LAYOUT_H__
  7. #define MEMORY_LAYOUT_H__
  8. #include "../rtconfig.h"
  9. /*
  10. * Physical Memory layout:
  11. *
  12. * +---------+ <- CONFIG_MEM_TOTAL_SIZE
  13. * | ...... | maybe zero
  14. * +---------+ <- CONFIG_MEM_MMZ_BASE + CONFIG_MEM_MMZ_SIZE
  15. * | |
  16. * | |
  17. * | |
  18. * | |
  19. * | |
  20. * | |
  21. * | |
  22. * | |
  23. * |---------| <- CONFIG_MEM_MMZ_BASE
  24. * | ...... | maybe zero
  25. * +---------+ <- CONFIG_MEM_RTSMART_SIZE
  26. * | guard | MEM_GUARD_SIZE
  27. * +---------+ <- End of Kerenl
  28. * | |
  29. * | |
  30. * +---------+
  31. * | heap | CONFIG_MEM_RTSMART_HEAP_SIZE
  32. * +---------+
  33. * | |
  34. * +---------+ <- Beginning of Kernel <- mapping to KERNEL_VADDR_START + MEM_OPENSBI_SIZE
  35. * | opensbi | MEM_OPENSBI_SIZE
  36. * +---------+ <- Beginning of Physical Memory (0) <- mapping to KERNEL_VADDR_START
  37. */
  38. #define MEM_OPENSBI_SIZE 0x20000 // 128K
  39. #define MEM_GUARD_SIZE 0x1000 // 4K
  40. /*
  41. * The value of CONFIG_XXX may come from rtconfig.h. This is mainly for
  42. * compatibility with compiling RT-Thread in the SDK environment and using
  43. * the SDK configuration.
  44. *
  45. * If CONFIG_XXX is defined, it means that the value comes from the SDK
  46. * configuration, otherwise the default configuration of bsp/k230 in RT-Thead
  47. * is used. The default configuration of bsp/k230 is for the 01Studio CanMV
  48. * development board that supports 512MB of memory.
  49. */
  50. #ifndef CONFIG_MEM_TOTAL_SIZE
  51. #define CONFIG_MEM_TOTAL_SIZE 0x20000000 // 512M
  52. #endif
  53. #ifndef CONFIG_MEM_RTSMART_SIZE
  54. #define CONFIG_MEM_RTSMART_SIZE 0x10000000 // 256M
  55. #endif
  56. #ifndef CONFIG_MEM_RTSMART_HEAP_SIZE
  57. #define CONFIG_MEM_RTSMART_HEAP_SIZE 0x2000000 // 32M
  58. #endif
  59. #ifndef CONFIG_MEM_MMZ_BASE
  60. #define CONFIG_MEM_MMZ_BASE 0x10000000 // 512M
  61. #endif
  62. #ifndef CONFIG_MEM_MMZ_SIZE
  63. #define CONFIG_MEM_MMZ_SIZE 0x10000000 // 256M
  64. #endif
  65. #define MEM_KERNEL_SIZE (CONFIG_MEM_RTSMART_SIZE - MEM_OPENSBI_SIZE - MEM_GUARD_SIZE)
  66. #endif // MEMORY_LAYOUT_H__