Linux: Difference between revisions
Vogtinator (talk | contribs) (Not working on something I don't have/can't test) |
Vogtinator (talk | contribs) (New Classic section, removed Touchpad and Clickpad) |
||
Line 3: | Line 3: | ||
==Status== | ==Status== | ||
=== | ===Classic=== | ||
{| | {| | ||
|- | |- | ||
Line 15: | Line 14: | ||
| SRAM || style="background: green; color: white" | Yes || style="background: green; color: white" | Yes || | | SRAM || style="background: green; color: white" | Yes || style="background: green; color: white" | Yes || | ||
|- | |- | ||
| GPIO || style="background: green; color: white" | Yes || style="background: | | GPIO || style="background: green; color: white" | Yes || style="background: green; color: white" | Yes || Tangrs hasn't pulled it yet | ||
|- | |- | ||
| UART1 || style="background: green; color: white" | Yes || style="background: green; color: white" | Yes || | | UART1 || style="background: green; color: white" | Yes || style="background: green; color: white" | Yes || | ||
Line 37: | Line 36: | ||
| TI-84 Link port || style="background: yellow" | Unknown || style="background: red; color: white" | No || Do we really need this? | | TI-84 Link port || style="background: yellow" | Unknown || style="background: red; color: white" | No || Do we really need this? | ||
|- | |- | ||
| LED || style="background: | | LED || style="background: yellow" | Unknown || style="background: red; color: white" | No || Weird protections stop the LED from being used so there's probably no point in implementing. | ||
|- | |- | ||
| SPI || style="background: green; color: white" | Yes || style="background: red; color: white" | No || | | SPI || style="background: green; color: white" | Yes || style="background: red; color: white" | No || | ||
Line 43: | Line 42: | ||
| USB OTG || style="background: yellow" | Difficult || style="background: red; color: white" | No || Appears to have no builtin driver | | USB OTG || style="background: yellow" | Difficult || style="background: red; color: white" | No || Appears to have no builtin driver | ||
|- | |- | ||
| USB Host || style="background: green; color: white" | Yes || style="background: | | USB Host || style="background: green; color: white" | Yes || style="background: yellow" | USB 1.1 || | ||
|- | |- | ||
| NAND || style="background: yellow" | Unknown || style="background: red; color: white" | No || | | NAND || style="background: yellow" | Unknown || style="background: red; color: white" | No || | ||
Line 54: | Line 53: | ||
|- | |- | ||
| Interrupt controller || style="background: green; color: white" | Yes || style="background: green; color: white" | Yes || | | Interrupt controller || style="background: green; color: white" | Yes || style="background: green; color: white" | Yes || | ||
|- | |- | ||
| Touchpad || style="background: green; color: white" | Yes || style="background: yellow" | No || Driver has to be ported | |||
| Touchpad || style="background: green; color: white" | Yes | |||
|} | |} | ||
Line 123: | Line 69: | ||
| SRAM || style="background: green; color: white" | Yes || style="background: green; color: white" | Yes || | | SRAM || style="background: green; color: white" | Yes || style="background: green; color: white" | Yes || | ||
|- | |- | ||
| GPIO || style="background: green; color: white" | Yes || style="background: | | GPIO || style="background: green; color: white" | Yes || style="background: green; color: white" | Yes || Tangrs hasn't pulled it yet | ||
|- | |- | ||
| UART1 || style="background: green; color: white" | Yes || style="background: green; color: white" | Yes || | | UART1 || style="background: green; color: white" | Yes || style="background: green; color: white" | Yes || | ||
Line 147: | Line 93: | ||
| TI-84 Link port || style="background: yellow" | Unknown || style="background: red; color: white" | No || Do we really need this? | | TI-84 Link port || style="background: yellow" | Unknown || style="background: red; color: white" | No || Do we really need this? | ||
|- | |- | ||
| LED || style="background: | | LED || style="background: yellow" | Unknown || style="background: red; color: white" | No || Weird protections stop the LED from being used so there's probably no point in implementing. | ||
|- | |- | ||
| SPI || style="background: green; color: white" | Yes || style="background: red; color: white" | No || | | SPI || style="background: green; color: white" | Yes || style="background: red; color: white" | No || | ||
Line 153: | Line 99: | ||
| USB OTG || style="background: yellow" | Difficult || style="background: red; color: white" | No || Appears to have no builtin driver | | USB OTG || style="background: yellow" | Difficult || style="background: red; color: white" | No || Appears to have no builtin driver | ||
|- | |- | ||
| USB Host || style="background: green; color: white" | Yes || style="background: | | USB Host || style="background: green; color: white" | Yes || style="background: yellow" | USB 1.1 || | ||
|- | |- | ||
| NAND || style="background: yellow" | Unknown || style="background: red; color: white" | No || | | NAND || style="background: yellow" | Unknown || style="background: red; color: white" | No || |
Revision as of 19:12, 15 December 2012
This page documents the Linux port to the Nspire calculator.
Status
Classic
Hardware | Possible? | Implemented? | Notes |
---|---|---|---|
CPU | Yes | Yes | |
SDRAM | Yes | Yes | |
SRAM | Yes | Yes | |
GPIO | Yes | Yes | Tangrs hasn't pulled it yet |
UART1 | Yes | Yes | |
UART2 | Yes | No | Seems redundant |
Watchdog timer | Yes | No | |
RTC | Yes | No | |
Power management | Yes | No | |
Timer 1 | Yes | No | |
Timer 2 | Yes | Yes | |
Keypad | Yes | Yes | |
LCD Contrast/Backlight | Yes | Basic | |
TI-84 Link port | Unknown | No | Do we really need this? |
LED | Unknown | No | Weird protections stop the LED from being used so there's probably no point in implementing. |
SPI | Yes | No | |
USB OTG | Difficult | No | Appears to have no builtin driver |
USB Host | Yes | USB 1.1 | |
NAND | Unknown | No | |
LCD | Yes | Yes | |
ADC | Yes | Basic | |
DES encryption/SHA generator | Yes | No | |
Interrupt controller | Yes | Yes | |
Touchpad | Yes | No | Driver has to be ported |
CX
Hardware | Possible? | Implemented? | Notes |
---|---|---|---|
CPU | Yes | Yes | |
SDRAM | Yes | Yes | |
SRAM | Yes | Yes | |
GPIO | Yes | Yes | Tangrs hasn't pulled it yet |
UART1 | Yes | Yes | |
UART2 | Yes | No | Seems redundant |
Watchdog timer | Yes | No | |
RTC | Yes | No | |
Power management | Yes | No | |
Timer 1 | Yes | No | |
Timer 2 | Yes | Yes | |
Keypad | Yes | Yes | |
Touchpad | Yes | WIP | Vogtinator is working on it |
LCD Contrast/Backlight | Yes | Basic | |
TI-84 Link port | Unknown | No | Do we really need this? |
LED | Unknown | No | Weird protections stop the LED from being used so there's probably no point in implementing. |
SPI | Yes | No | |
USB OTG | Difficult | No | Appears to have no builtin driver |
USB Host | Yes | USB 1.1 | |
NAND | Unknown | No | |
LCD | Yes | Yes | |
ADC | Yes | Basic | |
DES encryption/SHA generator | Yes | No | |
Interrupt controller | Yes | Yes |
Booting
To have something useful running using Linux on the calculator, a bootloader, kernel and rootfs is needed.
Bootloader
Source code: On github
Nightly builds: tangrs
The bootloader is run from the Nspire OS to load everything into memory and execute the kernel.
Usage instructions can be found in the readme
Copy linuxloader.tns to your calculator and run it. Valid commands are: kernel <filename>: Loads a kernel image into memory initrd <filename>: Loads a ramdisk into memory dump: Prints out the current internal state of the bootloader. Useful for debugging. free: Prints out the total amount of memory provided to the bootloader by the Nspire OS and amounts used by the kernel and ramdisks. cmdline [str]: Get/set the kernel command line parameters. mach [id]: Get/set the machine ID that will be provided to Linux upon booting. Useful for overriding the builtin default value without having to recompile. phys [<start> <size>]: Get/set the address and size of physical memory. Useful for overriding the builtin default value without having to recompile. rdsize [size]: Get/set the size of the ramdisk that Linux should create on boot. Leave at 0x0 for the kernel default. probemem: If this is run on an calculator model that isn't directly supported by the bootloader, you can use this to try and guess how much memory the system has. poke <addr> <value>: Write a word to an arbitrary location in the memory address space. peek <addr>: Read a word from an arbitrary location in the memory address space. boot: Boot kernel. The bootloader is also scriptable. Create a text file containing a list of commands to be executed and change the extension to .ll2.tns, and add the following line to your /documents/ndless/ndless.cfg.tns file. ext.ll2=linuxloader2 Then simply open your script file and the loader will execute all the commands in it. A sample one could look like this: kernel linux/zImage.tns initrd linux/initrd.tns cmdline root=/dev/ram boot This should save a lot of typing everytime you need to boot Linux.
Kernel
Source code: On github
Nightly builds: No public nightlies yet.
To compile the kernel with default options, first clone the github repo then run:
export ARCH=arm make nspire_defconfig make -j cp arch/arm/boot/zImage /path/to/folder/zImage.tns
Rootfs
To have programs actually run on the kernel, you need a root filesystem of some sort containing the userspace programs.
For testing and mucking around, a initrd should be enough. It is possible to build one using Buildroot or look around the Omnimaga thread for a pre-built one.
For a larger root filesystem, you could put a filesystem on a USB drive and add root=/dev/sdaX to your kernel command line. You may also need to add rootdelay=10 to give the USB drive time to initialize.
Quirks and technical details
SRAM
When needing to allocate memory from SRAM when developing for the kernel, use the following functions:
void *sram_alloc(unsigned int size, dma_addr_t *dma_addr) void sram_free(dma_addr_t addr, unsigned int size)
UART
Add ,115200n8 to the end of your tty= command line options to keep it the same as the Nspire OS.
Keypad
The keymaps can be found in arch/arm/mach-nspire/keypad.c. Each array element represents one bit in Keypads.
LCD contrast/backlight
Contrast/Backlight settings can be found at /proc/contrast for classic calculators and /proc/backlight for CX models.
LED
The LED has some hardware protections put on by the Nspire OS. Currently, nobody knows how to bypass this protection and we can't use it. Therefore, there's probably no reason to integrate support into the kernel.
USB Host
USB host support is very shaky. The reason why sometimes USB devices aren't recognised is probably because the USB controller isn't in the right 'mode'. Unfortunately, the method to put the controller into the right 'mode' isn't known right now.
To work around this, insert a USB OTG cable's A end or a USB device into the calculator while still inside the Nspire OS before running the bootloader.
ADC
ADC values can be read at /proc/adc.