How to upload a nxtOSEK application to the brick
Intro
For an appli "MyAppli", nxtOSEK builds 3 different binaries files:
- MyAppli_ram.bin, is
uploaded in RAM, on bricks without firmware:
- program is lost when the brick is switched off
- useful for quick tests
- on Linux, can be uploaded with fwexec (from libnxt-0.3)
- no tools (simply) available on Windows
- MyAppli_rom.bin, is
uploaded in ROM, on bricks running a minimal firmware provided by
nxtOSEK:
- the minimal firmware can load a single program
- on Windows, can be uploaded with appflash.exe, provided by nxtOSEK
- no tools for Linux
- MyAppli.rxe, is
uploaded in "disk" (actually ROM), on bricks runnig Jon Hansen's
Enhanced Firmware:
- same extension as the standard Lego byte-code, but NOT
COMPATIBLE
- runs on very complete firware, with the same interface as the
Lego firmware
- uploadable on both Linux and Windows with NexTTool(.exe)
The following table
summerizes the results, listing the necessary firware (if any) and the
tools available for uploading on Linux and (Cyg)Win:
|
Firmware
|
Linux
|
(Cyg)Win
|
foo_ram.bin
|
none
|
fwexec
foo_ram.bin
|
no
|
foo_rom.bin
|
nxt_bios_rom.rfw
|
no
|
appflash.exe
|
foo.rxe
|
lms_arm_nbcnxc_128.rfw
|
NeXTTool
/COM=usb -download=foo.rxe
(or with the script: loadrxe foo.rxe)
|
NeXTTool.exe
/COM=usb -download=foo.rxe |
Flashing a firmware
Intro
Firmware files have the extension
".rfw", exemples are:
- nxt_bios_rom.rfw, from
the nxtOSEK distrib (nxtOSEK/ecrobot/bios/)
- lms_arm_nbcnxc_128.rfw,
from Jon Hansen's NeXTTool
- or the standard Lego firmware
If any firmware is installed, the brick
must be reset first:
- press the reset button for 4 seconds (tiny button on the hole
under the USB socket)
- press the orange button, the brick will be in uplod mode (blank
screen, emiting a tic-tic
sound)
On
Linux
Warning:
on Linux, only root can access the brick USB port, thus you have to
"sudo" the commands (if you can!). On recent Debian/Ubuntu
distributions using udev, you can bypath this problem by copying the
ad-hoc rule file 70-lego.rules in /etc/udev/rules.d/.
You can use the fwflash command from libnxt-0.3:
fwflash file.rfw
or the Linux port of the NexTTool program:
NeXTTool /COM=usb -firmware=file.rfw
On Windows
Use NexTTool command line in a windows
or cygwin terminal:
NeXTTool.exe
/COM=usb -firmware=file.rfw
You can also use the Lego Mindstorm graphical interface, if installed
(menu Tools/Upgrade Firmware).
Step by step example: using rom.bin programs on Windows
Warning : only works on Windows XP, not Windows 7
Flash the nxt OSEK bios on Windows
This should be done once:
- Put the brick on the "tic-tic" mode: remove/clear any firmware
running on the brick: push the reset button until the screen becomes
empty, press the orange button: the brick should emit a "tic-tic"
sound, it is then ready to be flashed.
- Flash the nxt OSEK bios with the NeXTTool.exe utility:
NeXTTool.exe /COM=usb
-firmware=nxt_bios_rom.rfw
or simply:
biosflash.bat
Alfter flashing, the
screen should be:
Upload
a rom.bin program
Nxt BIOS should be in the "UPLOAD: READY" mode. Use the appflash.exe
utility to upload the binary, for instance the "helloworld" from the
nxtOSEK samples:
appflash.exe
helloworld_OSEK_rom.bin
The screen should be, form left to right:
To run the application, switch off the brick (dark grey button), then
switch it on (orange button): the "NXT OSEK" splash screen is displayed
for a few seconds, then the brick enters the appli STP/RUN mode. Press
"RUN" to start the program. When the program is running,
Splash screen
|
STP/RUN screen
|
HelloWorld program screen
|
Replace/re-upload a rom.bin program
Once a rom.bin program has been uploaded, it will remains in the rom of
the brick, and then, be executed each time the brick is switched on.
In order to replace it, we have to put the brick in teh "UPLOAD: READY"
mode: put the brick in the "STP/RUN" mode, then press at the same time
the buttons STP and ENTR (left arrow+orange) for a few seconds. The
screen will remain empty for q while, then the "UPLOAD: READY" screen
should appear. Then, upload a program as explained before.