How to upload a nxtOSEK application to the brick


Intro


For an appli "MyAppli", nxtOSEK builds 3 different binaries files:
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:
If any firmware is installed, the brick must be reset first:
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:

  1. 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.
  2. 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:



"UPLOAD: READY" mode




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.