Operating System

From Hackspire
Jump to navigation Jump to search

This article currently contains notes and ideas jotted down, but may be splitted and reorganized in the future as knowledge becomes more structured and comprehensive.

Booting and resetting

Resetting

The small reset button on the underside which can be pressed with a paper clip or a ball point pen only works when the TI-Nspire is on. It has no effect when the calculator is off.

  • In TI-Nspire mode, it shows a popup telling that the documents and folders have been deleted. The document "Getting started" is also deleted. The OS is not rebooted. The system settings are set to the factory settings.
  • In TI-84 Plus mode, a TI-Nspire (not TI-84 Plus) menu ask to validate the reset. The RAM and the archive memory of the emulated TI-84 Plus will be cleared, and the TI-84 Plus will be reset.

Booting

Booting happens when:

  • a battery is removed and put back after a few seconds
  • after a crash of the TI-Nspire OS
  • when the keypad is changed
  • after an OS update
  • after the maintenance menu (see below)

There is no backup battery as we can find on previous calculator models, so removing at least one AA battery for a few seconds make the RAM lose its content. In TI-Nspire mode removing, and putting back the same keypad doesn't make it boot. In TI-84 Plus mode, removing the keypad automatically stores the RAM image to the flash memory (we can see it process for one second in TI-84 Plus mode when removing the keypad while the calculator is still on). If the TI-84 Plus keypad is put back within a few seconds, the TI-84 Plus will immediately start as after a shutdown. If the keypad is removed for more than a few seconds, the TI-Nspire OS will boot, and the RAM and archive memory of the TI-84 Plus will be restored at its last state. It seems that the exception handler of the TI-Nspire OS systematically forces a reboot: you won't see anything like illegal instruction in a black bar on the screen as there is on TI-68k.

In TI-Nspire mode, the About screen indicates two boots, boot 1 in version 1.1.8916 and boot 2 in version 1.8981. The versions are the same for TI-Nspire CAS. Whether booting in TI-Nspire mode or in TI-84 Plus mode, a progress bar is displayed. At half-way, the screen flashes as if it was reinitialized, then the progress bar continue to be filled up and 2 messages are displayed sequencially: "Preparing file system, please wait..." and "Loading Operating System...". The supposed memory setup during boot up is described in Memory layout. We expect "boot 1" to be what is run during the first half of the progress bar, and "boot 2" during the second half. The boot code exists even without OS, and seems to use 4224KB of storage capacity on a TI-Nspire (see further).

Startup key combinaisons

The boot 1 and boot 2 both accept key combos as startup options. When the TI-Nspire is ready to boot (for example after a battery has been removed and reinstalled), it can be turned on by holding the ON, enter, home, and one of the following keys at the same time (making sure ON is the last key pressed):

Boot 1:

  • B: waits for a boot 2 image to be downloaded through RS232
  • G: waits for a diagnostic image to be downloaded through RS232

Boot 2:

  • X: waits for a test image to be downloaded through RS232
  • P: brings up the maintenance menu. It allow to remove and flash an OS image (which might be a way to bypass the downgrading protection), delete the document folder contents, or do a complete format.

Upgrading the OS

At least as much free space as the OS file size needs to be available for the reception to be able to start. It is possible to send an OS greater than the maximum available space by modifying the size specified in the header, but once all the TI-Nspire memory is filled by the OS transferred, it displays the message "Low memory - Delete some documents to free storage space".

The OS file is received first in background as documents (.tns) would be received, then installed. During the reception, we can see the "Space Used" value of the "Handheld status" screen grow as it does when receiving documents. When the transfer is interrupted by unplugging the USB cable, the partly received OS file seems to be kept in memory for ~10 seconds because the "Space Used" value doesn't change during this short time. The validity of the OS file is checked only after it has been entirely received. During the installation (~30 seconds), a progress bar is displayed. The OS is rebooted after a dialog box indicating the successful installation.

During the few seconds when the OS file is kept in memory after an aborted transfer, making the OS reboot by snapping the TI-84 Plus keypad, then the TI-Nspire keypad, or by replacing a battery restores the "Spaced Used" value to its initial state. On the contrary turning it off then on keeps the OS file in memory.

Note that it is not clear whether the OS file is first kept in RAM or in flash memory. If it is only kept in RAM, this calls into question the meaning of the "Spaced Used" value displayed described in Memory layout.

If the keypad is removed during the installation (not the reception), the TI-Nspire is turned off. Turning it on continues the installation as if it had been suspended. If a battery is removed and reinstalled, the unit reboots, loads for a few seconds as usual, then displays just after the message "Loading Operating System..." the message "Operating System not found. Install OS now." with a warning icon. Turning the TI-Nspire off then on reboots it. "Loading Operating System..." is displayed longer the first time, probably because the integrity of the partly received OS is first checked, then this part is deleted. The recovery mode is the same with the TI-Nspire keypad and the TI-84 Plus one. The Computer Link Software works perfectly in this recovery mode: documents can be send and received, folders can be created an deleted, and an OS file can be received and install. The new OS reboots just after reinstallation.

In the recovery mode the Computer Link Software displays 94KB of "Spaced Used" when all the folders and documents have been deleted, instead of 5666KB, and the same amount of storage capacity in recovery mode and OS mode, which is 28544KB.

Upgrading the boot 2

The boot 2 can be upgraded:

  • During an OS upgrade, if a boot2.img is present in the OS upgrade file (see OS upgrade files)
  • Through RS232, with the X-Modem protocol, by sending the file boot2.img.

The boot image is not check before being written to flash memory but checked after reboot. The signature of the file prevents corrupted or modified boot images from being sent.

A boot 2 image greater than 1358976 bytes (~1327kB, i.e. 10617 128-bit X-Modem packets) cannot be sent: the warning sign is displayed on the Nspire screen, and lsz hangs with "Got 44 for sector ACK". The size of boot2.img v1.4.1571 is 1216KB. (caution, this also could be the result of a streamed image validation by boot 1).

Third-party components

The About screen reports that the following third-party components are integrated to the TI-Nspire OS:

  • Graph & Geometry developed in conjunction with Cabrilog SAS
  • "Data & Statistics" design and developed in conjunction with KCP Technologies
  • Portions of the software are based on Fathom(TM) Dynamic Data and copyright ©2007 KCP Technologies.
  • Nucleus Real-Time Operating System by Mentor Graphics Corp.. Note that the source code of the OS is provided to licensees, so it could have been customized by Texas Instruments. Nucleus RTOS is also a modular OS, it is currently not clear which modules are included.
  • The "Flash Media Manager" FlashFX Pro and the "High-Integrity Transactional File System" Reliance by Datalight Inc. (both compatible with Nucleus RTOS), for a fault-tolerant file system, presented in this success story. Only the NAND flash memory of the TI-Nspire is supported by FlashFX, and not the NOR memory.
  • The compression library zlib
  • The XML parser eXpat
  • The OpenSSL library

Document management

  • The size of a document (.tns) that can be received is only limited by the amount of free space available.
  • Deleting a 20MB document takes between 5 and 10 seconds.
  • Invalid documents can be sent. The Computer Link Software only checks the file extension, and the TI-Nspire doesn't check anything: the PK-Zipped archive can be corruped, or it can contain invalid files (wrong name, XML format, ...). The TI-Nspire only checks the format when opening the document: then it may display an error, but also crash.

Noteworthy characteristics

  • As mentioned in the official guidebooks and as it appears in the resource files of the OS images, the Operating System cannot be downgraded, that is only a version of the OS greater than the current one can be flashed to the TI-Nspire. When a new version of the OS will be available, think twice before sending it: flaws which could have been exploited by our hackers may be fixed... forever.

Reinitializing/Downgrading OS the hard way

In order to Reinitialize or Downgrade the OS you must first totally trashing the current OS and starting fresh. This is done by first downloading a current version OS upgrade through the computer link software. Make sure to disconnect the calculator from the computer once the OS is downloaded. Then as it is going thought the OS upgrade process remove the key pad and swap it with 84 keypad. Then turn it on with the 84 Keypad. Swap the keypads back and turn on the calculator you will get the "Operating System not found. Install OS now." message will appear. Then install what ever OS version you want. The files saved to the N-Spire will not be destroyed or corrupted by this process but the OS is a completely fresh image will require you to configure the system.