1 Star 0 Fork 0

codebeautiful/qumi-outer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Sconstruct 2.33 KB
一键复制 编辑 原始数据 按行查看 历史
长沙七叶 提交于 2015-11-17 16:05 . [atomizer]OK
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()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/codebeautiful/qumi-outer.git
[email protected]:codebeautiful/qumi-outer.git
codebeautiful
qumi-outer
qumi-outer
master

搜索帮助