Skip to content

Commit bc48770

Browse files
author
Owen L - SFE
committed
add apollo3 exectuable exporter
this utility copies the .axf file from the build location to the sketch folder when exporting compiled binaries
1 parent 38655d5 commit bc48770

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

platform.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,9 @@ tools.artemis_svl.upload.params.quiet=
180180

181181
# Upload tool pattern
182182
tools.artemis_svl.upload.pattern={pgm} {args}
183+
184+
#### postsavehex hook to also copy out .axf file into the sketch path
185+
executable_exporter={runtime.platform.path}/tools/exporter/linux/apollo3_ee
186+
executable_exporter.macosx={runtime.platform.path}/tools/exporter/macosx/apollo3_ee
187+
executable_exporter.windows={runtime.platform.path}/tools/exporter/windows/apollo3_ee.exe
188+
recipe.hooks.savehex.postsavehex.0.pattern={executable_exporter} -s "{sketch_path}" -b "{build.path}/{build.project_name}.bin" -a "{build.path}/{build.project_name}.axf"

tools/exporter/apollo3_ee.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env python
2+
# File Output Tool for Apollo3 Arduino Core
3+
# Allows users to export compiled executables in a variety of formats
4+
5+
# ***********************************************************************************
6+
#
7+
# Imports
8+
#
9+
# ***********************************************************************************
10+
11+
import argparse
12+
import shutil
13+
import sys
14+
from sys import exit
15+
16+
# ***********************************************************************************
17+
#
18+
# Main function
19+
#
20+
# ***********************************************************************************
21+
def main(args):
22+
print("\n\nApollo3 Arduino Executable Exporter")
23+
24+
if args.format == "axf":
25+
sourcepath = args.axfpath
26+
elif args.format == "bin":
27+
sourcepath = args.binpath
28+
else:
29+
print('"' + str(args.format) + '" is not a valid format - exit')
30+
exit()
31+
32+
shutil.copy2(sourcepath, args.sketchpath)
33+
print("exported " + str(args.axfpath) + " to " + str(args.sketchpath))
34+
35+
exit()
36+
37+
38+
# ******************************************************************************
39+
#
40+
# Main program flow
41+
#
42+
# ******************************************************************************
43+
if __name__ == "__main__":
44+
45+
parser = argparse.ArgumentParser(description="Apollo3 Executable Exporter")
46+
47+
parser.add_argument(
48+
"-s",
49+
"--sketchpath",
50+
dest="sketchpath",
51+
help="path to sketch folder (file will be saved there)",
52+
)
53+
parser.add_argument("-b", "--binpath", dest="binpath", help="path to .bin file")
54+
parser.add_argument("-a", "--axfpath", dest="axfpath", help="path to .axf file")
55+
parser.add_argument(
56+
"-f",
57+
"--format",
58+
dest="format",
59+
default="axf",
60+
help="which format to export (axf, bin)",
61+
)
62+
63+
args = parser.parse_args()
64+
65+
main(args)

tools/exporter/windows/apollo3_ee.exe

3.88 MB
Binary file not shown.

0 commit comments

Comments
 (0)