Subject:
|
Enhanced standard NXT firmware updates
|
Newsgroups:
|
lugnet.robotics.nxt
|
Date:
|
Fri, 11 Jan 2008 22:58:50 GMT
|
Viewed:
|
32384 times
|
| |
| |
I have uploaded a pre-release of a new enhanced NBC/NXC firmware (1.06a) which
you may want to try out. It has a new arrop opcode which supports a number of
useful array operations.
OPARR_SUM, OPARR_MEAN, OPARR_SUMSQR, OPARR_STD, OPARR_MIN, OPARR_MAX, and
OPARR_SORT. In the case of OPARR_SORT the output parameter should be an array
of the same type as the input array. In all the other cases it can be any
scalar type large enough to hold the resulting value.
arrop op, dest, src, start, length
I haven't exposed this as an official API function within NXC yet but the
opcodes are added to the NBC compiler. In NXC you can use it via a simple macro
wrapped around an asm block. Like so:
#define ArrayOp(_cmd, _out, _asrc, _idx, _len) asm { arrop _cmd, _out, _asrc,
_idx, _len }
I've also optimized some array move routines which will help in places where one
array is copied to another array. Testing in a tight loop where I copy a 30
element array to another 50000 times took 22.5 seconds with the standard
firmware and only 7.4 seconds with the optimizations in place.
I've also added some new system call functions to more easily expose the
FindFirst and FindNext loader module functions and other functions in that
module. And I've wrapped the Hi-Speed IOMap stuff in some higher-level system
call functions that should make interacting with that port a bit easier (and a
bit faster since it doesn't go through the IOMapRead/IOMapWrite code). I have
not yet exposed these new system call functions in the NBC compiler (or in NXC)
so you can't quite use these yet. I should have a test version of NBC up this
weekend which will have these functions available for use if you tell the
compiler to target the enhanced firmware.
Also added to the enhanced NBC/NXC firmware are preliminary versions of
functions from math.h, including acos, asin, atan, cos, sin, tan, cosh, sinh,
tanh, log, log10, exp, pow, ceil, floor, sqrt, atan2, fmod, and fabs. These are
preliminary since they all operate currently on integer types. The sin, cos,
asin, and acos opcodes currently deal with scaled integer inputs or results
(*100) and degrees instead of radians to match the existing subroutines in
NBC/NXC that Tamas Sorosy wrote. Some of the other functions use the same
scale-by-100 approach as well. Could be a bug or two here also since I haven't
tested the code much yet. All of these are available in the latest build of NBC
(and in NXC via asm blocks). The new test release of BricxCC will syntax
highlight these new opcodes and constants when writing NBC code.
http://bricxcc.sourceforge.net/lms_arm_jch.zip
http://bricxcc.sourceforge.net/test_release.zip
After all these additions the enhanced NBC/NXC firmware still leaves more room
for user files on the NXT than the standard 1.05 firmware.
Please let me know what you think.
John Hansen
|
|
Message has 2 Replies:
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in NXT programmable brick
|
|
|
|