1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-18 13:55:12 +03:00

Compile script updated

This commit is contained in:
bsongis 2012-04-20 10:33:11 +00:00
parent 7d7736703f
commit f33c110340
3 changed files with 94 additions and 111 deletions

View file

@ -511,18 +511,25 @@ stamp_header:
@echo "#define SVN_STR \"open9x-r$(SVNREV)\"" >> stamp-open9x.h @echo "#define SVN_STR \"open9x-r$(SVNREV)\"" >> stamp-open9x.h
@cat stamp-open9x.h @cat stamp-open9x.h
stamp: stock-stamp:
@echo "#define DATE_STR \"`date +%Y-%m-%d`\"" > ../stamp-open9x.txt @echo "#define DATE_STR \"`date +%Y-%m-%d`\"" > stamp-open9x-stock.txt
@echo "#define TIME_STR \"`date +%H:%M:%S`\"" >> ../stamp-open9x.txt @echo "#define TIME_STR \"`date +%H:%M:%S`\"" >> stamp-open9x-stock.txt
@echo "#define VERS_STR \"$(MAJ_VER).$(MIN_VER)\"" >> ../stamp-open9x.txt @echo "#define VERS_STR \"$(MAJ_VER).$(MIN_VER)\"" >> stamp-open9x-stock.txt
@echo "#define SVN_VERS \"open9x-r$(SVNREV)\"" >> ../stamp-open9x.txt @echo "#define SVN_VERS \"open9x-r$(SVNREV)\"" >> stamp-open9x-stock.txt
@cat ../stamp-open9x.txt @cat ../stamp-open9x-stock.txt
v4-stamp:
@echo "#define DATE_STR \"`date +%Y-%m-%d`\"" > stamp-open9x-v4.txt
@echo "#define TIME_STR \"`date +%H:%M:%S`\"" >> stamp-open9x-v4.txt
@echo "#define VERS_STR \"$(MAJ_VER).$(MIN_VER)\"" >> stamp-open9x-v4.txt
@echo "#define SVN_VERS \"open9x-r$(SVNREV)\"" >> stamp-open9x-v4.txt
@cat ../stamp-open9x-v4.txt
arm-stamp: arm-stamp:
@echo "#define DATE_STR \"`date +%Y-%m-%d`\"" > ../stamp-open9x-arm.txt @echo "#define DATE_STR \"`date +%Y-%m-%d`\"" > stamp-open9x-arm.txt
@echo "#define TIME_STR \"`date +%H:%M:%S`\"" >> ../stamp-open9x-arm.txt @echo "#define TIME_STR \"`date +%H:%M:%S`\"" >> stamp-open9x-arm.txt
@echo "#define VERS_STR \"$(MAJ_VER).$(MIN_VER)\"" >> ../stamp-open9x-arm.txt @echo "#define VERS_STR \"$(MAJ_VER).$(MIN_VER)\"" >> stamp-open9x-arm.txt
@echo "#define SVN_VERS \"open9x-r$(SVNREV)\"" >> ../stamp-open9x-arm.txt @echo "#define SVN_VERS \"open9x-r$(SVNREV)\"" >> stamp-open9x-arm.txt
@cat ../stamp-open9x-arm.txt @cat ../stamp-open9x-arm.txt
font.lbm: font_6x1.xbm font.lbm: font_6x1.xbm
@ -667,6 +674,7 @@ clean_list :
$(REMOVE) $(TARGET).map $(REMOVE) $(TARGET).map
$(REMOVE) $(TARGET).sym $(REMOVE) $(TARGET).sym
$(REMOVE) $(TARGET).lss $(REMOVE) $(TARGET).lss
$(REMOVE) $(TARGET).lst
$(REMOVE) $(SRC:.c=.s) $(REMOVE) $(SRC:.c=.s)
$(REMOVE) *.o $(REMOVE) *.o
$(REMOVE) *.d $(REMOVE) *.d

View file

@ -377,10 +377,6 @@ extern "C" void TC3_IRQHandler() //capture ppm in at 2MHz
capture = TC1->TC_CHANNEL[0].TC_RA ; capture = TC1->TC_CHANNEL[0].TC_RA ;
(void) TC1->TC_CHANNEL[0].TC_SR ; // Acknowledgethe interrupt (void) TC1->TC_CHANNEL[0].TC_SR ; // Acknowledgethe interrupt
// cli();
// ETIMSK &= ~(1<<TICIE3); //stop reentrance
// sei();
val = (capture - lastCapt) / 2 ; val = (capture - lastCapt) / 2 ;
lastCapt = capture; lastCapt = capture;
@ -389,23 +385,17 @@ extern "C" void TC3_IRQHandler() //capture ppm in at 2MHz
if (ppmInState && ppmInState<=8) { if (ppmInState && ppmInState<=8) {
if(val>800 && val<2200) { if(val>800 && val<2200) {
Temp_captures[ppmInState - 1] = capture ; Temp_captures[ppmInState - 1] = capture ;
g_ppmIns[ppmInState++ - 1] = g_ppmIns[ppmInState++ - 1] = (int16_t)(val - PPM_CENTER)*(g_eeGeneral.PPM_Multiplier+10)/10; //+-500 != 512, but close enough.
(int16_t)(val - 1500)*(g_eeGeneral.PPM_Multiplier+10)/10; //+-500 != 512, but close enough.
} }
else { else {
ppmInState=0; // not triggered ppmInState = 0; // not triggered
} }
} }
else { else {
if (val>4000 && val < 16000) { if (val>4000 && val < 16000) {
ppmInState=1; // triggered ppmInState = 1; // triggered
} }
} }
// cli();
// ETIMSK |= (1<<TICIE3);
// sei();
} }
void start_ppm_capture() void start_ppm_capture()

View file

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
import os, sys, shutil, platform, getpass, subprocess, ftplib, time, threading import os, sys, shutil, platform, getpass, subprocess, zipfile, ftplib, httplib, threading
BINARY_DIR = "../binaries/" BINARY_DIR = "../build/"
options_stock = [[("", "EXT=STD"), ("frsky", "EXT=FRSKY"), ("jeti", "EXT=JETI"), ("ardupilot", "EXT=ARDUPILOT"), ("nmea", "EXT=NMEA")], options_stock = [[("", "EXT=STD"), ("frsky", "EXT=FRSKY"), ("jeti", "EXT=JETI"), ("ardupilot", "EXT=ARDUPILOT"), ("nmea", "EXT=NMEA")],
[("", "HELI=NO"), ("heli", "HELI=YES")], [("", "HELI=NO"), ("heli", "HELI=YES")],
@ -11,6 +11,8 @@ options_stock = [[("", "EXT=STD"), ("frsky", "EXT=FRSKY"), ("jeti", "EXT=JETI"),
[("", "HAPTIC=NO"), ("haptic", "HAPTIC=YES")], [("", "HAPTIC=NO"), ("haptic", "HAPTIC=YES")],
[("", "DSM2=NO"), ("DSM2", "DSM2=PPM")], [("", "DSM2=NO"), ("DSM2", "DSM2=PPM")],
[("", "NAVIGATION=NO"), ("potscroll", "NAVIGATION=POTS")], [("", "NAVIGATION=NO"), ("potscroll", "NAVIGATION=POTS")],
[("", "PPM_CENTER_ADJUSTABLE=NO"), ("ppmca", "PPM_CENTER_ADJUSTABLE=YES")],
[("", "UNITS=METRIC"), ("imperial", "UNITS=IMPERIAL")],
# ("PXX", "PXX=NO", "PXX=YES"), # ("PXX", "PXX=NO", "PXX=YES"),
] ]
@ -19,65 +21,53 @@ options_v4 = [[("", "EXT=FRSKY")],
[("", "TEMPLATES=NO"), ("templates", "TEMPLATES=YES")], [("", "TEMPLATES=NO"), ("templates", "TEMPLATES=YES")],
[("", "SDCARD=NO"), ("sdcard", "SDCARD=YES")], [("", "SDCARD=NO"), ("sdcard", "SDCARD=YES")],
[("", "SOMO=NO"), ("SOMO", "SOMO=YES")], [("", "SOMO=NO"), ("SOMO", "SOMO=YES")],
[("", "PPM_CENTER_ADJUSTABLE=NO"), ("ppmca", "PPM_CENTER_ADJUSTABLE=YES")],
[("", "UNITS=METRIC"), ("imperial", "UNITS=IMPERIAL")],
] ]
options_arm = [[("", "EXT=FRSKY")], options_arm = [[("", "EXT=FRSKY")],
[("", "HELI=NO"), ("heli", "HELI=YES")], [("", "HELI=NO"), ("heli", "HELI=YES")],
[("", "TEMPLATES=NO"), ("templates", "TEMPLATES=YES")], [("", "TEMPLATES=NO"), ("templates", "TEMPLATES=YES")],
[("", "UNITS=METRIC"), ("imperial", "UNITS=IMPERIAL")],
] ]
languages = ["en", "fr", "se"] languages = ["en", "fr", "se"]
#host = "ftpperso.free.fr" #ftp_host = "ftpperso.free.fr"
#user = "open9x" #ftp_user = "open9x"
host = "open9x.freehosting.com" ftp_host = "open9x.freehosting.com"
user = "openxfre" ftp_user = "openxfre"
password = None ftp_directory = "public_html/binaries/"
ftp_connection = None
ftp_tmpdir = None
ftp_lock = threading.Lock()
def openFtp(): def upload(binaries, ext, stamp):
global password if not ftp:
global ftp_connection
global ftp_tmpdir
if password is None:
password = getpass.getpass()
ftp_connection = ftplib.FTP(host, user, password)
if ftp_tmpdir is None:
ftp_tmpdir = "public_html/binaries/temp" + str(int(time.mktime(time.localtime())))
ftp_connection.mkd(ftp_tmpdir)
def closeFtp():
# ftp_connection.rename("binaries/latest", "binaries/r...")
ftp_connection.rename(ftp_tmpdir, "public_html/binaries/latest")
ftp_connection.quit()
def uploadBinary(binary_name):
ftp_lock.acquire()
while 1:
try:
try:
ftp_connection.delete(ftp_tmpdir + '/' + binary_name)
except:
pass
f = file(BINARY_DIR + binary_name, 'rb')
ftp_connection.storbinary('STOR ' + ftp_tmpdir + '/' + binary_name, f)
f.close()
ftp_lock.release()
return return
except:
time.sleep(10) print "Zip creation..."
zip_name = "release.zip"
zip = zipfile.ZipFile(zip_name, "w")
for bin in binaries:
zip.write(BINARY_DIR + bin + "." + ext, bin)
zip.write(BINARY_DIR + stamp, stamp)
zip.close()
print "FTP transfer..."
ftp_connection = ftplib.FTP(ftp_host, ftp_user, ftp_password)
try: try:
ftp_connection.delete(ftp_directory + zip_name)
except:
pass
f = file(zip_name, 'rb')
ftp_connection.storbinary('STOR ' + ftp_directory + zip_name, f)
f.close()
ftp_connection.quit() ftp_connection.quit()
except:
pass print "ZIP extraction...",
try: http_connection = httplib.HTTPConnection("open9x.freehosting.com")
openFtp() http_connection.request("GET", "/binaries/uncompress.php")
except: response = http_connection.getresponse()
pass print response.status, response.reason
os.remove(zip_name)
global_current = 0 global_current = 0
global_count = 0 global_count = 0
@ -109,7 +99,7 @@ def generate(hex, arg, extension, options, languages, maxsize):
if mt: if mt:
cwd = language cwd = language
else: else:
cwd = None cwd = "."
subprocess.Popen(["make", "clean", arg], stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd).wait() subprocess.Popen(["make", "clean", arg], stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd).wait()
p = subprocess.Popen(make_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd) p = subprocess.Popen(make_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd)
p.wait() p.wait()
@ -138,13 +128,7 @@ def generate(hex, arg, extension, options, languages, maxsize):
if size <= maxsize: if size <= maxsize:
binary_name = hex_file + "." + extension binary_name = hex_file + "." + extension
if mt: shutil.copyfile(cwd + "/open9x." + extension, BINARY_DIR + binary_name)
shutil.copyfile(language + "/open9x." + extension, BINARY_DIR + binary_name)
else:
shutil.copyfile("open9x." + extension, BINARY_DIR + binary_name)
if upload:
uploadBinary(binary_name)
result.append(hex_file) result.append(hex_file)
for index, state in enumerate(states): for index, state in enumerate(states):
@ -156,7 +140,12 @@ def generate(hex, arg, extension, options, languages, maxsize):
else: else:
break break
return result # stamp
stamp = "stamp-open9x-%s.txt" % hex.split("-")[1]
subprocess.Popen(["make", hex.split("-")[1] + "-stamp"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd="../src").wait()
shutil.copyfile("../src/" + stamp, BINARY_DIR + stamp)
return result, stamp
class GenerateThread(threading.Thread): class GenerateThread(threading.Thread):
def __init__ (self, hex, arg, extension, options, language, maxsize): def __init__ (self, hex, arg, extension, options, language, maxsize):
@ -169,7 +158,7 @@ class GenerateThread(threading.Thread):
self.maxsize = maxsize self.maxsize = maxsize
def run(self): def run(self):
self.hexes = generate(self.hex, self.arg, self.extension, self.options, [self.language], self.maxsize) self.hexes, self.stamp = generate(self.hex, self.arg, self.extension, self.options, [self.language], self.maxsize)
def multithread_generate(hex, arg, extension, options, languages, maxsize): def multithread_generate(hex, arg, extension, options, languages, maxsize):
if mt: if mt:
@ -182,7 +171,8 @@ def multithread_generate(hex, arg, extension, options, languages, maxsize):
for thread in threads: for thread in threads:
thread.join() thread.join()
result.extend(thread.hexes) result.extend(thread.hexes)
return result stamp = thread.stamp
return result, stamp
else: else:
return generate(hex, arg, extension, options, languages, maxsize) return generate(hex, arg, extension, options, languages, maxsize)
@ -194,11 +184,11 @@ def generate_c9x_list(filename, hexes, extension, stamp, board):
if __name__ == "__main__": if __name__ == "__main__":
upload = "upload" in sys.argv ftp = "ftp" in sys.argv
mt = "mt" in sys.argv and platform.system() != "Windows" mt = "mt" in sys.argv and platform.system() != "Windows"
if upload: if ftp:
openFtp() ftp_password = getpass.getpass()
if mt: if mt:
for lang in languages: for lang in languages:
@ -208,23 +198,18 @@ if __name__ == "__main__":
if platform.system() == "Windows": if platform.system() == "Windows":
# arm board # arm board
hexes = generate("open9x-arm", "PCB=ARM", "bin", options_arm, languages, 262000) hexes, stamp = generate("open9x-arm", "PCB=ARM", "bin", options_arm, languages, 262000)
generate_c9x_list("../../companion9x/src/open9x-arm-binaries.cpp", hexes, "bin", "OPEN9X_ARM_STAMP", "BOARD_ERSKY9X") generate_c9x_list("../../companion9x/src/open9x-arm-binaries.cpp", hexes, "bin", "OPEN9X_ARM_STAMP", "BOARD_ERSKY9X")
upload(hexes, "bin", stamp)
# arm stamp
subprocess.check_output(["make", "PCB=ARM", "arm-stamp"])
else: else:
# stock board # stock board
hexes = multithread_generate("open9x-stock", "PCB=STD", "hex", options_stock, languages, 65530) hexes, stamp = multithread_generate("open9x-stock", "PCB=STD", "hex", options_stock, languages, 65530)
generate_c9x_list("../../companion9x/src/open9x-stock-binaries.cpp", hexes, "hex", "OPEN9X_STAMP", "BOARD_STOCK") generate_c9x_list("../../companion9x/src/open9x-stock-binaries.cpp", hexes, "hex", "OPEN9X_STAMP", "BOARD_STOCK")
upload(hexes, "hex", stamp)
# v4 board # v4 board
hexes = multithread_generate("open9x-v4", "PCB=V4", "hex", options_v4, languages, 262000) hexes, stamp = multithread_generate("open9x-v4", "PCB=V4", "hex", options_v4, languages, 262000)
generate_c9x_list("../../companion9x/src/open9x-v4-binaries.cpp", hexes, "hex", "OPEN9X_STAMP", "BOARD_GRUVIN9X") generate_c9x_list("../../companion9x/src/open9x-v4-binaries.cpp", hexes, "hex", "OPEN9X_STAMP", "BOARD_GRUVIN9X")
upload(hexes, "hex", stamp)
# stamp
subprocess.Popen(["make", "stamp"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd="../src").wait()
if upload:
closeFtp()