Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Software
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmytro Levit
Software
Commits
e432fb60
Commit
e432fb60
authored
5 years ago
by
Patrick Robbe
Browse files
Options
Downloads
Patches
Plain Diff
Script to program board via command line
parent
6a76bb69
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Scripts/pcie40_program
+131
-0
131 additions, 0 deletions
Scripts/pcie40_program
with
131 additions
and
0 deletions
Scripts/pcie40_program
0 → 100755
+
131
−
0
View file @
e432fb60
#!/bin/bash
#ug`pcie40_pgm.description`
# This simple tool just serves as a shortcut to the ``quartus_pgm`` command. It is preconfigured with the default JTAG chain definition used in a PCIe40 readout board. _
# NOTE: Programming .rbf files is not yet supported.
JTAG_CABLE
=
1
#ug`pcie40_pgm.synopsis`
# *pcie40_pgm* [-c _jtagcable_] _file.sof_|_file.pof_
function
usage
{
echo
"pcie40_pgm [-c jtagcable] file.sof|file.pof"
>
&2
}
while
getopts
":c:h"
opt
;
do
case
$opt
in
#ug`pcie40_pgm.options`jtagcable
# *-c* _jtagcable_::
# Use given JTAG cable interface. _jtagcable_ is an integer as printed by ``quartus_pgm -l``. The default value is 1.
c
)
JTAG_CABLE
=
${
OPTARG
}
;;
h
)
usage
exit
1
;;
\?
)
echo
"Invalid option: -
${
OPTARG
}
"
>
&2
exit
1
;;
:
)
echo
"Option -
${
OPTARG
}
requires an argument"
>
&2
exit
1
;;
esac
done
# Discard options
shift
$((
$OPTIND
-
1
))
if
[
-z
"
$1
"
]
;
then
usage
exit
1
fi
IMAGE_PATH
=
$1
if
[
!
-e
${
IMAGE_PATH
}
]
;
then
echo
"File does not exist:
${
IMAGE_PATH
}
"
>
&2
exit
1
fi
tmpcdf
=
`
mktemp
-t
pcie40_pgm.XXXXXX.cdf
`
IMAGE_DIRNAME
=
`
dirname
"
${
IMAGE_PATH
}
"
`
/
IMAGE_BASENAME
=
`
basename
"
${
IMAGE_PATH
}
"
`
case
"
${
IMAGE_BASENAME
##*.
}
"
in
#ug`pcie40_pgm.options`sof
# _ _file.sof_::
# The SRAM Object File file to program on the PCIe40 FPGA. _
sof
)
cat
<<
EOF
>
$tmpcdf
JedecChain;
FileRevision(JESD32A);
DefaultMfr(6E);
P ActionCode(Cfg)
Device PartName(10AX115S4F45) Path("
${
IMAGE_DIRNAME
}
") File("
${
IMAGE_BASENAME
}
") MfrSpec(OpMask(1));
P ActionCode(Ign)
Device PartName(5M2210Z) MfrSpec(OpMask(0) SEC_Device(CFI_1GB) Child_OpMask(1 0));
ChainEnd;
AlteraBegin;
ChainType(JTAG);
AlteraEnd;
EOF
;;
#ug`pcie40_pgm.options`pof
# _ _file.pof_::
# The Programmer Object File file to store on the PCIe40 flash memory. _
pof
)
cat
<<
EOF
>
$tmpcdf
JedecChain;
FileRevision(JESD32A);
DefaultMfr(6E);
P ActionCode(Ign)
Device PartName(10AX115S4F45) MfrSpec(OpMask(0));
P ActionCode(Ign)
Device PartName(5M2210Z) MfrSpec(OpMask(0) SEC_Device(CFI_1GB) Child_OpMask(3 1 1 1) PFLPath("
${
IMAGE_PATH
}
"))
ChainEnd;
AlteraBegin;
ChainType(JTAG);
AlteraEnd;
EOF
;;
rbf
)
>
&2
echo
".rbf files are not yet supported"
exit
1
;;
*
)
>
&2
echo
"Unknown file type:
${
IMAGE_BASENAME
}
"
exit
1
;;
esac
#cat $tmpcdf
#ug`pcie40_pgm.env`
# *QUARTUS_ROOTDIR*::
# The path to the Quartus installation to use. If defined, the programmer binary must be located at ``${QUARTUS_ROOTDIR}/bin/quartus_pgm``.
QUARTUS_PGM
=
quartus_pgm
if
[
!
-z
"
${
QUARTUS_ROOTDIR
}
"
]
;
then
QUARTUS_PGM
=
${
QUARTUS_ROOTDIR
}
/bin/quartus_pgm
fi
${
QUARTUS_PGM
}
-c
${
JTAG_CABLE
}
$tmpcdf
pgm_result
=
$?
rm
$tmpcdf
#ug`pcie40_pgm.exit`
# After programming, the tool simply returns the exit status produced by the internal call to the ``quartus_pgm`` command.
exit
$pgm_result
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment