board.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (c) 2020-2022, CQ 100ask Development Team
  3. *
  4. * Change Logs:
  5. * Date Author Notes
  6. * 2022-05-29 Alen first version
  7. */
  8. #ifndef __BOARD_H__
  9. #define __BOARD_H__
  10. #include <rtthread.h>
  11. #include "drv_common.h"
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #define MM32_FLASH_START_ADRESS ((uint32_t)0x08000000)
  16. #define MM32_FLASH_SIZE (512 * 1024)
  17. #define MM32_FLASH_END_ADDRESS ((uint32_t)(MM32_FLASH_START_ADRESS + MM32_FLASH_SIZE))
  18. /* Internal SRAM memory size[Kbytes] <8-128>, Default: 128*/
  19. #define MM32_SRAM_SIZE 128
  20. #define MM32_SRAM_END (0x20000000 + MM32_SRAM_SIZE * 1024)
  21. #if defined(__ARMCC_VERSION)
  22. extern int Image$$RW_IRAM1$$ZI$$Limit;
  23. #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
  24. #elif __ICCARM__
  25. #pragma section="CSTACK"
  26. #define HEAP_BEGIN (__segment_end("CSTACK"))
  27. #else
  28. extern int __bss_end;
  29. #define HEAP_BEGIN ((void *)&__bss_end)
  30. #endif
  31. #define HEAP_END MM32_SRAM_END
  32. #define LSI_VALUE (40000)
  33. #define HSI_VALUE (8000000)
  34. #define HSE_VALUE (12000000)
  35. #define __USE_HSE (0)
  36. #define __USE_HSE_PLL (1)
  37. #define __USE_HSI_PLL (0)
  38. #define RCC_CFGR_SWS_Pos (2U)
  39. #define RCC_CFGR_SWS_Msk (0x3UL << RCC_CFGR_SWS_Pos) /*!< 0x0000000C */
  40. #define RCC_CFGR_SWS_HSI 0x00000000U /*!< HSI oscillator used as system clock */
  41. #define RCC_CFGR_SWS_HSE 0x00000004U /*!< HSE oscillator used as system clock */
  42. #define RCC_CFGR_SWS_PLL 0x00000008U /*!< PLL used as system clock */
  43. #define RCC_CFGR_SWS_LSI 0x0000000CU /*!< LSI used as system clock */
  44. #define RCC_SYSCLKSOURCE_STATUS_HSI RCC_CFGR_SWS_HSI /*!< HSI used as system clock */
  45. #define RCC_SYSCLKSOURCE_STATUS_HSE RCC_CFGR_SWS_HSE /*!< HSE used as system clock */
  46. #define RCC_SYSCLKSOURCE_STATUS_PLLCLK RCC_CFGR_SWS_PLL /*!< PLL used as system clock */
  47. #define RCC_SYSCLKSOURCE_STATUS_LSI RCC_CFGR_SWS_LSI /*!< LSI used as system clock */
  48. uint32_t HAL_GetSysClockFreq(void);
  49. uint32_t HAL_Get_AHB_Clock(void);
  50. uint32_t HAL_Get_APB1_Clock(void);
  51. uint32_t HAL_Get_APB2_Clock(void);
  52. void SystemClock_Config(void);
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif /* __BOARD_H__ */