Alastor89

Untitled

Jun 10th, 2022
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.25 KB | None | 0 0
  1. /*******************************************************************************
  2. * Copyright 2019-2021 Microchip FPGA Embedded Systems Solutions.
  3. *
  4. * SPDX-License-Identifier: MIT
  5. *
  6. * MPFS HAL Embedded Software
  7. *
  8. */
  9.  
  10. /*******************************************************************************
  11. *
  12. * Platform definitions
  13. * Version based on requirements of MPFS MSS
  14. *
  15. */
  16. /*========================================================================*//**
  17. @mainpage Sample file detailing how mss_sw_config.h should be constructed for
  18. the MPFS MSS
  19.  
  20. @section intro_sec Introduction
  21. The mss_sw_config.h has the default software configuration settings for the
  22. MPFS HAL and will be located at
  23. <Project-Name>/src/platform/platform_config_reference folder of the bare
  24. metal SoftConsole project. The platform_config_reference is provided as a
  25. default reference configuration.
  26. When you want to configure the MPFS HAL with required configuration for
  27. your project, the mss_sw_config.h must be edited and be placed in the
  28. following project directory:
  29. <Project-Name>/src/boards/<your-board>/platform_config/mpfs_hal_config/
  30.  
  31. @section
  32.  
  33. *//*==========================================================================*/
  34.  
  35.  
  36. #ifndef MSS_SW_CONFIG_H_
  37. #define MSS_SW_CONFIG_H_
  38.  
  39. /*
  40. * MPFS_HAL_FIRST_HART and MPFS_HAL_LAST_HART defines are used to specify which
  41. * harts to actually start. The value and the actual hart it represents are
  42. * listed below:
  43. * value hart
  44. * 0 E51
  45. * 1 U54_1
  46. * 2 U54_2
  47. * 3 U54_3
  48. * 4 U54_4
  49. * Set MPFS_HAL_FIRST_HART to a value greater than 0 if you do not want your
  50. * application to start and execute code on the harts represented by smaller
  51. * value numbers.
  52. * Set MPFS_HAL_LAST_HART to a value smaller than 4 if you do not wish to use
  53. * all U54_x harts.
  54. * Harts that are not started will remain in an infinite WFI loop unless used
  55. * through some other method.
  56. * The value of MPFS_HAL_FIRST_HART must always be less than MPFS_HAL_LAST_HART.
  57. * The value of MPFS_HAL_LAST_HART must never be greater than 4.
  58. * A typical use-case where you set MPFS_HAL_FIRST_HART = 1 and
  59. * MPFS_HAL_LAST_HART = 1 is when
  60. * your application is running on U54_1 and a bootloader running on E51 loads
  61. * your application to the target memory and kicks-off U54_1 to run it.
  62. */
  63. #ifndef MPFS_HAL_FIRST_HART
  64. #define MPFS_HAL_FIRST_HART 0
  65. #endif
  66.  
  67. #ifndef MPFS_HAL_LAST_HART
  68. #define MPFS_HAL_LAST_HART 0
  69. #endif
  70.  
  71. /*
  72. * IMAGE_LOADED_BY_BOOTLOADER
  73. * We set IMAGE_LOADED_BY_BOOTLOADER = 0 if the application image runs from
  74. * non-volatile memory after reset. (No previous stage bootloader is used.)
  75. * Set IMAGE_LOADED_BY_BOOTLOADER = 1 if the application image is loaded by a
  76. * previous stage bootloader.
  77. *
  78. * MPFS_HAL_HW_CONFIG is defined if we are a boot-loader. This is a
  79. * conditional compile switch is used to determine if MPFS HAL will perform the
  80. * hardware configurations or not.
  81. * Defined => This program acts as a First stage bootloader and performs
  82. * hardware configurations.
  83. * Not defined => This program assumes that the hardware configurations are
  84. * already performed (Typically by a previous boot stage)
  85. *
  86. * List of items initialised when MPFS_HAL_HW_CONFIG is enabled
  87. * - load virtual rom (see load_virtual_rom(void) in system_startup.c)
  88. * - l2 cache config
  89. * - Bus error unit config
  90. * - MPU config
  91. * - pmp config
  92. * - I/O, clock and clock mux's, DDR and SGMII
  93. * - will start other harts, see text describing MPFS_HAL_FIRST_HART,
  94. * MPFS_HAL_LAST_HART above
  95. *
  96. */
  97.  
  98. #define IMAGE_LOADED_BY_BOOTLOADER 0
  99.  
  100. #if (IMAGE_LOADED_BY_BOOTLOADER == 0)
  101. #define MPFS_HAL_HW_CONFIG
  102. #endif
  103.  
  104.  
  105. /*
  106. * If you are using common memory for sharing across harts,
  107. * uncomment #define MPFS_HAL_SHARED_MEM_ENABLED
  108. * make sure common memory is allocated in the linker script
  109. * See app_hart_common mem section in the example platform
  110. * linker scripts.
  111. */
  112.  
  113. // #define MPFS_HAL_SHARED_MEM_ENABLED
  114.  
  115.  
  116. /* define the required tick rate in Milliseconds */
  117. /* if this program is running on one hart only, only that particular hart value
  118. * will be used */
  119. #define HART0_TICK_RATE_MS 5UL
  120. #define HART1_TICK_RATE_MS 5UL
  121. #define HART2_TICK_RATE_MS 5UL
  122. #define HART3_TICK_RATE_MS 5UL
  123. #define HART4_TICK_RATE_MS 5UL
  124.  
  125. /*
  126. * Define the size of the Hart Local Storage (HLS).
  127. * In the MPFS HAL, we are using HLS for debug data storage during the initial
  128. * boot phase.
  129. * This includes the flags which indicate the hart state regarding boot state.
  130. * The HLS will take memory from top of each stack allocated at boot time.
  131. *
  132. */
  133. #define HLS_DEBUG_AREA_SIZE 64
  134.  
  135. /*
  136. * Bus Error Unit (BEU) configurations
  137. * BEU_ENABLE => Configures the events that the BEU can report. bit value
  138. * 1= enabled, 0 = disabled.
  139. * BEU_PLIC_INT => Configures which accrued events should generate an
  140. * interrupt to the PLIC.
  141. * BEU_LOCAL_INT => Configures which accrued events should generate a
  142. * local interrupt to the hart on which the event accrued.
  143. */
  144. #define BEU_ENABLE 0x0ULL
  145. #define BEU_PLIC_INT 0x0ULL
  146. #define BEU_LOCAL_INT 0x0ULL
  147.  
  148. /*
  149. * Clear memory on startup
  150. * 0 => do not clear DTIM and L2
  151. * 1 => Clears memory
  152. * Note: If you are the zero stage bootloader, set this to one.
  153. */
  154. #ifndef MPFS_HAL_CLEAR_MEMORY
  155. #define MPFS_HAL_CLEAR_MEMORY 1
  156. #else
  157. #define MPFS_HAL_CLEAR_MEMORY 0
  158. #endif
  159.  
  160. /*
  161. * Comment out the lines to disable the corresponding hardware support not required
  162. * in your application.
  163. * This is not necessary from an operational point of view as operation dictated
  164. * by MSS configurator settings, and items are enabled/disabled by this method.
  165. * The reason you may want to use below is to save code space.
  166. */
  167. /* #define SGMII_SUPPORT */
  168. #define DDR_SUPPORT
  169. #define MSSIO_SUPPORT
  170.  
  171. /*
  172. * DDR software options
  173. */
  174.  
  175. /*
  176. * Debug DDR startup through a UART
  177. * Comment out in normal operation. May be useful for debug purposes in bring-up
  178. * of a new board design.
  179. * See the weakly linked function setup_ddr_debug_port(mss_uart_instance_t * uart)
  180. * If you need to edit this function, make another copy of the function in your
  181. * application without the weak linking attribute. This copy will then get linked.
  182. * */
  183. #define DEBUG_DDR_INIT
  184. #define DEBUG_DDR_RD_RW_FAIL
  185. //#define DEBUG_DDR_RD_RW_PASS
  186. //#define DEBUG_DDR_CFG_DDR_SGMII_PHY
  187. //#define DEBUG_DDR_DDRCFG
  188.  
  189. /*
  190. * Perform a test of 64 bit and 32 bit access of the DDR at startup
  191. * for the whole length of the memory. Disable it for now as boot
  192. * hangs due to long time needed to perform the test.
  193. */
  194. #define TEST_64BIT_ACCESS 0
  195. #define TEST_32BIT_ACCESS 0
  196.  
  197. /*
  198. * The hardware configuration settings imported from Libero project get generated
  199. * into <project_name>/src/boards/<your-board>/<fpga-design-config> folder.
  200. * If you need to overwrite them for testing purposes, you can do so here.
  201. * e.g. If you want change the default SEG registers configuration defined by
  202. * LIBERO_SETTING_SEG0_0, define it here and it will take precedence.
  203. * #define LIBERO_SETTING_SEG0_0 0x80007F80UL
  204. *
  205. */
  206.  
  207. #endif /* USER_CONFIG_MSS_USER_CONFIG_H_ */
  208.  
Advertisement
Add Comment
Please, Sign In to add comment