Skip to content

Export Compiled AXF #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ artemis.build.f_cpu=48000000L
artemis.build.core=arduino
artemis.build.extra_flags=-DPART_apollo3 -DAM_PACKAGE_BGA -DAM_PART_APOLLO3
artemis.build.includes="-I{build.variant.path}/config" "-I{build.variant.path}/bsp"
artemis.build.preferred_export_format=axf
artemis.build.preferred_export_format=bin
artemis.build.defs=
artemis.build.libs=
artemis.menu.svl_baud.921600=921600
Expand Down Expand Up @@ -76,7 +76,7 @@ amap3redboard.build.core=arduino
amap3redboard.build.includes="-I{build.variant.path}/config" "-I{build.variant.path}/bsp"
amap3redboard.build.ldscript={build.variant.path}/linker_scripts/gcc/artemis_sbl_svl_app.ld
amap3redboard.build.extra_flags=-DPART_apollo3 -DAM_PACKAGE_BGA -DAM_PART_APOLLO3
amap3redboard.build.preferred_export_format=axf
amap3redboard.build.preferred_export_format=bin
amap3redboard.build.defs=
amap3redboard.build.libs=
amap3redboard.menu.svl_baud.921600=921600
Expand Down Expand Up @@ -113,7 +113,7 @@ amap3nano.build.core=arduino
amap3nano.build.includes="-I{build.variant.path}/config" "-I{build.variant.path}/bsp"
amap3nano.build.ldscript={build.variant.path}/linker_scripts/gcc/artemis_sbl_svl_app.ld
amap3nano.build.extra_flags=-DPART_apollo3 -DAM_PACKAGE_BGA -DAM_PART_APOLLO3
amap3nano.build.preferred_export_format=axf
amap3nano.build.preferred_export_format=bin
amap3nano.build.defs=
amap3nano.build.libs=
amap3nano.menu.svl_baud.921600=921600
Expand Down Expand Up @@ -150,7 +150,7 @@ amap3atp.build.core=arduino
amap3atp.build.includes="-I{build.variant.path}/config" "-I{build.variant.path}/bsp"
amap3atp.build.extra_flags=-DPART_apollo3 -DAM_PACKAGE_BGA -DAM_PART_APOLLO3
amap3atp.build.ldscript={build.variant.path}/linker_scripts/gcc/artemis_sbl_svl_app.ld
amap3atp.build.preferred_export_format=axf
amap3atp.build.preferred_export_format=bin
amap3atp.build.defs=
amap3atp.build.libs=
amap3atp.menu.svl_baud.921600=921600
Expand Down Expand Up @@ -187,7 +187,7 @@ amap3thing.build.core=arduino
amap3thing.build.includes="-I{build.variant.path}/config" "-I{build.variant.path}/bsp"
amap3thing.build.ldscript={build.variant.path}/linker_scripts/gcc/artemis_sbl_svl_app.ld
amap3thing.build.extra_flags=-DPART_apollo3 -DAM_PACKAGE_BGA -DAM_PART_APOLLO3
amap3thing.build.preferred_export_format=axf
amap3thing.build.preferred_export_format=bin
amap3thing.build.defs=
amap3thing.build.libs=
amap3thing.menu.svl_baud.921600=921600
Expand Down Expand Up @@ -226,7 +226,7 @@ edge.build.includes="-I{build.variant.path}/config" "-I{build.variant.path}/bsp"
edge.build.libs=
edge.build.extra_flags=-DPART_apollo3 -DAM_PACKAGE_BGA -DAM_PART_APOLLO3
edge.build.ldscript={build.variant.path}/linker_scripts/gcc/ambiq_sbl_app.ld
edge.build.preferred_export_format=axf
edge.build.preferred_export_format=bin

edge.menu.sbl_baud.921600=921600 (Default)
edge.menu.sbl_baud.115200=115200 (TensorFlow Conference Versions)
Expand Down Expand Up @@ -271,7 +271,7 @@ edge2.build.core=arduino
edge2.build.includes="-I{build.variant.path}/config" "-I{build.variant.path}/bsp"
edge2.build.extra_flags=-DPART_apollo3 -DAM_PACKAGE_BGA -DAM_PART_APOLLO3
edge2.build.ldscript={build.variant.path}/linker_scripts/gcc/artemis_sbl_svl_app.ld
edge2.build.preferred_export_format=axf
edge2.build.preferred_export_format=bin
edge2.build.defs=
edge2.build.libs=
edge2.menu.svl_baud.921600=921600
Expand Down
6 changes: 6 additions & 0 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,9 @@ tools.artemis_svl.upload.params.quiet=

# Upload tool pattern
tools.artemis_svl.upload.pattern={pgm} {args}

#### postsavehex hook to also copy out .axf file into the sketch path
executable_exporter={runtime.platform.path}/tools/exporter/linux/apollo3_ee
executable_exporter.macosx={runtime.platform.path}/tools/exporter/macosx/apollo3_ee
executable_exporter.windows={runtime.platform.path}/tools/exporter/windows/apollo3_ee.exe
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"
65 changes: 65 additions & 0 deletions tools/exporter/apollo3_ee.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env python
# File Output Tool for Apollo3 Arduino Core
# Allows users to export compiled executables in a variety of formats

# ***********************************************************************************
#
# Imports
#
# ***********************************************************************************

import argparse
import shutil
import sys
from sys import exit

# ***********************************************************************************
#
# Main function
#
# ***********************************************************************************
def main(args):
print("\n\nApollo3 Arduino Executable Exporter")

if args.format == "axf":
sourcepath = args.axfpath
elif args.format == "bin":
sourcepath = args.binpath
else:
print('"' + str(args.format) + '" is not a valid format - exit')
exit()

shutil.copy2(sourcepath, args.sketchpath)
print("exported " + str(args.axfpath) + " to " + str(args.sketchpath))

exit()


# ******************************************************************************
#
# Main program flow
#
# ******************************************************************************
if __name__ == "__main__":

parser = argparse.ArgumentParser(description="Apollo3 Executable Exporter")

parser.add_argument(
"-s",
"--sketchpath",
dest="sketchpath",
help="path to sketch folder (file will be saved there)",
)
parser.add_argument("-b", "--binpath", dest="binpath", help="path to .bin file")
parser.add_argument("-a", "--axfpath", dest="axfpath", help="path to .axf file")
parser.add_argument(
"-f",
"--format",
dest="format",
default="axf",
help="which format to export (axf, bin)",
)

args = parser.parse_args()

main(args)
Binary file added tools/exporter/linux/apollo3_ee
Binary file not shown.
Binary file added tools/exporter/macosx/apollo3_ee
Binary file not shown.
Binary file added tools/exporter/windows/apollo3_ee.exe
Binary file not shown.