[bsp] fix scons + armcc build error

- add --c99 flag for c code
- add --cpp flag for cpp code
This commit is contained in:
tanek liang 2017-11-24 20:17:37 +08:00
parent e2b5f7a722
commit 02693a2051
2 changed files with 26 additions and 13 deletions

View File

@ -12,12 +12,23 @@ from building import *
TARGET = 'rtthread-%s.%s' % (rtconfig.BOARD_NAME, rtconfig.TARGET_EXT) TARGET = 'rtthread-%s.%s' % (rtconfig.BOARD_NAME, rtconfig.TARGET_EXT)
env = Environment(tools = ['mingw'], if rtconfig.PLATFORM == 'armcc':
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, env = Environment(tools = ['mingw'],
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS, AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc', CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) AR = rtconfig.AR, ARFLAGS = '-rc',
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS,
# overwrite cflags, because cflags has '--C99'
CXXCOM = '$CXX -o $TARGET --cpp -c $CXXFLAGS $_CCCOMCOM $SOURCES')
else:
env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH) env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
Export('RTT_ROOT') Export('RTT_ROOT')

View File

@ -16,9 +16,9 @@ elif CROSS_TOOL == 'keil':
PLATFORM = 'armcc' PLATFORM = 'armcc'
EXEC_PATH = 'D:/Keil_v5' EXEC_PATH = 'D:/Keil_v5'
elif CROSS_TOOL == 'iar': elif CROSS_TOOL == 'iar':
print '================ERROR============================' print('================ERROR============================')
print 'Not support iar yet!' print('Not support iar yet!')
print '=================================================' print('=================================================')
exit(0) exit(0)
if os.getenv('RTT_EXEC_PATH'): if os.getenv('RTT_EXEC_PATH'):
@ -70,12 +70,11 @@ elif PLATFORM == 'armcc':
CFLAGS = DEVICE + ' --apcs=interwork' CFLAGS = DEVICE + ' --apcs=interwork'
AFLAGS = DEVICE AFLAGS = DEVICE
LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread_' + \ LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread_' + \
BOARD_NAME + '.map --scatter rtthread-' + BOARD_NAME + '.sct' BOARD_NAME + '.map --scatter LPC54608J512_flash.scf'
CFLAGS += ' -I' + EXEC_PATH + '/ARM/RV31/INC' CFLAGS += ' -I' + EXEC_PATH + '/ARM/RV31/INC'
LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB' LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB'
CXXFLAGS = CFLAGS
EXEC_PATH += '/arm/bin40/' EXEC_PATH += '/arm/bin40/'
if BUILD == 'debug': if BUILD == 'debug':
@ -83,5 +82,8 @@ elif PLATFORM == 'armcc':
AFLAGS += ' -g' AFLAGS += ' -g'
else: else:
CFLAGS += ' -O2' CFLAGS += ' -O2'
CXXFLAGS = CFLAGS
CFLAGS += ' --c99'
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET' POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'