Compiling and Transfering NXC Code to a NXT-Brick Under Fedora Linux
you must be able to communicate with the NXT Brick for any of the following to be applicable. there are a few “how-to”s available, including this post.
I am using the compiler available at Next Byte Codes & Not eXactly C site. This is a simple package package to “install” (simply copying the executable from the tar/gzip to /usr/local/bin did it for me), and is wonderfully documented.
I am using a modified version of a script provided by Jan-Klaas Kollhof:
#!/bin/sh
set -e
_nbcpath=/PATH/TO/NBC/EXECUTABLE/DIRECTORY
_dirname=`dirname $1`
if [ "${_dirname}" == "." ]; then
_dirname=$(pwd)
fi
_basename=`basename $1 .nxc`
echo "compiling ${_basename}.rxe from ${_basename}.nxc..."
${_nbcpath}/nbc \
-O="${_dirname}/${_basename}.rxe" \
-nbc="${_dirname}/${_basename}.nbc" \
"${_dirname}/${_basename}.nxc"
echo "sending ${_basename}.rxe to brick..."
cd "${_dirname}"
nxt_push "${_basename}.rxe"
as should be apparent, /PATH/TO/NBC/EXECUTABLE/DIRECTORY will need to be altered to suit your environment.
the “-nbc” switch will save the generated “Next Byte Code” to YOUR_CODE_FILE_NAME.nbc. the resulting file is not only interesting to poke around in, but may help when optimizing for size.
currently, I am having some issues with nxt_python, documented here.
Leave a comment