📄 create-this-app
字号:
#!/bin/bash
#
# This script creates the validation application in this directory.
# First, check to see if $SOPC_KIT_NIOS2 environmental variable is set.
# This variable is required for the command line tools to execute correctly.
if [ -z $SOPC_KIT_NIOS2 ]
then
echo Required \$SOPC_KIT_NIOS2 Environmental Variable is not set!
exit 1
fi
# Also make sure that the APP has not been created already. Check for
# existence of Makefile in the app directory
if [ -f ./Makefile ]
then
echo Application has already been created! Delete Makefile if you want to create a new application makefile
exit 1
fi
# We are selecting hal_default bsp because it supports this application.
# Check to see if the hal_default has already been generated by checking for
# existence of the public.mk file. If not, we need to run
# create-this-bsp file to generate the bsp.
if [ -f ../../bsp/hal_default/public.mk ]
then
# If BSP exists, set a path to the BSP directory
BSP_DIR=../../bsp/hal_default
else
# Since BSP doesn't exist, create the BSP then set the path
# Pass any command line arguments passed to this script to the BSP.
pushd ../../bsp/hal_default/ >> /dev/null
./create-this-bsp "$@" || {
echo "create-this-bsp failed"
exit 1
}
popd >> /dev/null
BSP_DIR=../../bsp/hal_default
fi
cmd="nios2-app-generate-makefile \
--bsp-dir $BSP_DIR \
--elf-name validation.elf \
--set OBJDUMP_INCLUDE_SOURCE 1 \
--set APP_CFLAGS_OPTIMIZATION -O3 \
--set APP_CFLAGS_USER_FLAGS \
\" \
-mcustom-fwrx=0xF \
-mcustom-fwry=0xE \
-mcustom-frdxlo=0xC \
-mcustom-frdxhi=0xD \
-mcustom-frdy=0xB \
-mcustom-faddd=0xA \
-mcustom-fsubd=0x9 \
-mcustom-fmuld=0x8 \
-mcustom-fdivd=0x7 \
-mcustom-fadds=0x6 \
-mcustom-fsubs=0x5 \
-mcustom-fmuls=0x4 \
-mcustom-fdivs=0x3 \
-mcustom-ftruncds=0x1B \
-mcustom-fextsd=0x1A \
-mcustom-fixdu=0x19 \
-mcustom-fixdi=0x18 \
-mcustom-floatud=0x17 \
-mcustom-floatid=0x16 \
-mcustom-fcmpned=0x15 \
-mcustom-fcmpeqd=0x14 \
-mcustom-fcmpged=0x13 \
-mcustom-fcmpgtd=0x12 \
-mcustom-fcmpled=0x11 \
-mcustom-fcmpltd=0x10 \
\" \
--src-files main.c hardware_routines.c"
echo "create-this-app: Running \"$cmd\""
$cmd || {
echo "nios2-app-generate-makefile failed"
exit 1
}
cmd="make"
echo "create-this-app: Running \"$cmd\""
$cmd || {
echo "make failed"
exit 1
}
echo
echo "To download and run the application:"
echo " 1. Make sure the board is connected to the system."
echo " 2. Run 'nios2-configure-sof <SOF_FILE_PATH>' to configure the FPGA with the hardware design."
echo " 3. If you have a stdio device, run 'nios2-terminal' in a different shell."
echo " 4. Run 'make download-elf' from the application directory."
echo
echo "To debug the application:"
echo " Import the project into Nios II IDE. Refer to Nios II IDE Documentation for more information."
echo
exit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -