board.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * File : board.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2009, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2009-09-22 Bernard add board.h to this bsp
  13. */
  14. // <<< Use Configuration Wizard in Context Menu >>>
  15. #ifndef __BOARD_H__
  16. #define __BOARD_H__
  17. #include <gd32f4xx.h>
  18. // <o>Begin Address of External SDRAM
  19. // <i>Default: 0xD0000000
  20. #define EXT_SDRAM_BEGIN SDRAM_BANK_ADDR /* the begining address of external SDRAM */
  21. // <o>End Address of External SRAM
  22. // <i>Default: 0xD0800000
  23. #define EXT_SDRAM_END (SDRAM_BANK_ADDR + W9825G6KH_SIZE) /* the end address of external SDRAM */
  24. // <o> Internal SRAM memory size[Kbytes] <8-64>
  25. // <i>Default: 64
  26. #ifdef __ICCARM__
  27. // Use *.icf ram symbal, to avoid hardcode.
  28. extern char __ICFEDIT_region_RAM_end__;
  29. #define GD32_SRAM_END &__ICFEDIT_region_RAM_end__
  30. #else
  31. #define GD32_SRAM_SIZE 128
  32. #define GD32_SRAM_END (0x20000000 + GD32_SRAM_SIZE * 1024)
  33. #endif
  34. #ifdef __CC_ARM
  35. extern int Image$$RW_IRAM1$$ZI$$Limit;
  36. #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit)
  37. #elif __ICCARM__
  38. #pragma section="HEAP"
  39. #define HEAP_BEGIN (__segment_end("HEAP"))
  40. #else
  41. extern int __bss_end;
  42. #define HEAP_BEGIN (&__bss_end)
  43. #endif
  44. #define HEAP_END GD32_SRAM_END
  45. // <o> Console on USART:
  46. // <127=> no console
  47. // <0=>USART 0 <1=>USART 1 <2=>USART 2 <3=> USART 3
  48. // <4=>USART 4 <5=>USART 5 <6=>USART 6 <7=> USART 7
  49. // <i>Default: 1
  50. #define GD32_CONSOLE_USART 0
  51. void rt_hw_board_init(void);
  52. #if GD32_CONSOLE_USART == 127
  53. #define CONSOLE_DEVICE "no"
  54. #elif GD32_CONSOLE_USART == 0
  55. #define CONSOLE_DEVICE "uart0"
  56. #elif GD32_CONSOLE_USART == 1
  57. #define CONSOLE_DEVICE "uart1"
  58. #elif GD32_CONSOLE_USART == 2
  59. #define CONSOLE_DEVICE "uart2"
  60. #elif GD32_CONSOLE_USART == 3
  61. #define CONSOLE_DEVICE "uart3"
  62. #elif GD32_CONSOLE_USART == 4
  63. #define CONSOLE_DEVICE "uart4"
  64. #elif GD32_CONSOLE_USART == 5
  65. #define CONSOLE_DEVICE "uart5"
  66. #elif GD32_CONSOLE_USART == 6
  67. #define CONSOLE_DEVICE "uart6"
  68. #elif GD32_CONSOLE_USART == 7
  69. #define CONSOLE_DEVICE "uart7"
  70. #endif
  71. #define FINSH_DEVICE_NAME CONSOLE_DEVICE
  72. void Error_Handler(void);
  73. #endif
  74. //*** <<< end of configuration section >>> ***