代码拉取完成,页面将自动刷新
from SCons.Script import *
import os
from tools.optionbyte import OptionByte
env_options = {
'CC' : 'sdcc',
'CXX': 'sdcpp',
'LD' : 'sdld',
'AR' : 'sdar',
'RANLIB':'sdranlib',
'OBJCOPY': 'sdobjcopy',
'OBJSUFFIX':'.rel',
'LIBSUFFIX':'.lib',
'LIBPREFIX':'',
'ARFLAGS':'rcs',
}
lib_build_path = 'build/library/'
app_build_path = 'build/app/'
out_build_path = 'build/out/'
app_path = 'src'
lib_src_path = 'library/Libraries/STM8S_StdPeriph_Driver/src'
lib_inc_path = 'library/Libraries/STM8S_StdPeriph_Driver/inc'
lib_srcs = []
for dirName, subDirs, fileList in os.walk(lib_src_path):
if (dirName != lib_src_path):
VariantDir(lib_build_path+os.path.basename(dirName), dirName, duplicate=0)
for fn in fileList:
if '.c' in fn and 'stm8s' not in fn:
lib_srcs.append(lib_build_path+os.path.basename(dirName)+'/'+fn)
#lib_srcs = [lib_build_path + i for i in os.listdir(lib_src_path) if '.c' in i]
app_srcs = [app_build_path+i for i in os.listdir(app_path) if '.c' in i]
sdcc_base_path = os.path.dirname(os.popen('which sdcc').read())+'/../share/sdcc'
sdcc_inc_path = sdcc_base_path+'/include'
sdcc_lib_path = sdcc_base_path+'/lib/stm8'
defines = ['STM8S103', 'SKIP_TRAPS=1']
#VariantDir(lib_build_path, lib_src_path, duplicate=0)
VariantDir(app_build_path, app_path, duplicate=0)
env = Environment(**env_options)
env.Append(ENV = {'PATH': os.environ['PATH']})
env.Append(CPPPATH=[lib_inc_path, app_path, sdcc_inc_path])
env.Append(CPPDEFINES=defines)
env.Append(CPPFLAGS=['-mstm8', '-ps103', '--out-fmt-ihx', '--opt-code-size'])
env.Append(LINKFLAGS=['-mstm8','-ps103', '--out-fmt-ihx', '--opt-code-size'])
env.Append(LIBPATH=[sdcc_lib_path, lib_build_path])
libperi = env.Library(target=lib_build_path+'stm8stdlib.lib', source=lib_srcs)
app = env.Program(target=out_build_path+'qumi.ihx', source=app_srcs, LIBS=[libperi, 'stm8'])
#clean operation
if GetOption("clean"):
import shutil
print "rm ", app_build_path
if (os.path.exists(app_build_path)):
shutil.rmtree(app_build_path)
print 'rm ', lib_build_path
if (os.path.exists(lib_build_path)):
shutil.rmtree(lib_build_path)
print 'rm ', out_build_path
if (os.path.exists(out_build_path)):
shutil.rmtree(out_build_path)
else:
#make option binary file
opt = OptionByte()
opt.mkoption()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。