Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

AUtomating a workspace build from command line

Hi folks,

We do a lot of customer releases and core testing, so I developed a script which builds my qsys system, implements the software, and runs the quartus compile.

If I or my customers need to change any of the firmware, they can become stuck because the script doesn't properly create a nios workspace. When you go to open the workspace folder in eclipse, the workspace is empty and nothing can be imported.

Here is my code. Please suggest how I can integrate creating a nios eclipse workspace into this flow:

# generate the qsys system
echo "**** Generating The QSYS System ****"
qsys-generate system.qsys --synthesis=VERILOG --simulation=VERILOG
# create the nios blank project
echo "**** Creating The NIOS Eclipse Project ****"
nios2-swexample-create --sopc-file=./system.sopcinfo --type=blank_project --elf-name=app_standalone.elf --app-dir=software/app_standalone --bsp-dir=software/app_standalone_bsp
# copy the software files
echo "**** Copying Source Files ****"
find firmware/ -type f -name '*.c' -exec cp --target-directory=software/app_standalone {} \;
find firmware/ -type f -name '*.h' -exec cp --target-directory=software/app_standalone {} \;
# generates the bsp
pushd software/app_standalone_bsp/
echo "**** Creating BSP ****"
create-this-bsp --cpu-name nios2_qsys_0 --no-make
popd
# change linker script here
pushd software/app_standalone_bsp/
echo "**** Modifying Linker Script ****"
more settings.bsp | sed "s/<regionName>onchip_memory2_1<\/regionName>/<regionName>onchip_memory2_0<\/regionName>/" > tmp_settings
mv tmp_settings settings.bsp
echo "**** Regenerating BSP ****"
nios2-bsp-generate-files --bsp-dir . --settings settings.bsp# create-this-bsp --cpu-name nios2_qsys_0 --no-make
popd
# refresh app sources
pushd software/app_standalone/
create-this-app --no-make
echo "**** Refreshing Sources ****"
nios2-app-update-makefile --list-src-files --app-dir .
find . -type f -name '*.c' -exec nios2-app-update-makefile --app-dir . --add-src-files {} \;
popd
pushd software/app_standalone/
echo "**** Creating Elf ****"
make all
make mem_init_generate
find mem_init/ -type f -name '*.hex' -exec cp --target-directory=../../system_sim {} \;
popd
echo "**** Running Quartus Implementation Flow ****"
quartus_sh --64bit --flow compile project.qpf

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Maybe compile the code outside the IDE by just running the compiler and then the linker.

    It is probably easier than using the IDE at all.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for the suggestion dsl.

    I ended up creating a second script:

    
    pushd software/app_standalone/
    echo "**** Creating Elf ****"
    make all
    make mem_init_generate
    find mem_init/ -type f -name '*.hex' -exec cp --target-directory=../../system_sim {} \;
    popd
    echo "**** Running Quartus Implementation Flow ****"
    quartus_sh --64bit --flow compile project.qpf
    

    It works well enough for command line purposes. I actually do like the IDE because of syntax checking and macro expansion, but this will do for very quick and easy changes to a release.