1 /*
2  * Copyright (c) 2006-2023, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author         Notes
8  * 2023-03-27     luobeihai    first version
9  */
10 
11 #ifndef __BOARD_H__
12 #define __BOARD_H__
13 
14 #include <rtthread.h>
15 #include <apm32s10x.h>
16 
17 #include "apm32s10x_gpio.h"
18 #include "apm32s10x_rcm.h"
19 #include "apm32s10x_misc.h"
20 #include "apm32s10x_rcm.h"
21 #include "apm32s10x_eint.h"
22 #include "apm32s10x_usart.h"
23 #include "apm32s10x_dma.h"
24 
25 #if defined(RT_USING_ADC)
26     #include "apm32s10x_adc.h"
27 #endif
28 #if defined(RT_USING_DAC)
29     #include "apm32s10x_dac.h"
30 #endif
31 #if defined(RT_USING_RTC)
32     #include "apm32s10x_rtc.h"
33     #include "apm32s10x_pmu.h"
34 #endif
35 #if defined(RT_USING_SPI)
36     #include "apm32s10x_spi.h"
37 #endif
38 #if defined(RT_USING_HWTIMER) || defined(RT_USING_PWM)
39     #include "apm32s10x_tmr.h"
40 #endif
41 #if defined(RT_USING_WDT)
42     #include "apm32s10x_iwdt.h"
43     #include "apm32s10x_wwdt.h"
44 #endif
45 #if defined(BSP_USING_ON_CHIP_FLASH)
46     #include "apm32s10x_fmc.h"
47 #endif
48 #if defined(RT_USING_CAN)
49     #include "apm32s10x_can.h"
50 #endif
51 
52 #include "drv_common.h"
53 #include "drv_gpio.h"
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 #define APM32_FLASH_START_ADRESS     ((uint32_t)0x08000000)
60 #define APM32_FLASH_SIZE             (128 * 1024)
61 #define APM32_FLASH_END_ADDRESS      ((uint32_t)(APM32_FLASH_START_ADRESS + APM32_FLASH_SIZE))
62 
63 /* Internal SRAM memory size[Kbytes] <6-128>, Default: 128 */
64 #define APM32_SRAM_SIZE      36
65 #define APM32_SRAM_END       (0x20000000 + APM32_SRAM_SIZE * 1024)
66 
67 #if defined(__ARMCC_VERSION)
68 extern int Image$$RW_IRAM1$$ZI$$Limit;
69 #define HEAP_BEGIN      ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
70 #elif __ICCARM__
71 #pragma section="CSTACK"
72 #define HEAP_BEGIN      (__segment_end("CSTACK"))
73 #else
74 extern int __bss_end;
75 #define HEAP_BEGIN      ((void *)&__bss_end)
76 #endif
77 
78 #define HEAP_END        APM32_SRAM_END
79 
80 void SystemClock_Config(void);
81 
82 void apm32_usart_init(void);
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif /* __BOARD_H__ */
89