修改一些脚本
This commit is contained in:
parent
2fbced6f21
commit
78f206e88b
|
@ -32,16 +32,27 @@ if rtconfig.PLATFORM == 'iar':
|
||||||
Export('RTT_ROOT')
|
Export('RTT_ROOT')
|
||||||
Export('rtconfig')
|
Export('rtconfig')
|
||||||
|
|
||||||
|
SDK_ROOT = os.path.abspath('./')
|
||||||
|
|
||||||
|
if os.path.exists(SDK_ROOT + '/libraries'):
|
||||||
|
libraries_path_prefix = SDK_ROOT + '/libraries'
|
||||||
|
else:
|
||||||
|
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'
|
||||||
|
|
||||||
|
SDK_LIB = libraries_path_prefix
|
||||||
|
Export('SDK_LIB')
|
||||||
|
|
||||||
# prepare building environment
|
# prepare building environment
|
||||||
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
|
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
|
||||||
|
|
||||||
SDK_ROOT = os.path.abspath('./')
|
stm32_library = 'STM32F4xx_HAL'
|
||||||
|
rtconfig.BSP_LIBRARY_TYPE = stm32_library
|
||||||
# include drivers
|
|
||||||
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/STM32F7xx_HAL/SConscript'))
|
|
||||||
|
|
||||||
# include libraries
|
# include libraries
|
||||||
objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/HAL_Drivers/SConscript'))
|
objs.extend(SConscript(os.path.join(libraries_path_prefix, stm32_library, 'SConscript')))
|
||||||
|
|
||||||
|
# include drivers
|
||||||
|
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'HAL_Drivers', 'SConscript')))
|
||||||
|
|
||||||
# make a building
|
# make a building
|
||||||
DoBuilding(TARGET, objs)
|
DoBuilding(TARGET, objs)
|
||||||
|
|
|
@ -22,7 +22,7 @@ menu "Onboard Peripheral Drivers"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
config BSP_USING_QSPI_FLASH
|
config BSP_USING_QSPI_FLASH
|
||||||
bool "Enable QSPI FLASH"
|
bool "Enable QSPI FLASH (W25Q128 qspi1)"
|
||||||
select BSP_USING_QSPI
|
select BSP_USING_QSPI
|
||||||
select RT_USING_SFUD
|
select RT_USING_SFUD
|
||||||
select RT_SFUD_USING_QSPI
|
select RT_SFUD_USING_QSPI
|
||||||
|
@ -134,6 +134,7 @@ menu "On-chip Peripheral Drivers"
|
||||||
select RT_USING_I2C_BITOPS
|
select RT_USING_I2C_BITOPS
|
||||||
select RT_USING_PIN
|
select RT_USING_PIN
|
||||||
if BSP_USING_I2C2
|
if BSP_USING_I2C2
|
||||||
|
comment "Notice: PC15 --> 47; PD0 --> 48"
|
||||||
config BSP_I2C2_SCL_PIN
|
config BSP_I2C2_SCL_PIN
|
||||||
int "i2c2 scl pin number"
|
int "i2c2 scl pin number"
|
||||||
range 1 176
|
range 1 176
|
||||||
|
@ -151,6 +152,7 @@ menu "On-chip Peripheral Drivers"
|
||||||
select RT_USING_I2C_BITOPS
|
select RT_USING_I2C_BITOPS
|
||||||
select RT_USING_PIN
|
select RT_USING_PIN
|
||||||
if BSP_USING_I2C3
|
if BSP_USING_I2C3
|
||||||
|
comment "Notice: PF12 --> 92; PF13 --> 93"
|
||||||
config BSP_I2C3_SCL_PIN
|
config BSP_I2C3_SCL_PIN
|
||||||
int "i2c3 scl pin number"
|
int "i2c3 scl pin number"
|
||||||
range 1 176
|
range 1 176
|
||||||
|
|
|
@ -1,31 +1,35 @@
|
||||||
|
import os
|
||||||
import rtconfig
|
import rtconfig
|
||||||
from building import *
|
from building import *
|
||||||
|
|
||||||
|
Import('SDK_LIB')
|
||||||
|
|
||||||
cwd = GetCurrentDir()
|
cwd = GetCurrentDir()
|
||||||
|
|
||||||
# add the general drivers.
|
# add general drivers
|
||||||
src = Glob('board.c')
|
src = Split('''
|
||||||
src += Glob('CubeMX_Config/Src/stm32f7xx_hal_msp.c')
|
board.c
|
||||||
|
CubeMX_Config/Src/stm32f7xx_hal_msp.c
|
||||||
|
''')
|
||||||
|
|
||||||
if GetDepend(['BSP_USING_ETH']):
|
if GetDepend(['BSP_USING_ETH']):
|
||||||
src += Glob('ports/phy_reset.c')
|
src += Glob('ports/phy_reset.c')
|
||||||
|
|
||||||
if GetDepend(['BSP_USING_QSPI_FLASH']):
|
if GetDepend(['BSP_USING_QSPI_FLASH']):
|
||||||
src += Glob('ports/qspi_flash_init.c')
|
src += Glob('ports/drv_qspi_flash.c')
|
||||||
|
|
||||||
path = [cwd]
|
path = [cwd]
|
||||||
path += [cwd + '/CubeMX_Config/Inc']
|
path += [cwd + '/CubeMX_Config/Inc']
|
||||||
path += [cwd + '/ports']
|
path += [cwd + '/ports']
|
||||||
|
|
||||||
if GetDepend(['BSP_USING_SDRAM']):
|
startup_path_prefix = SDK_LIB
|
||||||
path += [cwd + '/ports']
|
|
||||||
|
|
||||||
if rtconfig.CROSS_TOOL == 'gcc':
|
if rtconfig.CROSS_TOOL == 'gcc':
|
||||||
src += [cwd + '/../../libraries/STM32F7xx_HAL/CMSIS/Device/ST/STM32F7xx/Source/Templates/gcc/startup_stm32f767xx.s']
|
src += [startup_path_prefix + '/STM32F7xx_HAL/CMSIS/Device/ST/STM32F7xx/Source/Templates/gcc/startup_stm32f767xx.s']
|
||||||
elif rtconfig.CROSS_TOOL == 'keil':
|
elif rtconfig.CROSS_TOOL == 'keil':
|
||||||
src += [cwd + '/../../libraries/STM32F7xx_HAL/CMSIS/Device/ST/STM32F7xx/Source/Templates/arm/startup_stm32f767xx.s']
|
src += [startup_path_prefix + '/STM32F7xx_HAL/CMSIS/Device/ST/STM32F7xx/Source/Templates/arm/startup_stm32f767xx.s']
|
||||||
elif rtconfig.CROSS_TOOL == 'iar':
|
elif rtconfig.CROSS_TOOL == 'iar':
|
||||||
src += [cwd + '/../../libraries/STM32F7xx_HAL/CMSIS/Device/ST/STM32F7xx/Source/Templates/iar/startup_stm32f767xx.s']
|
src += [startup_path_prefix + '/STM32F7xx_HAL/CMSIS/Device/ST/STM32F7xx/Source/Templates/iar/startup_stm32f767xx.s']
|
||||||
|
|
||||||
CPPDEFINES = ['STM32F767xx']
|
CPPDEFINES = ['STM32F767xx']
|
||||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
|
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
|
||||||
|
|
|
@ -5,6 +5,9 @@ ARCH='arm'
|
||||||
CPU='cortex-m7'
|
CPU='cortex-m7'
|
||||||
CROSS_TOOL='gcc'
|
CROSS_TOOL='gcc'
|
||||||
|
|
||||||
|
# bsp lib config
|
||||||
|
BSP_LIBRARY_TYPE = None
|
||||||
|
|
||||||
if os.getenv('RTT_CC'):
|
if os.getenv('RTT_CC'):
|
||||||
CROSS_TOOL = os.getenv('RTT_CC')
|
CROSS_TOOL = os.getenv('RTT_CC')
|
||||||
if os.getenv('RTT_ROOT'):
|
if os.getenv('RTT_ROOT'):
|
||||||
|
@ -14,7 +17,7 @@ if os.getenv('RTT_ROOT'):
|
||||||
# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR
|
# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR
|
||||||
if CROSS_TOOL == 'gcc':
|
if CROSS_TOOL == 'gcc':
|
||||||
PLATFORM = 'gcc'
|
PLATFORM = 'gcc'
|
||||||
EXEC_PATH = '/usr/local/Cellar/arm-none-eabi-gcc/7-2017-q4-major/gcc/bin/'
|
EXEC_PATH = r'C:\Users\XXYYZZ'
|
||||||
elif CROSS_TOOL == 'keil':
|
elif CROSS_TOOL == 'keil':
|
||||||
PLATFORM = 'armcc'
|
PLATFORM = 'armcc'
|
||||||
EXEC_PATH = r'C:/Keil_v5'
|
EXEC_PATH = r'C:/Keil_v5'
|
||||||
|
@ -31,7 +34,6 @@ if PLATFORM == 'gcc':
|
||||||
# toolchains
|
# toolchains
|
||||||
PREFIX = 'arm-none-eabi-'
|
PREFIX = 'arm-none-eabi-'
|
||||||
CC = PREFIX + 'gcc'
|
CC = PREFIX + 'gcc'
|
||||||
CXX = PREFIX + 'g++'
|
|
||||||
AS = PREFIX + 'gcc'
|
AS = PREFIX + 'gcc'
|
||||||
AR = PREFIX + 'ar'
|
AR = PREFIX + 'ar'
|
||||||
LINK = PREFIX + 'gcc'
|
LINK = PREFIX + 'gcc'
|
||||||
|
@ -39,56 +41,48 @@ if PLATFORM == 'gcc':
|
||||||
SIZE = PREFIX + 'size'
|
SIZE = PREFIX + 'size'
|
||||||
OBJDUMP = PREFIX + 'objdump'
|
OBJDUMP = PREFIX + 'objdump'
|
||||||
OBJCPY = PREFIX + 'objcopy'
|
OBJCPY = PREFIX + 'objcopy'
|
||||||
STRIP = PREFIX + 'strip'
|
|
||||||
|
|
||||||
DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
|
DEVICE = ' -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
|
||||||
CFLAGS = DEVICE + ' -std=c99 -g -Wall'
|
CFLAGS = DEVICE + ' -std=c99 -Dgcc'
|
||||||
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
|
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
|
||||||
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T rtthread.ld'
|
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
|
||||||
|
|
||||||
CPATH = ''
|
CPATH = ''
|
||||||
LPATH = ''
|
LPATH = ''
|
||||||
|
|
||||||
if BUILD == 'debug':
|
if BUILD == 'debug':
|
||||||
CFLAGS += ' -O0 -gdwarf-2'
|
CFLAGS += ' -O0 -gdwarf-2 -g'
|
||||||
AFLAGS += ' -gdwarf-2'
|
AFLAGS += ' -gdwarf-2'
|
||||||
else:
|
else:
|
||||||
CFLAGS += ' -O2 -Os'
|
CFLAGS += ' -O2'
|
||||||
|
|
||||||
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
|
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
|
||||||
|
|
||||||
# module setting
|
|
||||||
CXXFLAGS = ' -Woverloaded-virtual -fno-exceptions -fno-rtti '
|
|
||||||
M_CFLAGS = CFLAGS + ' -mlong-calls -fPIC '
|
|
||||||
M_CXXFLAGS = CXXFLAGS + ' -mlong-calls -fPIC'
|
|
||||||
M_LFLAGS = DEVICE + CXXFLAGS + ' -Wl,--gc-sections,-z,max-page-size=0x4' +\
|
|
||||||
' -shared -fPIC -nostartfiles -static-libgcc'
|
|
||||||
M_POST_ACTION = STRIP + ' -R .hash $TARGET\n' + SIZE + ' $TARGET \n'
|
|
||||||
|
|
||||||
elif PLATFORM == 'armcc':
|
elif PLATFORM == 'armcc':
|
||||||
# toolchains
|
# toolchains
|
||||||
CC = 'armcc'
|
CC = 'armcc'
|
||||||
CXX = 'armcc'
|
|
||||||
AS = 'armasm'
|
AS = 'armasm'
|
||||||
AR = 'armar'
|
AR = 'armar'
|
||||||
LINK = 'armlink'
|
LINK = 'armlink'
|
||||||
TARGET_EXT = 'axf'
|
TARGET_EXT = 'axf'
|
||||||
|
|
||||||
DEVICE = ' --cpu Cortex-M7.fp.sp --fpu=FPv4-SP'
|
DEVICE = ' --cpu Cortex-M7.fp.sp'
|
||||||
CFLAGS = DEVICE + ' --apcs=interwork '
|
CFLAGS = '-c ' + DEVICE + ' --apcs=interwork --c99'
|
||||||
AFLAGS = DEVICE
|
AFLAGS = DEVICE + ' --apcs=interwork '
|
||||||
LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread.map --scatter rtthread.sct'
|
LFLAGS = DEVICE + ' --scatter "board\linker_scripts\link.sct" --info sizes --info totals --info unused --info veneers --list rt-thread.map --strict'
|
||||||
|
CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCC/include'
|
||||||
|
LFLAGS += ' --libpath=' + EXEC_PATH + '/ARM/ARMCC/lib'
|
||||||
|
|
||||||
CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCC/INC'
|
CFLAGS += ' -D__MICROLIB '
|
||||||
LFLAGS += ' --libpath "' + EXEC_PATH + '/ARM/ARMCC/lib"'
|
AFLAGS += ' --pd "__MICROLIB SETA 1" '
|
||||||
|
LFLAGS += ' --library_type=microlib '
|
||||||
EXEC_PATH += '/arm/bin40/'
|
EXEC_PATH += '/ARM/ARMCC/bin/'
|
||||||
|
|
||||||
if BUILD == 'debug':
|
if BUILD == 'debug':
|
||||||
CFLAGS += ' -g -O0'
|
CFLAGS += ' -g -O0'
|
||||||
AFLAGS += ' -g'
|
AFLAGS += ' -g'
|
||||||
else:
|
else:
|
||||||
CFLAGS += ' -O2 -Otime'
|
CFLAGS += ' -O2'
|
||||||
|
|
||||||
CXXFLAGS = CFLAGS
|
CXXFLAGS = CFLAGS
|
||||||
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
|
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
|
||||||
|
@ -96,13 +90,12 @@ elif PLATFORM == 'armcc':
|
||||||
elif PLATFORM == 'iar':
|
elif PLATFORM == 'iar':
|
||||||
# toolchains
|
# toolchains
|
||||||
CC = 'iccarm'
|
CC = 'iccarm'
|
||||||
CXX = 'iccarm'
|
|
||||||
AS = 'iasmarm'
|
AS = 'iasmarm'
|
||||||
AR = 'iarchive'
|
AR = 'iarchive'
|
||||||
LINK = 'ilinkarm'
|
LINK = 'ilinkarm'
|
||||||
TARGET_EXT = 'out'
|
TARGET_EXT = 'out'
|
||||||
|
|
||||||
DEVICE = ''
|
DEVICE = '-Dewarm'
|
||||||
|
|
||||||
CFLAGS = DEVICE
|
CFLAGS = DEVICE
|
||||||
CFLAGS += ' --diag_suppress Pa050'
|
CFLAGS += ' --diag_suppress Pa050'
|
||||||
|
@ -113,31 +106,29 @@ elif PLATFORM == 'iar':
|
||||||
CFLAGS += ' --no_tbaa'
|
CFLAGS += ' --no_tbaa'
|
||||||
CFLAGS += ' --no_clustering'
|
CFLAGS += ' --no_clustering'
|
||||||
CFLAGS += ' --no_scheduling'
|
CFLAGS += ' --no_scheduling'
|
||||||
CFLAGS += ' --debug'
|
|
||||||
CFLAGS += ' --endian=little'
|
CFLAGS += ' --endian=little'
|
||||||
CFLAGS += ' --cpu=Cortex-M7'
|
CFLAGS += ' --cpu=Cortex-M7'
|
||||||
CFLAGS += ' -e'
|
CFLAGS += ' -e'
|
||||||
CFLAGS += ' --fpu=None'
|
CFLAGS += ' --fpu=VFPv5_sp'
|
||||||
CFLAGS += ' --dlib_config "' + EXEC_PATH + '/arm/INC/c/DLib_Config_Normal.h"'
|
CFLAGS += ' --dlib_config "' + EXEC_PATH + '/arm/INC/c/DLib_Config_Normal.h"'
|
||||||
CFLAGS += ' -Ol'
|
|
||||||
CFLAGS += ' --use_c++_inline'
|
|
||||||
CFLAGS += ' --silent'
|
CFLAGS += ' --silent'
|
||||||
|
|
||||||
AFLAGS = ''
|
AFLAGS = DEVICE
|
||||||
AFLAGS += ' -s+'
|
AFLAGS += ' -s+'
|
||||||
AFLAGS += ' -w+'
|
AFLAGS += ' -w+'
|
||||||
AFLAGS += ' -r'
|
AFLAGS += ' -r'
|
||||||
AFLAGS += ' --cpu Cortex-M7'
|
AFLAGS += ' --cpu Cortex-M7'
|
||||||
AFLAGS += ' --fpu None'
|
AFLAGS += ' --fpu VFPv5_sp'
|
||||||
AFLAGS += ' -S'
|
AFLAGS += ' -S'
|
||||||
|
|
||||||
LFLAGS = ' --config rtthread.icf'
|
if BUILD == 'debug':
|
||||||
LFLAGS += ' --redirect _Printf=_PrintfTiny'
|
CFLAGS += ' --debug'
|
||||||
LFLAGS += ' --redirect _Scanf=_ScanfSmall'
|
CFLAGS += ' -On'
|
||||||
LFLAGS += ' --entry __iar_program_start'
|
else:
|
||||||
LFLAGS += ' --silent'
|
CFLAGS += ' -Oh'
|
||||||
|
|
||||||
CXXFLAGS = CFLAGS
|
LFLAGS = ' --config "board/linker_scripts/link.icf"'
|
||||||
|
LFLAGS += ' --entry __iar_program_start'
|
||||||
|
|
||||||
EXEC_PATH = EXEC_PATH + '/arm/bin/'
|
EXEC_PATH = EXEC_PATH + '/arm/bin/'
|
||||||
POST_ACTION = ''
|
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
|
Loading…
Reference in New Issue