diff --git a/bsp/stm32/stm32f767-fire-challenger/SConstruct b/bsp/stm32/stm32f767-fire-challenger/SConstruct index 51333e0a9c574167b434251d83483ae160fbb9f4..c1609bf526ab010946758d14981ddea9895a234b 100644 --- a/bsp/stm32/stm32f767-fire-challenger/SConstruct +++ b/bsp/stm32/stm32f767-fire-challenger/SConstruct @@ -32,16 +32,27 @@ if rtconfig.PLATFORM == 'iar': Export('RTT_ROOT') 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 objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False) -SDK_ROOT = os.path.abspath('./') - -# include drivers -objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/STM32F7xx_HAL/SConscript')) +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(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 DoBuilding(TARGET, objs) diff --git a/bsp/stm32/stm32f767-fire-challenger/board/Kconfig b/bsp/stm32/stm32f767-fire-challenger/board/Kconfig index 5ee1fe6b77d60203b3dc30c56dd4b0b327c61eaf..25f5fe05e156fbe6e7879b72e578c520f601ef68 100644 --- a/bsp/stm32/stm32f767-fire-challenger/board/Kconfig +++ b/bsp/stm32/stm32f767-fire-challenger/board/Kconfig @@ -22,7 +22,7 @@ menu "Onboard Peripheral Drivers" default n config BSP_USING_QSPI_FLASH - bool "Enable QSPI FLASH" + bool "Enable QSPI FLASH (W25Q128 qspi1)" select BSP_USING_QSPI select RT_USING_SFUD select RT_SFUD_USING_QSPI @@ -134,6 +134,7 @@ menu "On-chip Peripheral Drivers" select RT_USING_I2C_BITOPS select RT_USING_PIN if BSP_USING_I2C2 + comment "Notice: PC15 --> 47; PD0 --> 48" config BSP_I2C2_SCL_PIN int "i2c2 scl pin number" range 1 176 @@ -151,6 +152,7 @@ menu "On-chip Peripheral Drivers" select RT_USING_I2C_BITOPS select RT_USING_PIN if BSP_USING_I2C3 + comment "Notice: PF12 --> 92; PF13 --> 93" config BSP_I2C3_SCL_PIN int "i2c3 scl pin number" range 1 176 diff --git a/bsp/stm32/stm32f767-fire-challenger/board/SConscript b/bsp/stm32/stm32f767-fire-challenger/board/SConscript index d70c847cd5897e3c61e2115097493b6b340106f1..c7dba39f6c7ad223d4bd2e6ae20f2fab44118588 100644 --- a/bsp/stm32/stm32f767-fire-challenger/board/SConscript +++ b/bsp/stm32/stm32f767-fire-challenger/board/SConscript @@ -1,31 +1,35 @@ +import os import rtconfig from building import * +Import('SDK_LIB') + cwd = GetCurrentDir() -# add the general drivers. -src = Glob('board.c') -src += Glob('CubeMX_Config/Src/stm32f7xx_hal_msp.c') +# add general drivers +src = Split(''' +board.c +CubeMX_Config/Src/stm32f7xx_hal_msp.c +''') if GetDepend(['BSP_USING_ETH']): src += Glob('ports/phy_reset.c') 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 + '/ports'] -if GetDepend(['BSP_USING_SDRAM']): - path += [cwd + '/ports'] +startup_path_prefix = SDK_LIB 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': - 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': - 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'] group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES) diff --git a/bsp/stm32/stm32f767-fire-challenger/rtconfig.py b/bsp/stm32/stm32f767-fire-challenger/rtconfig.py index ced944e0b6104aea2dbb0e68d788ab5e02a2a6a8..138b68600e4932b7f8afe6708ce1ed956a88ef81 100644 --- a/bsp/stm32/stm32f767-fire-challenger/rtconfig.py +++ b/bsp/stm32/stm32f767-fire-challenger/rtconfig.py @@ -5,6 +5,9 @@ ARCH='arm' CPU='cortex-m7' 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'): @@ -14,7 +17,7 @@ if os.getenv('RTT_ROOT'): # EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR if CROSS_TOOL == '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': PLATFORM = 'armcc' EXEC_PATH = r'C:/Keil_v5' @@ -31,7 +34,6 @@ if PLATFORM == 'gcc': # toolchains PREFIX = 'arm-none-eabi-' CC = PREFIX + 'gcc' - CXX = PREFIX + 'g++' AS = PREFIX + 'gcc' AR = PREFIX + 'ar' LINK = PREFIX + 'gcc' @@ -39,56 +41,48 @@ if PLATFORM == 'gcc': SIZE = PREFIX + 'size' OBJDUMP = PREFIX + 'objdump' OBJCPY = PREFIX + 'objcopy' - STRIP = PREFIX + 'strip' - DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' - CFLAGS = DEVICE + ' -std=c99 -g -Wall' + DEVICE = ' -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections' + CFLAGS = DEVICE + ' -std=c99 -Dgcc' 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 = '' LPATH = '' if BUILD == 'debug': - CFLAGS += ' -O0 -gdwarf-2' + CFLAGS += ' -O0 -gdwarf-2 -g' AFLAGS += ' -gdwarf-2' else: - CFLAGS += ' -O2 -Os' + CFLAGS += ' -O2' 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': # toolchains CC = 'armcc' - CXX = 'armcc' AS = 'armasm' AR = 'armar' LINK = 'armlink' TARGET_EXT = 'axf' - DEVICE = ' --cpu Cortex-M7.fp.sp --fpu=FPv4-SP' - CFLAGS = DEVICE + ' --apcs=interwork ' - AFLAGS = DEVICE - LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread.map --scatter rtthread.sct' - - CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCC/INC' - LFLAGS += ' --libpath "' + EXEC_PATH + '/ARM/ARMCC/lib"' + DEVICE = ' --cpu Cortex-M7.fp.sp' + CFLAGS = '-c ' + DEVICE + ' --apcs=interwork --c99' + AFLAGS = DEVICE + ' --apcs=interwork ' + 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' - EXEC_PATH += '/arm/bin40/' + CFLAGS += ' -D__MICROLIB ' + AFLAGS += ' --pd "__MICROLIB SETA 1" ' + LFLAGS += ' --library_type=microlib ' + EXEC_PATH += '/ARM/ARMCC/bin/' if BUILD == 'debug': CFLAGS += ' -g -O0' AFLAGS += ' -g' else: - CFLAGS += ' -O2 -Otime' + CFLAGS += ' -O2' CXXFLAGS = CFLAGS POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' @@ -96,48 +90,45 @@ elif PLATFORM == 'armcc': elif PLATFORM == 'iar': # toolchains CC = 'iccarm' - CXX = 'iccarm' AS = 'iasmarm' AR = 'iarchive' LINK = 'ilinkarm' TARGET_EXT = 'out' - DEVICE = '' + DEVICE = '-Dewarm' CFLAGS = DEVICE CFLAGS += ' --diag_suppress Pa050' - CFLAGS += ' --no_cse' - CFLAGS += ' --no_unroll' - CFLAGS += ' --no_inline' - CFLAGS += ' --no_code_motion' - CFLAGS += ' --no_tbaa' - CFLAGS += ' --no_clustering' - CFLAGS += ' --no_scheduling' - CFLAGS += ' --debug' - CFLAGS += ' --endian=little' + CFLAGS += ' --no_cse' + CFLAGS += ' --no_unroll' + CFLAGS += ' --no_inline' + CFLAGS += ' --no_code_motion' + CFLAGS += ' --no_tbaa' + CFLAGS += ' --no_clustering' + CFLAGS += ' --no_scheduling' + CFLAGS += ' --endian=little' CFLAGS += ' --cpu=Cortex-M7' CFLAGS += ' -e' - CFLAGS += ' --fpu=None' - CFLAGS += ' --dlib_config "' + EXEC_PATH + '/arm/INC/c/DLib_Config_Normal.h"' - CFLAGS += ' -Ol' - CFLAGS += ' --use_c++_inline' + CFLAGS += ' --fpu=VFPv5_sp' + CFLAGS += ' --dlib_config "' + EXEC_PATH + '/arm/INC/c/DLib_Config_Normal.h"' CFLAGS += ' --silent' - AFLAGS = '' + AFLAGS = DEVICE AFLAGS += ' -s+' AFLAGS += ' -w+' AFLAGS += ' -r' AFLAGS += ' --cpu Cortex-M7' - AFLAGS += ' --fpu None' + AFLAGS += ' --fpu VFPv5_sp' AFLAGS += ' -S' - LFLAGS = ' --config rtthread.icf' - LFLAGS += ' --redirect _Printf=_PrintfTiny' - LFLAGS += ' --redirect _Scanf=_ScanfSmall' - LFLAGS += ' --entry __iar_program_start' - LFLAGS += ' --silent' + if BUILD == 'debug': + CFLAGS += ' --debug' + CFLAGS += ' -On' + else: + CFLAGS += ' -Oh' - CXXFLAGS = CFLAGS + LFLAGS = ' --config "board/linker_scripts/link.icf"' + LFLAGS += ' --entry __iar_program_start' EXEC_PATH = EXEC_PATH + '/arm/bin/' - POST_ACTION = '' + POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' \ No newline at end of file