The Enhanced NBC/NXC Firmware
The enhanced NBC/NXC firmware combines the work of
and my own enhancements/fixes into one NXT firmware.
You can grab the latest enhanced NBC/NXC sourcecode from the
repository. Support for flashing and using the enhanced NBC/NXC firmware can be had via the
mindboards forums. Firmware flashing support is built
into the Bricx Command Center (BricxCC) and the NeXT Tools for Mac OS X and Linux as well as
the nexttool command line utility.
The list of bug fixes and enhancements is very long. Here's a rough stab at most of what is included:
- Fixes the unbalanced GetProcArray and SetProcArray lengths. The SetProcArray should have 11
function pointers (not 9) in it just like the GetProcArray does. This will fix the bug when
you pass a float type into a function that uses the SetProcArray to set the variable to a new
value. Since the float type is not included in the SetProcArray the result is a locked up brick.
- Fixes the use of floating point constants so that they are marked as floats. Currently the
compiler uses doubles for these constants and as a results links in library code for double to
float conversions that is not necessary.
- Fixes the SET opcode bug where it does not handle 4 byte longs correctly.
- Fixes the bug in cCmdInterpPolyUnop2 where if both types are an array of the same int scalar
type it always performs a MOV operation whether the opcode is OP_MOV or not. This function is
called with several other opcodes in addition to MOV - none of which work correctly on scalar
int arrays due to this bug.
- Fixes the bug in cCmdUnop2Flt where sqrt is called instead of sqrtf, causing unnecessary
double to float library code to be linked into the firmware.
- Fixes the bug in the GETIN opcode where it incorrectly checks the type code for argument
1 twice instead of checking the type code of argument 1 and argument 2.
- Fixes the bug in ARRINIT where it assumes the output array type is compatible with the
initial value type rather than checking both in the if condition.
- Fixes the bug in cCmdBinopFlt where it casts the left and right float inputs as SLONG for
the MOD opcode - resulting in incorrect values in the output. fmodf should be used instead.
- Fixes the REPLACE opcode bug which breaks support for multi-dimensional arrays. As written
it only works for arrays with 1 dimension.
- Fixes the STRINGTONUM opcode so that it works correctly with either int or float values in the string.
- Fixes the bug in cCmdLSCalcBytesReady so that it handles 16 byte IIC responses rather than a maximum of 15.
- Fixes the partial/wrong implementation of CommHSWrite, CommHSCheckStatus, and CommHSRead system call functions.
- Fixes the incorrect return type (should be UWORD rather than SBYTE) for the newly added
CommBTConnection and CommBTOnOff system call functions.
- Fixes the bug that limits RIC parameters to 16 instead of 256 which should be supported
(the IMG_SYMB_ARG mask should be 0x00FF rather than 0x000F).
- Fixes the missing RIC Circle opcode.
- Fixes the incorrect size (IMG_OP_LINE vs IMG_OP_RECT) checked for the RIC Rectangle opcode.
- Fixes the bug in cCommInterpreteCmd (in the POLLCMD case) where the high speed output pointer
is limited to the size of the USB buf (64) rather than the size of the hig speed buf (128).
- Support multiple ports in the SetOutputState direct command instead of just one
or 0xFF == all ports. I have simple code I can provide which supports 0x03 or
0xFC = AB, 0x04 or 0xFD = AC, 0x05 or 0xFE = BC, and 0x06 or 0xFF = ABC.
- Add support for a user-definable program abort flag (rather than hard coded
as BTN1 state == PRESSED_EV) so that you can use the 4th button in a user program.
- Enable SETOUT opcode to handle scalar values for multiple ports in addition to
specifying multiple ports via a byte array containing the port values (e.g.,
0x03 == AB, 0x04 == AC, 0x05 == BC, and 0x06 == ABC).
- Allow user programs to write/read more than 64 bytes at a time via the internal
IOMapWrite and IOMapRead system calls.
- Extensive enhancements to drawing code, including support for polyline/polygon and
ellipse both with API functions and in RIC files.
- Support for RIC-based fonts.
- Support for precise position based motor regulation (written by Nicolas Schodet)
- Support for fast I2C communication
- Support for RS485 baud/mode/uartmode setting (i.e., 9600, N81, RS232).
- Support for pausing a running program, and single-stepping through the code
- Enhanced random number generator
- Support for low level input port digital pin manipulation
- Support for a FileTell functionality (to check position of read pointer in a file).
- Memory manager system call function for checking memory usage or forcing a dataspace compaction.
- Support for DATA_MODE_NXT over RS485 so that the firmware automatically handles
direct and system commands sent via RS485
- Support for multi-NXT addressing via RS485 when in the new DATA_MODE_NXT data mode
- Native opcodes for (nearly) every math.h standard C library function such as sin,
cos, tan, asin, acos, atan, log, pow, etc...
- Opcodes for low level direct memory addressing (reladdr, and addrex)
- Support for getting/setting the display contrast.
- Support for bitwise negation (complement)
- Support for file system iteration via new system calls (FileFindFirst, FileFindNext, etc...)
- Native opcodes for stopping another thread/task, formatting a number into a
string (simple printf style opcode)
- Native opcode for several fast array operations (min, max, mean, sort, etc...)
Probably more fixes and enhancements that I have forgotten.
Download the latest firmware binary from the test releases folder on the
BricxCC website. You can compile the source code using the
IAR Embedded Workbench for LEGO MINDSTORMS. This
is a free edition of the IAR Embedded Workbench. You can also download the standard LEGO NXT
from the LEGO
support site if you desire.