build/altera/quartus: Add .svf generation (required for now with openFPGALoader) and create_rbf property.

This commit is contained in:
Florent Kermarrec 2024-11-26 16:11:38 +01:00
parent 10dcc73676
commit 29c5a1db83
2 changed files with 18 additions and 0 deletions

View File

@ -18,6 +18,7 @@ class AlteraPlatform(GenericPlatform):
"flash" : ".rbf" "flash" : ".rbf"
} }
create_rbf = True create_rbf = True
create_svf = True
_supported_toolchains = ["quartus"] _supported_toolchains = ["quartus"]

View File

@ -192,6 +192,8 @@ class AlteraQuartusToolchain(GenericToolchain):
quartus_fit --read_settings_files=off --write_settings_files=off {build_name} -c {build_name} quartus_fit --read_settings_files=off --write_settings_files=off {build_name} -c {build_name}
quartus_asm --read_settings_files=off --write_settings_files=off {build_name} -c {build_name} quartus_asm --read_settings_files=off --write_settings_files=off {build_name} -c {build_name}
quartus_sta {build_name} -c {build_name}""" quartus_sta {build_name} -c {build_name}"""
# Create .rbf.
if self.platform.create_rbf: if self.platform.create_rbf:
if sys.platform in ["win32", "cygwin"]: if sys.platform in ["win32", "cygwin"]:
script_contents += """ script_contents += """
@ -205,6 +207,21 @@ if [ -f "{build_name}.sof" ]
then then
quartus_cpf -c {build_name}.sof {build_name}.rbf quartus_cpf -c {build_name}.sof {build_name}.rbf
fi fi
"""
# Create .svf.
if self.platform.create_svf:
if sys.platform in ["win32", "cygwin"]:
script_contents += """
if exist "{build_name}.sof" (
quartus_cpf -c -q \"12.0MHz\" -g 3.3 -n p {build_name}.sof {build_name}.svf
)
"""
else:
script_contents += """
if [ -f "{build_name}.sof" ]
then
quartus_cpf -c -q \"12.0MHz\" -g 3.3 -n p {build_name}.sof {build_name}.svf
fi
""" """
script_contents = script_contents.format(build_name=build_name, synth_tool=self._synth_tool) script_contents = script_contents.format(build_name=build_name, synth_tool=self._synth_tool)
tools.write_to_file(script_file, script_contents, force_unix=True) tools.write_to_file(script_file, script_contents, force_unix=True)