mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 20:35:17 +03:00
Basics for TBS firmware
This commit is contained in:
parent
bc2e3a272a
commit
1dd12c23a3
3 changed files with 124 additions and 0 deletions
|
@ -53,6 +53,7 @@ option(MODULE_PROTOCOL_LBT "Add support for EU/LBT modules" ON)
|
||||||
option(MODULE_PROTOCOL_FLEX "Add support for non certified FLEX modules" OFF)
|
option(MODULE_PROTOCOL_FLEX "Add support for non certified FLEX modules" OFF)
|
||||||
option(MODULE_PROTOCOL_D8 "Add support for D8 modules" ON)
|
option(MODULE_PROTOCOL_D8 "Add support for D8 modules" ON)
|
||||||
option(FRSKY_RELEASE "Used to build FrSky released firmware" OFF)
|
option(FRSKY_RELEASE "Used to build FrSky released firmware" OFF)
|
||||||
|
option(TBS_RELEASE "Used to build TBS released firmware" OFF)
|
||||||
option(ALLOW_TRAINER_MULTI "Allow multi trainer" OFF)
|
option(ALLOW_TRAINER_MULTI "Allow multi trainer" OFF)
|
||||||
|
|
||||||
# since we reset all default CMAKE compiler flags for firmware builds, provide an alternate way for user to specify additional flags.
|
# since we reset all default CMAKE compiler flags for firmware builds, provide an alternate way for user to specify additional flags.
|
||||||
|
@ -339,6 +340,10 @@ if(JUMPER_RELEASE)
|
||||||
add_definitions(-DJUMPER_RELEASE)
|
add_definitions(-DJUMPER_RELEASE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(TBS_RELEASE)
|
||||||
|
add_definitions(-DTBS_RELEASE)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(FRSKY_RELEASE)
|
if(FRSKY_RELEASE)
|
||||||
add_definitions(-DFRSKY_RELEASE)
|
add_definitions(-DFRSKY_RELEASE)
|
||||||
set(POPUP_LEVEL 3)
|
set(POPUP_LEVEL 3)
|
||||||
|
|
|
@ -36,6 +36,8 @@
|
||||||
#define DISPLAY_VERSION "FrSky"
|
#define DISPLAY_VERSION "FrSky"
|
||||||
#elif defined(JUMPER_RELEASE)
|
#elif defined(JUMPER_RELEASE)
|
||||||
#define DISPLAY_VERSION "JumperRC"
|
#define DISPLAY_VERSION "JumperRC"
|
||||||
|
#elif defined(TBS_RELEASE)
|
||||||
|
#define DISPLAY_VERSION "TBS"
|
||||||
#else
|
#else
|
||||||
#define DISPLAY_VERSION VERSION
|
#define DISPLAY_VERSION VERSION
|
||||||
#endif
|
#endif
|
||||||
|
|
117
tools/build-tbs.py
Executable file
117
tools/build-tbs.py
Executable file
|
@ -0,0 +1,117 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import datetime
|
||||||
|
import os
|
||||||
|
from builtins import NotADirectoryError
|
||||||
|
import shutil
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
|
||||||
|
boards = {
|
||||||
|
"XLITE": {
|
||||||
|
"PCB": "XLITE",
|
||||||
|
},
|
||||||
|
"XLITES": {
|
||||||
|
"PCB": "XLITES",
|
||||||
|
},
|
||||||
|
"X9LITE": {
|
||||||
|
"PCB": "X9LITE",
|
||||||
|
},
|
||||||
|
"X9LITES": {
|
||||||
|
"PCB": "X9LITES",
|
||||||
|
},
|
||||||
|
"X9D": {
|
||||||
|
"PCB": "X9D+",
|
||||||
|
},
|
||||||
|
"X9D+": {
|
||||||
|
"PCB": "X9D+",
|
||||||
|
},
|
||||||
|
"X9D+2019": {
|
||||||
|
"PCB": "X9D+",
|
||||||
|
"PCBREV": "2019",
|
||||||
|
},
|
||||||
|
"X9E": {
|
||||||
|
"PCB": "X9E",
|
||||||
|
},
|
||||||
|
"X7": {
|
||||||
|
"PCB": "X7",
|
||||||
|
},
|
||||||
|
"X7ACCESS": {
|
||||||
|
"PCB": "X7",
|
||||||
|
"PCBREV": "ACCESS",
|
||||||
|
}
|
||||||
|
"X10": {
|
||||||
|
"PCB": "X10",
|
||||||
|
},
|
||||||
|
"X10EXPRESS": {
|
||||||
|
"PCB": "X10",
|
||||||
|
"PCBREV": "EXPRESS",
|
||||||
|
},
|
||||||
|
"X12S": {
|
||||||
|
"PCB": "X12S",
|
||||||
|
},
|
||||||
|
"T16": {
|
||||||
|
"PCB": "X10",
|
||||||
|
"PCBREV": "T16",
|
||||||
|
},
|
||||||
|
"T12": {
|
||||||
|
"PCB": "X7",
|
||||||
|
"PCBREV": "T12",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
translations = [
|
||||||
|
"EN"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def timestamp():
|
||||||
|
return datetime.datetime.now().strftime("%y%m%d")
|
||||||
|
|
||||||
|
|
||||||
|
def build(board, translation, srcdir):
|
||||||
|
cmake_options = " ".join(["-D%s=%s" % (key, value) for key, value in boards[board].items()])
|
||||||
|
cwd = os.getcwd()
|
||||||
|
if not os.path.exists("output"):
|
||||||
|
os.mkdir("output")
|
||||||
|
path = tempfile.mkdtemp()
|
||||||
|
os.chdir(path)
|
||||||
|
command = "cmake %s -DTRANSLATIONS=%s -DTBS_RELEASE=YES -DTEST_BUILD_WARNING=YES %s" % (cmake_options, translation, srcdir)
|
||||||
|
print(command)
|
||||||
|
os.system(command)
|
||||||
|
os.system("make firmware -j6")
|
||||||
|
os.chdir(cwd)
|
||||||
|
index = 0
|
||||||
|
while 1:
|
||||||
|
suffix = "" if index == 0 else "_%d" % index
|
||||||
|
filename = "output/firmware_%s_%s_%s%s.bin" % (board.lower(), translation.lower(), timestamp(), suffix)
|
||||||
|
if not os.path.exists(filename):
|
||||||
|
shutil.copy("%s/firmware.bin" % path, filename)
|
||||||
|
break
|
||||||
|
index += 1
|
||||||
|
shutil.rmtree(path)
|
||||||
|
|
||||||
|
|
||||||
|
def dir_path(string):
|
||||||
|
if os.path.isdir(string):
|
||||||
|
return string
|
||||||
|
else:
|
||||||
|
raise NotADirectoryError(string)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description="Build FrSky firmware")
|
||||||
|
parser.add_argument("-b", "--boards", action="append", help="Destination boards", required=True)
|
||||||
|
parser.add_argument("-t", "--translations", action="append", help="Translations", required=True)
|
||||||
|
parser.add_argument("srcdir", type=dir_path)
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
for board in (boards.keys() if "ALL" in args.boards else args.boards):
|
||||||
|
for translation in (translations if "ALL" in args.translations else args.translations):
|
||||||
|
build(board, translation, args.srcdir)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Add table
Add a link
Reference in a new issue