import rtconfig
from building import *

# get current directory
cwd = GetCurrentDir()

# The set of source files associated with this SConscript file.

src = Glob('STM32F10x_StdPeriph_Driver/src/*.c')
src += [cwd + '/CMSIS/ST/STM32F10x/system_stm32f10x.c']

#add for startup script
if rtconfig.CROSS_TOOL == 'gcc':
    src += [cwd + '/CMSIS/ST/STM32F10x/startup/TrueSTUDIO/startup_stm32f107xc.s']
elif rtconfig.CROSS_TOOL == 'keil':
    src += [cwd + '/CMSIS/ST/STM32F10x/startup/arm/startup_stm32f10x_cl.s']
elif rtconfig.CROSS_TOOL == 'iar':
    src += [cwd + '/CMSIS/ST/STM32F10x/startup/iar/startup_stm32f10x_cl.s']

path = [
    cwd + '/CMSIS/ST/STM32F10x',
    cwd + '/CMSIS',
    cwd + '/STM32F10x_StdPeriph_Driver/inc',]
    

CPPDEFINES = ['USE_STDPERIPH_DRIVER', 'STM32F10X_CL']

group = DefineGroup('STM32_Lib', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)

Return('group')
