[bsp][stm32] add scons --dist function

This commit is contained in:
SummerGift 2018-12-13 10:56:09 +08:00
parent dcf7bce2cc
commit 968110ffd6
26 changed files with 248 additions and 77 deletions

View File

@ -38,11 +38,19 @@ objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
SDK_ROOT = os.path.abspath('./')
bsp_vdir = 'build'
# include drivers
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/STM32F1xx_HAL/SConscript'))
if os.path.exists(SDK_ROOT + '/libraries'):
libraries_path_prefix = SDK_ROOT + '/libraries/'
else:
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries/'
stm32_library = 'STM32F1xx_HAL'
rtconfig.BSP_LIBRARY_TYPE = stm32_library
# include libraries
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/HAL_Drivers/SConscript'))
objs.extend(SConscript(libraries_path_prefix + stm32_library + '/SConscript'))
# include drivers
objs.extend(SConscript(libraries_path_prefix + '/HAL_Drivers/SConscript'))
# make a building
DoBuilding(TARGET, objs)

View File

@ -1,23 +1,28 @@
import os
import rtconfig
from building import *
cwd = GetCurrentDir()
# add the general drivers.
src = Glob('board.c')
# add general drivers
src = Glob('board.c')
src += Glob('CubeMX_Config/Src/stm32f1xx_hal_msp.c')
path = [cwd]
path = [cwd]
path += [cwd + '/CubeMX_Config/Inc']
if rtconfig.CROSS_TOOL == 'gcc':
src += [cwd + '/../../libraries/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s']
elif rtconfig.CROSS_TOOL == 'keil':
src += [cwd + '/../../libraries/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/arm/startup_stm32f103xb.s']
elif rtconfig.CROSS_TOOL == 'iar':
src += [cwd + '/../../libraries/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/iar/startup_stm32f103xb.s']
if os.path.exists(cwd + '/../libraries'):
startup_path_prefix = cwd + '/../libraries'
else:
startup_path_prefix = cwd + '/../../libraries'
if rtconfig.CROSS_TOOL == 'gcc':
src += [startup_path_prefix + '/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s']
elif rtconfig.CROSS_TOOL == 'keil':
src += [startup_path_prefix + '/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/arm/startup_stm32f103xb.s']
elif rtconfig.CROSS_TOOL == 'iar':
src += [startup_path_prefix + '/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/iar/startup_stm32f103xb.s']
CPPDEFINES = ['STM32F103xB']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
Return('group')
Return('group')

View File

@ -5,6 +5,9 @@ ARCH='arm'
CPU='cortex-m3'
CROSS_TOOL='gcc'
# bsp lib config
BSP_LIBRARY_TYPE = None
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if os.getenv('RTT_ROOT'):

View File

@ -37,11 +37,19 @@ objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
SDK_ROOT = os.path.abspath('./')
# include drivers
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/STM32F4xx_HAL/SConscript'))
if os.path.exists(SDK_ROOT + '/libraries'):
libraries_path_prefix = SDK_ROOT + '/libraries/'
else:
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries/'
stm32_library = 'STM32F4xx_HAL'
rtconfig.BSP_LIBRARY_TYPE = stm32_library
# include libraries
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/HAL_Drivers/SConscript'))
objs.extend(SConscript(libraries_path_prefix + stm32_library + '/SConscript'))
# include drivers
objs.extend(SConscript(libraries_path_prefix + '/HAL_Drivers/SConscript'))
# make a building
DoBuilding(TARGET, objs)

View File

@ -1,21 +1,27 @@
import os
import rtconfig
from building import *
cwd = GetCurrentDir()
# add the general drivers.
src = Glob('board.c')
# add general drivers
src = Glob('board.c')
src += Glob('CubeMX_Config/Src/stm32f4xx_hal_msp.c')
path = [cwd]
path = [cwd]
path += [cwd + '/CubeMX_Config/Inc']
if os.path.exists(cwd + '/../libraries'):
startup_path_prefix = cwd + '/../libraries'
else:
startup_path_prefix = cwd + '/../../libraries'
if rtconfig.CROSS_TOOL == 'gcc':
src += [cwd + '/../../libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f407xx.s']
src += [startup_path_prefix + '/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f407xx.s']
elif rtconfig.CROSS_TOOL == 'keil':
src += [cwd + '/../../libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f407xx.s']
src += [startup_path_prefix + '/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f407xx.s']
elif rtconfig.CROSS_TOOL == 'iar':
src += [cwd + '/../../libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32f407xx.s']
src += [startup_path_prefix + '/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32f407xx.s']
CPPDEFINES = ['STM32F407xx']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)

View File

@ -5,6 +5,9 @@ ARCH='arm'
CPU='cortex-m4'
CROSS_TOOL='gcc'
# bsp lib config
BSP_LIBRARY_TYPE = None
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if os.getenv('RTT_ROOT'):

View File

@ -37,11 +37,19 @@ objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
SDK_ROOT = os.path.abspath('./')
# include drivers
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/STM32L4xx_HAL/SConscript'))
if os.path.exists(SDK_ROOT + '/libraries'):
libraries_path_prefix = SDK_ROOT + '/libraries/'
else:
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries/'
stm32_library = 'STM32FL4xx_HAL'
rtconfig.BSP_LIBRARY_TYPE = stm32_library
# include libraries
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/HAL_Drivers/SConscript'))
objs.extend(SConscript(libraries_path_prefix + stm32_library + '/SConscript'))
# include drivers
objs.extend(SConscript(libraries_path_prefix + '/HAL_Drivers/SConscript'))
# make a building
DoBuilding(TARGET, objs)

View File

@ -1,21 +1,27 @@
import os
import rtconfig
from building import *
cwd = GetCurrentDir()
# add the general drivers.
src = Glob('board.c')
# add general drivers
src = Glob('board.c')
src += Glob('CubeMX_Config/Src/stm32l4xx_hal_msp.c')
path = [cwd]
path = [cwd]
path += [cwd + '/CubeMX_Config/Inc']
if os.path.exists(cwd + '/../libraries'):
startup_path_prefix = cwd + '/../libraries'
else:
startup_path_prefix = cwd + '/../../libraries'
if rtconfig.CROSS_TOOL == 'gcc':
src += [cwd + '/../../libraries/STM32L4xx_HAL/CMSIS/Device/ST/STM32L4xx/Source/Templates/gcc/startup_stm32l475xx.s']
src += [startup_path_prefix + '/STM32L4xx_HAL/CMSIS/Device/ST/STM32L4xx/Source/Templates/gcc/startup_stm32l475xx.s']
elif rtconfig.CROSS_TOOL == 'keil':
src += [cwd + '/../../libraries/STM32L4xx_HAL/CMSIS/Device/ST/STM32L4xx/Source/Templates/arm/startup_stm32l475xx.s']
src += [startup_path_prefix + '/STM32L4xx_HAL/CMSIS/Device/ST/STM32L4xx/Source/Templates/arm/startup_stm32l475xx.s']
elif rtconfig.CROSS_TOOL == 'iar':
src += [cwd + '/../../libraries/STM32L4xx_HAL/CMSIS/Device/ST/STM32L4xx/Source/Templates/iar/startup_stm32l475xx.s']
src += [startup_path_prefix + '/STM32L4xx_HAL/CMSIS/Device/ST/STM32L4xx/Source/Templates/iar/startup_stm32l475xx.s']
CPPDEFINES = ['STM32L475xx']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)

View File

@ -5,6 +5,9 @@ ARCH='arm'
CPU='cortex-m4'
CROSS_TOOL='gcc'
# bsp lib config
BSP_LIBRARY_TYPE = None
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if os.getenv('RTT_ROOT'):

View File

@ -38,11 +38,19 @@ objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
SDK_ROOT = os.path.abspath('./')
bsp_vdir = 'build'
# include drivers
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/STM32F1xx_HAL/SConscript'))
if os.path.exists(SDK_ROOT + '/libraries'):
libraries_path_prefix = SDK_ROOT + '/libraries/'
else:
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries/'
stm32_library = 'STM32F1xx_HAL'
rtconfig.BSP_LIBRARY_TYPE = stm32_library
# include libraries
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/HAL_Drivers/SConscript'))
objs.extend(SConscript(libraries_path_prefix + stm32_library + '/SConscript'))
# include drivers
objs.extend(SConscript(libraries_path_prefix + '/HAL_Drivers/SConscript'))
# make a building
DoBuilding(TARGET, objs)

View File

@ -1,24 +1,31 @@
import os
import rtconfig
from building import *
cwd = GetCurrentDir()
src = Glob('board.c')
# add general drivers
src = Glob('board.c')
src += Glob('CubeMX_Config/Src/stm32f1xx_hal_msp.c')
if GetDepend(['BSP_USING_SPI_FLASH']):
src += Glob('ports/spi_flash_init.c')
path = [cwd]
path = [cwd]
path += [cwd + '/CubeMX_Config/Inc']
path += [cwd + '/ports']
if os.path.exists(cwd + '/../libraries'):
startup_path_prefix = cwd + '/../libraries'
else:
startup_path_prefix = cwd + '/../../libraries'
if rtconfig.CROSS_TOOL == 'gcc':
src += [cwd + '/../../libraries/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s']
src += [startup_path_prefix + '/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xb.s']
elif rtconfig.CROSS_TOOL == 'keil':
src += [cwd + '/../../libraries/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/arm/startup_stm32f103xb.s']
src += [startup_path_prefix + '/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/arm/startup_stm32f103xb.s']
elif rtconfig.CROSS_TOOL == 'iar':
src += [cwd + '/../../libraries/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/iar/startup_stm32f103xb.s']
src += [startup_path_prefix + '/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/iar/startup_stm32f103xb.s']
CPPDEFINES = ['STM32F103xB']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)

View File

@ -5,6 +5,9 @@ ARCH='arm'
CPU='cortex-m3'
CROSS_TOOL='gcc'
# bsp lib config
BSP_LIBRARY_TYPE = None
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if os.getenv('RTT_ROOT'):

View File

@ -38,11 +38,19 @@ objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
SDK_ROOT = os.path.abspath('./')
bsp_vdir = 'build'
# include drivers
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/STM32F1xx_HAL/SConscript'))
if os.path.exists(SDK_ROOT + '/libraries'):
libraries_path_prefix = SDK_ROOT + '/libraries/'
else:
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries/'
stm32_library = 'STM32F1xx_HAL'
rtconfig.BSP_LIBRARY_TYPE = stm32_library
# include libraries
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/HAL_Drivers/SConscript'))
objs.extend(SConscript(libraries_path_prefix + stm32_library + '/SConscript'))
# include drivers
objs.extend(SConscript(libraries_path_prefix + '/HAL_Drivers/SConscript'))
# make a building
DoBuilding(TARGET, objs)

View File

@ -1,9 +1,11 @@
import os
import rtconfig
from building import *
cwd = GetCurrentDir()
src = Glob('board.c')
# add general drivers
src = Glob('board.c')
src += Glob('CubeMX_Config/Src/stm32f1xx_hal_msp.c')
if GetDepend(['BSP_USING_ETH']):
@ -16,12 +18,17 @@ path = [cwd]
path += [cwd + '/CubeMX_Config/Inc']
path += [cwd + '/ports']
if os.path.exists(cwd + '/../libraries'):
startup_path_prefix = cwd + '/../libraries'
else:
startup_path_prefix = cwd + '/../../libraries'
if rtconfig.CROSS_TOOL == 'gcc':
src += [cwd + '/../../libraries/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xe.s']
src += [startup_path_prefix + '/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xe.s']
elif rtconfig.CROSS_TOOL == 'keil':
src += [cwd + '/../../libraries/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/arm/startup_stm32f103xe.s']
src += [startup_path_prefix + '/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/arm/startup_stm32f103xe.s']
elif rtconfig.CROSS_TOOL == 'iar':
src += [cwd + '/../../libraries/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/iar/startup_stm32f103xe.s']
src += [startup_path_prefix + '/STM32F1xx_HAL/CMSIS/Device/ST/STM32F1xx/Source/Templates/iar/startup_stm32f103xe.s']
CPPDEFINES = ['STM32F103xE']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)

View File

@ -5,6 +5,9 @@ ARCH='arm'
CPU='cortex-m3'
CROSS_TOOL='gcc'
# bsp lib config
BSP_LIBRARY_TYPE = None
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if os.getenv('RTT_ROOT'):

View File

@ -37,11 +37,19 @@ objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
SDK_ROOT = os.path.abspath('./')
# include drivers
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/STM32F4xx_HAL/SConscript'))
if os.path.exists(SDK_ROOT + '/libraries'):
libraries_path_prefix = SDK_ROOT + '/libraries/'
else:
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries/'
stm32_library = 'STM32F4xx_HAL'
rtconfig.BSP_LIBRARY_TYPE = stm32_library
# include libraries
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/HAL_Drivers/SConscript'))
objs.extend(SConscript(libraries_path_prefix + stm32_library + '/SConscript'))
# include drivers
objs.extend(SConscript(libraries_path_prefix + '/HAL_Drivers/SConscript'))
# make a building
DoBuilding(TARGET, objs)

View File

@ -1,10 +1,11 @@
import os
import rtconfig
from building import *
cwd = GetCurrentDir()
# add the general drivers.
src = Glob('board.c')
# add general drivers
src = Glob('board.c')
src += Glob('CubeMX_Config/Src/stm32f4xx_hal_msp.c')
if GetDepend(['BSP_USING_ETH']):
@ -17,12 +18,17 @@ path = [cwd]
path += [cwd + '/CubeMX_Config/Inc']
path += [cwd + '/ports']
if os.path.exists(cwd + '/../libraries'):
startup_path_prefix = cwd + '/../libraries'
else:
startup_path_prefix = cwd + '/../../libraries'
if rtconfig.CROSS_TOOL == 'gcc':
src += [cwd + '/../../libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f407xx.s']
src += [startup_path_prefix + '/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f407xx.s']
elif rtconfig.CROSS_TOOL == 'keil':
src += [cwd + '/../../libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f407xx.s']
src += [startup_path_prefix + '/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f407xx.s']
elif rtconfig.CROSS_TOOL == 'iar':
src += [cwd + '/../../libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32f407xx.s']
src += [startup_path_prefix + '/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32f407xx.s']
CPPDEFINES = ['STM32F407xx']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)

View File

@ -5,6 +5,9 @@ ARCH='arm'
CPU='cortex-m4'
CROSS_TOOL='gcc'
# bsp lib config
BSP_LIBRARY_TYPE = None
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if os.getenv('RTT_ROOT'):

View File

@ -37,11 +37,19 @@ objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
SDK_ROOT = os.path.abspath('./')
# include drivers
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/STM32F4xx_HAL/SConscript'))
if os.path.exists(SDK_ROOT + '/libraries'):
libraries_path_prefix = SDK_ROOT + '/libraries/'
else:
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries/'
stm32_library = 'STM32F4xx_HAL'
rtconfig.BSP_LIBRARY_TYPE = stm32_library
# include libraries
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/HAL_Drivers/SConscript'))
objs.extend(SConscript(libraries_path_prefix + stm32_library + '/SConscript'))
# include drivers
objs.extend(SConscript(libraries_path_prefix + '/HAL_Drivers/SConscript'))
# make a building
DoBuilding(TARGET, objs)

View File

@ -1,9 +1,10 @@
import os
import rtconfig
from building import *
cwd = GetCurrentDir()
# add the general drivers.
# add general drivers
src = Glob('board.c')
src += Glob('CubeMX_Config/Src/stm32f4xx_hal_msp.c')
@ -16,17 +17,18 @@ if GetDepend(['BSP_USING_SPI_FLASH']):
path = [cwd]
path += [cwd + '/CubeMX_Config/Inc']
path += [cwd + '/ports']
if GetDepend(['BSP_USING_SDRAM']):
path += [cwd + '/ports']
if os.path.exists(cwd + '/../libraries'):
startup_path_prefix = cwd + '/../libraries'
else:
startup_path_prefix = cwd + '/../../libraries'
if rtconfig.CROSS_TOOL == 'gcc':
src += [cwd + '/../../libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f429xx.s']
src += [startup_path_prefix + '/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f429xx.s']
elif rtconfig.CROSS_TOOL == 'keil':
src += [cwd + '/../../libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f429xx.s']
src += [startup_path_prefix + '/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f429xx.s']
elif rtconfig.CROSS_TOOL == 'iar':
src += [cwd + '/../../libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32f429xx.s']
src += [startup_path_prefix + '/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32f429xx.s']
CPPDEFINES = ['STM32F429xx']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)

View File

@ -5,6 +5,9 @@ ARCH='arm'
CPU='cortex-m4'
CROSS_TOOL='gcc'
# bsp lib config
BSP_LIBRARY_TYPE = None
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if os.getenv('RTT_ROOT'):

View File

@ -37,11 +37,19 @@ objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
SDK_ROOT = os.path.abspath('./')
# include drivers
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/STM32F4xx_HAL/SConscript'))
if os.path.exists(SDK_ROOT + '/libraries'):
libraries_path_prefix = SDK_ROOT + '/libraries/'
else:
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries/'
stm32_library = 'STM32F4xx_HAL'
rtconfig.BSP_LIBRARY_TYPE = stm32_library
# include libraries
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/HAL_Drivers/SConscript'))
objs.extend(SConscript(libraries_path_prefix + stm32_library + '/SConscript'))
# include drivers
objs.extend(SConscript(libraries_path_prefix + '/HAL_Drivers/SConscript'))
# make a building
DoBuilding(TARGET, objs)

View File

@ -1,10 +1,11 @@
import os
import rtconfig
from building import *
cwd = GetCurrentDir()
# add the general drivers.
src = Glob('board.c')
# add general drivers
src = Glob('board.c')
src += Glob('CubeMX_Config/Src/stm32f4xx_hal_msp.c')
if GetDepend(['BSP_USING_ETH']):
@ -13,19 +14,21 @@ if GetDepend(['BSP_USING_ETH']):
if GetDepend(['BSP_USING_SPI_FLASH']):
src += Glob('ports/spi_flash_init.c')
path = [cwd]
path = [cwd]
path += [cwd + '/CubeMX_Config/Inc']
path += [cwd + '/ports']
if GetDepend(['BSP_USING_SDRAM']):
path += [cwd + '/ports']
if os.path.exists(cwd + '/../libraries'):
startup_path_prefix = cwd + '/../libraries'
else:
startup_path_prefix = cwd + '/../../libraries'
if rtconfig.CROSS_TOOL == 'gcc':
src += [cwd + '/../../libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f429xx.s']
src += [startup_path_prefix + '/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f429xx.s']
elif rtconfig.CROSS_TOOL == 'keil':
src += [cwd + '/../../libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f429xx.s']
src += [startup_path_prefix + '/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f429xx.s']
elif rtconfig.CROSS_TOOL == 'iar':
src += [cwd + '/../../libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32f429xx.s']
src += [startup_path_prefix + '/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/iar/startup_stm32f429xx.s']
CPPDEFINES = ['STM32F429xx']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)

View File

@ -5,6 +5,9 @@ ARCH='arm'
CPU='cortex-m4'
CROSS_TOOL='gcc'
# bsp lib config
BSP_LIBRARY_TYPE = None
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if os.getenv('RTT_ROOT'):

View File

@ -810,6 +810,9 @@ def EndBuilding(target, program = None):
Env['target'] = program
Env['project'] = Projects
if hasattr(rtconfig, 'BSP_LIBRARY_TYPE'):
Env['bsp_lib_type'] = rtconfig.BSP_LIBRARY_TYPE
Env.AddPostAction(target, rtconfig.POST_ACTION)
# Add addition clean files
Clean(target, 'cconfig.h')

View File

@ -122,6 +122,24 @@ def bsp_update_kconfig(dist_dir):
line = line[0:position] + 'default: "rt-thread"\n'
found = 0
f.write(line)
def bsp_update_kconfig_library(dist_dir):
# change RTT_ROOT in Kconfig
if not os.path.isfile(os.path.join(dist_dir, 'Kconfig')):
return
with open(os.path.join(dist_dir, 'Kconfig'), 'r') as f:
data = f.readlines()
with open(os.path.join(dist_dir, 'Kconfig'), 'w') as f:
found = 0
for line in data:
if line.find('RTT_ROOT') != -1:
found = 1
if line.find('../libraries') != -1 and found:
position = line.find('../libraries')
line = line[0:position] + 'libraries/Kconfig"\n'
found = 0
f.write(line)
def bs_update_ide_project(bsp_root, rtt_root):
import subprocess
@ -169,6 +187,15 @@ def MkDist_Strip(program, BSP_ROOT, RTT_ROOT, Env):
print('=> %s' % os.path.basename(BSP_ROOT))
bsp_copy_files(BSP_ROOT, dist_dir)
# copy stm32 bsp libiary files
if os.path.basename(os.path.dirname(BSP_ROOT)) == 'stm32':
print("=> copy stm32 bsp library")
library_path = os.path.join(os.path.dirname(BSP_ROOT), 'libraries')
library_dir = os.path.join(dist_dir, 'libraries')
bsp_copy_files(os.path.join(library_path, 'HAL_Drivers'), os.path.join(library_dir, 'HAL_Drivers'))
bsp_copy_files(os.path.join(library_path, Env['bsp_lib_type']), os.path.join(library_dir, Env['bsp_lib_type']))
shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))
# get all source files from program
for item in program:
walk_children(item)
@ -260,6 +287,7 @@ def MkDist_Strip(program, BSP_ROOT, RTT_ROOT, Env):
bsp_update_sconstruct(dist_dir)
# change RTT_ROOT in Kconfig
bsp_update_kconfig(dist_dir)
bsp_update_kconfig_library(dist_dir)
# update all project files
bs_update_ide_project(dist_dir, target_path)
@ -280,6 +308,15 @@ def MkDist(program, BSP_ROOT, RTT_ROOT, Env):
print('=> %s' % os.path.basename(BSP_ROOT))
bsp_copy_files(BSP_ROOT, dist_dir)
# copy stm32 bsp libiary files
if os.path.basename(os.path.dirname(BSP_ROOT)) == 'stm32':
print("=> copy stm32 bsp library")
library_path = os.path.join(os.path.dirname(BSP_ROOT), 'libraries')
library_dir = os.path.join(dist_dir, 'libraries')
bsp_copy_files(os.path.join(library_path, 'HAL_Drivers'), os.path.join(library_dir, 'HAL_Drivers'))
bsp_copy_files(os.path.join(library_path, Env['bsp_lib_type']), os.path.join(library_dir, Env['bsp_lib_type']))
shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))
# copy tools directory
print('=> components')
do_copy_folder(os.path.join(RTT_ROOT, 'components'), os.path.join(target_path, 'components'))
@ -316,6 +353,7 @@ def MkDist(program, BSP_ROOT, RTT_ROOT, Env):
bsp_update_sconstruct(dist_dir)
# change RTT_ROOT in Kconfig
bsp_update_kconfig(dist_dir)
bsp_update_kconfig_library(dist_dir)
# update all project files
bs_update_ide_project(dist_dir, target_path)