1import os
2import rtconfig
3from building import *
4
5Import('SDK_LIB')
6
7cwd = GetCurrentDir()
8
9# add general drivers
10src = Split('''
11board.c
12''')
13
14if GetDepend(['BSP_USING_SPI_FLASH']):
15    src += Glob('ports/spi_flash_init.c')
16
17if GetDepend(['BSP_USING_SDCARD']):
18    src += Glob('ports/sdcard_port.c')
19
20if GetDepend(['BSP_USING_SDRAM']):
21    src += Glob('ports/drv_sdram.c')
22
23path =  [cwd]
24path += [cwd + '/ports']
25
26startup_path_prefix = SDK_LIB
27
28if rtconfig.PLATFORM in ['armcc', 'armclang']:
29    src += [startup_path_prefix + '/APM32E10x_Library/Device/Geehy/APM32E10x/Source/arm/startup_apm32e10x_hd.s']
30
31if rtconfig.PLATFORM in ['iccarm']:
32    src += [startup_path_prefix + '/APM32E10x_Library/Device/Geehy/APM32E10x/Source/iar/startup_apm32e10x_hd.s']
33
34if rtconfig.PLATFORM in ['gcc']:
35    src += [startup_path_prefix + '/APM32E10x_Library/Device/Geehy/APM32E10x/Source/gcc/startup_apm32e10x_hd.S']
36
37# You can select chips from the list above
38CPPDEFINES = ['APM32E10X_HD']
39group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
40Return('group')
41