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  * 2022-12-28     luobeihai    first version
9  */
10 
11 #ifndef __BOARD_H__
12 #define __BOARD_H__
13 
14 #include <rtthread.h>
15 #include <apm32f10x.h>
16 
17 #include "apm32f10x_gpio.h"
18 #include "apm32f10x_rcm.h"
19 #include "apm32f10x_misc.h"
20 #include "apm32f10x_rcm.h"
21 #include "apm32f10x_eint.h"
22 #include "apm32f10x_usart.h"
23 
24 #if defined(RT_USING_ADC)
25     #include "apm32f10x_adc.h"
26 #endif
27 #if defined(RT_USING_DAC)
28     #include "apm32f10x_dac.h"
29 #endif
30 #if defined(RT_USING_RTC)
31     #include "apm32f10x_rtc.h"
32     #include "apm32f10x_pmu.h"
33 #endif
34 #if defined(RT_USING_SPI)
35     #include "apm32f10x_spi.h"
36 #endif
37 #if defined(RT_USING_HWTIMER) || defined(RT_USING_PWM)
38     #include "apm32f10x_tmr.h"
39 #endif
40 #if defined(RT_USING_WDT)
41     #include "apm32f10x_iwdt.h"
42     #include "apm32f10x_wwdt.h"
43 #endif
44 #if defined(BSP_USING_ETH)
45     #include "apm32f10x_eth.h"
46 #endif
47 #if defined(BSP_USING_ON_CHIP_FLASH)
48     #include "apm32f10x_fmc.h"
49 #endif
50 #if defined(RT_USING_CAN)
51     #include "apm32f10x_can.h"
52 #endif
53 
54 #include "drv_common.h"
55 #include "drv_gpio.h"
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 #define APM32_FLASH_START_ADRESS     ((uint32_t)0x08000000)
62 #define APM32_FLASH_SIZE             (256 * 1024)
63 #define APM32_FLASH_END_ADDRESS      ((uint32_t)(APM32_FLASH_START_ADRESS + APM32_FLASH_SIZE))
64 
65 /* Internal SRAM memory size[Kbytes] <6-128>, Default: 64 */
66 #define APM32_SRAM_SIZE      64
67 #define APM32_SRAM_END       (0x20000000 + APM32_SRAM_SIZE * 1024)
68 
69 #if defined(__ARMCC_VERSION)
70 extern int Image$$RW_IRAM1$$ZI$$Limit;
71 #define HEAP_BEGIN      ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
72 #elif __ICCARM__
73 #pragma section="CSTACK"
74 #define HEAP_BEGIN      (__segment_end("CSTACK"))
75 #else
76 extern int __bss_end;
77 #define HEAP_BEGIN      ((void *)&__bss_end)
78 #endif
79 
80 #define HEAP_END        APM32_SRAM_END
81 
82 void SystemClock_Config(void);
83 
84 void apm32_usart_init(void);
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif /* __BOARD_H__ */
91