How to avoid upsetting the mini-me....

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
adalove
Posts: 5
Joined: 20 Jul 2013, 15:35

How to avoid upsetting the mini-me....

Post by adalove »

Hi guys,

First post here, so of course it's a (at this moment, hypothetical) question....

1. Let's say that one has a young son who enjoys programming his NXT brick using the built in LOGO style drag and drop interface.

2. Let's say also that oneself has reasonable programming experience, and plans to borrow / commandeer the aforementioned son's NXT for some more serious adult experimentation.

3. Let us also say that one's tool of choice is "GNAT for LEGO Mindstorms NXT Ravenscar Edition". (BTW, the development platform is Windows 7 64 bit pro).

One's only area of concern relates to a section of the GNAT README quoted here:
Programs are to be loaded in RAM. To do that, you must first get rid of
the genuine firmware and thus invalidating the warranties. You need to
do that only once: press the reset button (at the back of the NXT, upper
left corner beneath the USB connector) for more than 5 seconds while the
NXT is turned on. The NXT will audibly tick when it is in firmware mode.
... blah blah blah
The potential issue here is that the aforementioned rug-rat will almost certainly want his NXT brick returned to him in original condition (probably on a semi-regular basis) with it's original factory installed software, while one's own ADA development proceeds in parallel. :roll:
Now, according to the README, GNAT appears to require a complete wipe of the genuine software and firmware. One has no issues with voiding the warranty, but would like to know if it's possible to backup/restore the genuine firmware + software at will, or is this a one-off non-recoverable operation?
(Let's just assume the child is still a little young to be forced to become an ADA programmer, and one would like to avoid having to replace the original brick with a new one. :mrgreen: )

Thanks in advance for any advice, experience you may wish to share.
tabbycatrobots
Posts: 100
Joined: 27 Dec 2010, 19:10

Re: How to avoid upsetting the mini-me....

Post by tabbycatrobots »

Here are several ideas, although not a complete answer as I am not that familiar the various firmwares.
I going to suggest an alternative to GNAT for LEGO Mindstorms NXT Ravenscar Edition; yes ... off on a
tangent but maybe some ideas to consider when starting with the NXT. I use NXC with the the
BRICX Command Center which I find to be a good development environment. NXC is fairly close to
'C' if you have used 'C'. (It is missing pointers, but there are some workarounds.) I find BRICXCC has
a reliable method for updating firmware on the NXT brick. BRICXCC and NXC are free and more info is
at <http://bricxcc.sourceforge.net/>. There are many experts in this forum more familiar with NXC than
I, so I'm sure others can answer your detailed questions. If NXC looks interesting to you, I strongly
suggest the book "Creating Cool Mindstorms NXT Robots" by Daniele Benedettelli and
"LEGO Mindstorms NXT Power Programming Robotics In C" by John C. Hansen.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: How to avoid upsetting the mini-me....

Post by HaWe »

but would like to know if it's possible to backup/restore the genuine firmware + software at will, or is this a one-off non-recoverable operation?
you may load either firmware to the NXT almost as often as you wish. For the Lego Firmware (or John Hansen's Lego-compatible Enhanced Firmware) it's finished within a minute.
adalove
Posts: 5
Joined: 20 Jul 2013, 15:35

Re: How to avoid upsetting the mini-me....

Post by adalove »

doc-helmut wrote:you may load either firmware to the NXT almost as often as you wish. For the Lego Firmware (or John Hansen's Lego-compatible Enhanced Firmware) it's finished within a minute.
Thanks for the replies.

Doc helmut: , can you elaborate at all on the actual process?
It seems from what you're saying that even after wiping the RAM in the procedure above, the original factory firmware is retained in some sort of non-volatile flash memory inside the unit, and is restored easily with some sort of factory reset. (or alternatively, is it a case of downloading a copy of the factory firmware from LEGO's website and doing a firmware update to restore it after some GNAT development has occurred, or perhaps instead there's a way to backup the factory firmware via USB before each installation of GNAT?).


tabbycatrobots: Yes, I have done C, C#, Java, etc, and I am aware of NXC. However, my interest is in experimenting in the area of real-time safety-critical applications, and whilst I think that NXC would be a good choice in terms of there being plenty of experience and support available in the community, in terms of the real-time and safety aspects, I believe that ADA (esp the Ravenscar version) is a better choice. That said, I have no experience of ADA and will have to learn from scratch (not really a problem), but I am still interested in others opinions about the best language choice in this context, so if anyone has experience using either ADA or NXC for verifiable safety-critical applications, I would be very interested in your opinions and/or experiences.

Thanks again.
Last edited by adalove on 21 Jul 2013, 10:40, edited 1 time in total.
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: How to avoid upsetting the mini-me....

Post by h-g-t »

A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: How to avoid upsetting the mini-me....

Post by HaWe »

h-g-t,
thx for providing my BCC setup guide :D

adalove,
I admittedly don't understand all about what you've been writing - it's a little too prosaic for my poor English.

So I'm not sure if the following is what you actually wanted to know, just that:

IIRC, the NXT FW is multi-layered.
The base layer is (CMIIW) a Boot Loader called SAM-BA (ARM Boot Assistant by Atmel), providing basic I/O functions.
Customarily SAM-BA can't be erased (maybe hackers can do it though).
If SAM-BA is active, you may hear a softly clicking noise.
SAM-BA is activated by pressing the reset button > 5s.

SAM-BA is able to load different FW types on top, e.g. the original Lego FW, John Hansen's Enhanced FW, the JAVA VM by LeJos, RobotC, the NX-OS, or the nxtOSEK FW or even others and store it to the flash.

At start-up, some FW releases like Lego keep running on the flash, others are primarily copying parts of it to the RAM to be executed hereinafter.

HTH!
adalove
Posts: 5
Joined: 20 Jul 2013, 15:35

Re: How to avoid upsetting the mini-me....

Post by adalove »

Doc Helmut,

Thank you. The fact that that the firmware is multi-layered is something I did not know, so your post does help my understanding somewhat.
Here are further comments from the GNAT README (which I didn't post earlier to avoid being too verbose, but seems to reflect your comments regarding the load process):
Then you need a SAM-BA (SAM Boot Assistant) loader to load through USB

the binary into to NXT ram. To load your application simply issue:

samba_run <MAIN>

On Windows, USB ports are not available to user-level applications,
including the samba_run program loader. As a result, when invoked,
samba_run will indicate that the NXT is not found, suggesting you
connect it via some USB port. The Windows hardware manager will show
the connected device, and even indicate that it is recognized as a Lego
device in a given mode (e.g., "firmware download" mode), but otherwise
the connected USB device will not be visible.

A third-party application is therefore required to enable the loader to
access the USB port connecting the NXT to the host computer. One such
application is "libusb-win32", available from the following URL:

http://sourceforge.net/apps/trac/libusb-win32/wiki

There are two versions: a "filter" and a "device driver." The "filter"
version is known to work with the GNAT GPL tool-set and is described here.

Download the installer (e.g., "libusb-win32-devel-filter-1.2.2.0.exe")
from the URL above. With the NXT powered and connected to the host via the
USB port, execute the installer. After installation it will automatically
open a dialog box showing all the currently connected USB devices. Select
the port connected to the Lego USB device and press OK. (Obviously you can
run the installed application again later, without re-installing it. To do
so, use the regular Start->"All Programs" menu to find the "LibUSB-Win32"
group and invoke the wizard.)

Once the driver filter is assigned to the USB port, samba-run will be able
to access the USB port.

It looks like the process will be something like:
1. Compile the ADA application on Windows, and make a binary for the NXT platform.
2. Use the SAMBA loader to replace the original Lego FW with my application binary.

The only question is whether, prior to step 2, the SAMBA loader is able to backup a copy of the original Lego FW onto a memory-stick. This could then be reloaded at a later date.
Last edited by adalove on 21 Jul 2013, 11:22, edited 1 time in total.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: How to avoid upsetting the mini-me....

Post by HaWe »

no, no copy needed - the lego FW file is always stored in the Mindstorms install folder and can be re-uploaded to the NXT by a tool when running NXT-G or NXC.
Maybe it's not the best idea to start NXT programming by using sort of exeptional Hummingbird programming environment like ADA though.
But to each his own. :?
adalove
Posts: 5
Joined: 20 Jul 2013, 15:35

Re: How to avoid upsetting the mini-me....

Post by adalove »

Great, then I guess the same tool can be used no matter which language is being run.
Maybe it's not the best idea to start NXT programming by using sort of exeptional Hummingbird programming environment like ADA though.
Yes, perhaps NXC might be easier to start with, with a switch to GNAT only if necessary.
(I don't quite get the comparison between Hummingbird and ADA though).
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: How to avoid upsetting the mini-me....

Post by HaWe »

Hummingbird (Kolibri) is a German idiomatic expression for kinda stuff which is supposed to be extremely uncommon, rare, fancy, exceptional, extravagant and maybe even eccentric :mrgreen:
But do not let yourself be swayed - only dead fish swim against the current 8-)
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 12 guests