补上命令行编译和固件打包:一次出带 Key / 不带 Key 两套,USB 只烧选中的那套。
- Makefile 源文件列表对齐 CodeBlocks,命令行 make 能编过;编完自动打到 ../release/ - 新增 tools/pack_firmware:按版本打出烧录器 / APP UFW / 网关双备份包,带 Key 和不带 Key 各一套 - build.bat key 烧带 Key,默认或不带参数烧 nokey;另一套只生成不写 Flash - 删掉未使用的 version.txt;release/ 不进仓库
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Align Makefile c_SRC_FILES with AC701N.cbp compile units."""
|
||||
from __future__ import print_function
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
root = Path(__file__).resolve().parents[1] / "JBao_JL7016_MOD_FW"
|
||||
cbp = (root / "AC701N.cbp").read_text(encoding="utf-8")
|
||||
mk_path = root / "Makefile"
|
||||
mk = mk_path.read_text(encoding="utf-8")
|
||||
|
||||
cbp_cs = []
|
||||
for m in re.finditer(r'<Unit filename="([^"]+\.c)"', cbp):
|
||||
rel = m.group(1).replace("\\", "/")
|
||||
if (root / rel).is_file():
|
||||
cbp_cs.append(rel)
|
||||
|
||||
# keep order as in cbp, unique
|
||||
seen = set()
|
||||
ordered = []
|
||||
for rel in cbp_cs:
|
||||
if rel not in seen:
|
||||
seen.add(rel)
|
||||
ordered.append(rel)
|
||||
|
||||
block_lines = ["c_SRC_FILES := \\"]
|
||||
for i, rel in enumerate(ordered):
|
||||
if i < len(ordered) - 1:
|
||||
block_lines.append("\t{} \\".format(rel))
|
||||
else:
|
||||
block_lines.append("\t{}".format(rel))
|
||||
block_lines.append("")
|
||||
new_block = "\n".join(block_lines) + "\n"
|
||||
|
||||
pat = re.compile(
|
||||
r"# 需要编译的 \.c 文件\nc_SRC_FILES := \\(?:\n\t[^\n]+)*\n\n",
|
||||
re.M,
|
||||
)
|
||||
if not pat.search(mk):
|
||||
raise SystemExit("c_SRC_FILES block not found")
|
||||
|
||||
mk2 = pat.sub("# 需要编译的 .c 文件\n" + new_block + "\n", mk, count=1)
|
||||
mk_path.write_text(mk2, encoding="utf-8", newline="\n")
|
||||
print("cbp c files:", len(ordered))
|
||||
print("makefile bytes:", mk_path.stat().st_size)
|
||||
Reference in New Issue
Block a user