A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/arduino/arduino-fwuploader/commit/813e19b101a6dc79754348e7c5bc44a524b5d3fb below:

Add precompiled sketches and index generation to make checking the fi… · arduino/arduino-fwuploader@813e19b · GitHub

File tree Expand file treeCollapse file tree 7 files changed

+553

-22

lines changed

Filter options

Expand file treeCollapse file tree 7 files changed

+553

-22

lines changed Original file line number Diff line number Diff line change

@@ -38,19 +38,28 @@ def split_property_and_drop_first_level(s):

38 38

return (k, v)

39 39 40 40 41 -

# Generate and copy loader Sketch binary data for specified board

42 -

def create_loader_data(simple_fqbn, binary):

43 -

loader_path = f"firmwares/loader/{simple_fqbn}/loader{binary.suffix}"

44 -

loader = Path(__file__).parent / loader_path

45 -

loader.parent.mkdir(parents=True, exist_ok=True)

46 -

shutil.copyfile(binary, loader)

41 +

# Generate and copy precompiled Sketch binary data for specified board

42 +

# (sketch type could be either "loader" or "getversion")

43 +

def create_precomp_sketch_data(simple_fqbn, sketch_type):

47 44 48 -

file_hash = sha2(loader)

45 +

sketch_dir = Path(__file__).parent / ".." / "firmwares" / sketch_type / simple_fqbn

46 +

sketch_files = list(sketch_dir.iterdir())

47 +

if len(sketch_files) != 1:

48 +

print(f"Invalid loader files found in {sketch_dir}")

49 +

sys.exit(1)

50 +

sketch_file = sketch_files[0] # lets assume there's only a single file

51 + 52 +

sketch_dest = f"firmwares/{sketch_type}/{simple_fqbn}/{sketch_type}{sketch_file.suffix}"

53 +

sketch_dest_path = Path(__file__).parent / sketch_dest

54 +

sketch_dest_path.parent.mkdir(parents=True, exist_ok=True)

55 +

shutil.copyfile(sketch_file, sketch_dest_path)

56 + 57 +

file_hash = sha2(sketch_dest_path)

49 58 50 59

return {

51 -

"url": f"{DOWNLOAD_URL}/{loader_path}",

60 +

"url": f"{DOWNLOAD_URL}/{sketch_dest}",

52 61

"checksum": f"SHA-256:{file_hash}",

53 -

"size": f"{loader.stat().st_size}",

62 +

"size": f"{sketch_dest_path.stat().st_size}",

54 63

}

55 64 56 65

@@ -235,19 +244,8 @@ def generate_boards_json(input_data, arduino_cli_path):

235 244

for fqbn, data in input_data.items():

236 245

simple_fqbn = fqbn.replace(":", ".")

237 246 238 -

loader_dir = Path(

239 -

"..",

240 -

"firmwares",

241 -

"loader",

242 -

simple_fqbn,

243 -

)

244 -

loader_path = Path(__file__).parent / loader_dir

245 -

loader_files = list(x for x in loader_path.iterdir() if x.is_file())

246 -

if len(loader_files) != 1:

247 -

print(f"Invalid loader files found in {loader_path}")

248 -

sys.exit(1)

249 - 250 -

boards[fqbn]["loader_sketch"] = create_loader_data(simple_fqbn, loader_files[0])

247 +

boards[fqbn]["loader_sketch"] = create_precomp_sketch_data(simple_fqbn, "loader")

248 +

boards[fqbn]["version_sketch"] = create_precomp_sketch_data(simple_fqbn, "getversion")

251 249 252 250

for firmware_version in data["versions"]:

253 251

module = data["moduleName"]

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4