How to upload a nxtOSEK program

Intro

For an appli “MyAppli”, nxtOSEK builds 3 different binaries:

  • 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) * uploadable on Linux with t2n (talk2nxt)

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 NeXTTool /COM=usb -download=foo.rxe
or with the script: loadrxe foo.rxe

Flashing a firmware

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)

Linux

On Linux, only root can access the brick USB port, thus you have to “sudo” the commands. 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

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).