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