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  * 2022-03-28     Abbcc          first version
9  */
10 
11 #ifndef __BOARD_H__
12 #define __BOARD_H__
13 
14 #include <rtthread.h>
15 #include <apm32f4xx.h>
16 
17 #include "apm32f4xx_gpio.h"
18 #include "apm32f4xx_syscfg.h"
19 #include "apm32f4xx_rcm.h"
20 #include "apm32f4xx_misc.h"
21 #include "apm32f4xx_rcm.h"
22 #include "apm32f4xx_eint.h"
23 #include "apm32f4xx_usart.h"
24 
25 #if defined(RT_USING_ADC)
26     #include "apm32f4xx_adc.h"
27 #endif
28 #if defined(RT_USING_DAC)
29     #include "apm32f4xx_dac.h"
30 #endif
31 #if defined(RT_USING_RTC)
32     #include "apm32f4xx_rtc.h"
33     #include "apm32f4xx_pmu.h"
34 #endif
35 #if defined(RT_USING_SPI)
36     #include "apm32f4xx_spi.h"
37 #endif
38 #if defined(RT_USING_HWTIMER) || defined(RT_USING_PWM)
39     #include "apm32f4xx_tmr.h"
40 #endif
41 #if defined(RT_USING_WDT)
42     #include "apm32f4xx_iwdt.h"
43     #include "apm32f4xx_wwdt.h"
44 #endif
45 #if defined(RT_USING_CAN)
46     #include "apm32f4xx_can.h"
47 #endif
48 
49 #include "drv_common.h"
50 #include "drv_gpio.h"
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 #define APM32_FLASH_START_ADRESS     ((uint32_t)0x08000000)
57 #define APM32_FLASH_SIZE             (1024 * 1024)
58 #define APM32_FLASH_END_ADDRESS      ((uint32_t)(APM32_FLASH_START_ADRESS + APM32_FLASH_SIZE))
59 
60 /* Internal SRAM memory size[Kbytes] <6-128>, Default: 128 */
61 #define APM32_SRAM_SIZE      128
62 #define APM32_SRAM_END       (0x20000000 + APM32_SRAM_SIZE * 1024)
63 
64 #if defined(__ARMCC_VERSION)
65 extern int Image$$RW_IRAM1$$ZI$$Limit;
66 #define HEAP_BEGIN      ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
67 #elif __ICCARM__
68 #pragma section="CSTACK"
69 #define HEAP_BEGIN      (__segment_end("CSTACK"))
70 #else
71 extern int __bss_end;
72 #define HEAP_BEGIN      ((void *)&__bss_end)
73 #endif
74 
75 #define HEAP_END        APM32_SRAM_END
76 
77 void SystemClock_Config(void);
78 
79 void apm32_usart_init(void);
80 
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #endif /* __BOARD_H__ */
86