Last active
August 29, 2015 13:57
-
-
Save simonspa/9909657 to your computer and use it in GitHub Desktop.
Altera NIOS Code Compilation & Flash File Generation (CLI)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to compile NIOS code and produce Altera flash files | |
# Start a nios command line shell: | |
cd $HOME/altera/13.1/nios2eds/nios2_command_shell.sh | |
# Prepare and make the board support package: | |
cd $PROJECT/software/dtb_bsp/ | |
nios2-bsp-generate-files --settings=settings.bsp --bsp-dir=. | |
make | |
# Build the software package: | |
cd ../dtb_expert/ | |
make | |
# Create the flash file: | |
cd ../../FLASH/ | |
./makeimg.sh | |
# This script contains the following calls: | |
#!/bin/sh | |
export QUARTUS_BINDIR=${QUARTUS_ROOTDIR}/bin | |
echo "Fetching SW version..." | |
version=$(grep "sw_version" ../software/dtb_expert/dtb_config.h | tr -dc '[:digit:]' | sed 's/^\(.\{1\}\)/\1./') | |
if [ -e "dtb_v${version}.flash" ] | |
then | |
echo "Flash file for SW version ${version} already exists - forgot to increment version number?" | |
echo "Aborting." | |
else | |
echo "Generating SOF flash file..." | |
sof2flash --input="../dtb/output_files/dtb.sof" --output="dtb.flash" --epcs | |
echo "Generating ELF flash file..." | |
elf2flash --input="../software/dtb_expert/dtb_expert.elf" --output="dtb_expert.flash" --epcs --after="dtb.flash" | |
echo "Merging flash files to dtb_v${version}.flash..." | |
cat dtb.flash dtb_expert.flash > dtb_v${version}.flash | |
rm dtb.flash | |
rm dtb_expert.flash | |
echo "Done." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment