For the moment, NIOS2_CPU_SOF must be set with the path to the CPU configuration. We are checking with Altera on whether we can directly check in the binary to the source tree. These scripts depend on tools provided by the Altera Quartus Prime Lite Edition. This is available for free but requires registration on Altera's website to obtain. Change-Id: Ia6cb6c9e43c3e141807a887cb25c47b370a7d8e9 Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
54 lines
935 B
Bash
Executable File
54 lines
935 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
HEX_NAME=${O}/${KERNEL_HEX_NAME}
|
|
ELF_NAME=${O}/${KERNEL_ELF_NAME}
|
|
|
|
GDB_TCP_PORT=1234
|
|
|
|
REQUIRED_PROGRAMS="quartus_cpf quartus_pgm nios2-gdb-server"
|
|
|
|
|
|
for pgm in ${REQUIRED_PROGRAMS}; do
|
|
type -P $pgm > /dev/null 2>&1 || { echo >&2 "$pgm not found in PATH"; exit 1; }
|
|
done
|
|
|
|
do_flash() {
|
|
if [ -z "${NIOS2_CPU_SOF}" ]; then
|
|
echo "Please set NIOS2_CPU_SOF variable to location of CPU .sof data"
|
|
exit 1
|
|
fi
|
|
|
|
${ZEPHYR_BASE}/scripts/support/quartus-flash.py \
|
|
--sof ${NIOS2_CPU_SOF} \
|
|
--kernel ${HEX_NAME}
|
|
}
|
|
|
|
do_debug() {
|
|
do_debugserver &
|
|
|
|
# connect to the GDB server
|
|
${GDB} ${TUI} -ex "target remote :${GDB_TCP_PORT}" ${ELF_NAME}
|
|
}
|
|
|
|
do_debugserver() {
|
|
nios2-gdb-server --tcpport ${GDB_TCP_PORT}
|
|
}
|
|
|
|
|
|
CMD="$1"
|
|
shift
|
|
|
|
case "${CMD}" in
|
|
flash)
|
|
do_flash "$@"
|
|
;;
|
|
debugserver)
|
|
do_debugserver "$@"
|
|
;;
|
|
debug)
|
|
do_debug "$@"
|
|
;;
|
|
esac
|