Code Monkey home page Code Monkey logo

interim's Introduction

Interim OS Bomberjacket Logo

Interim

Interim OS is a radical new operating system with a focus on minimalism. It steals conceptually from Lisp machines (language-based kernel) and Plan 9 (everything is a file system). It boots to a JITting Lisp-like REPL and offers the programmer/user the system's resources as filesystems.

Interim runs on:

  • Raspberry Pi 2 (Broadcom VideoCore4/ARMv7, Bare Metal)
  • ARM5+ Linux (Hosted)
  • Intel/AMD x64 Linux, Mac OS X (Hosted)
  • Intel/AMD x86 Linux, Windows (Hosted, win32 .exe cross compiled from Linux)
  • Motorola 68020+ Amiga OS 3.x+ (Hosted)

Detailed docs are in docs/index.html.

Contact / FAQ / Get Involved

The official IRC channel for development and usage questions is #interim on irc.libera.chat.

If you find bugs, please file an issue in the Github issue tracker.

Architecture

  • Layer 2: Bitmapped Terminal / Editor
  • Layer 1: Sledge Lisp JIT Compiler
  • Layer 0: Platform Interface (Startup code and filesystems)

Design Choices

  • The shell is the editor is the REPL is the language is the compiler.
  • Namespacing allows sandboxing and network transparency.
  • You need only one text encoding: UTF-8.
  • All facilities must be navigable by keyboard.

Building

  1. Get the dependencies. For a (Linux-)hosted version, this is only GCC and SDL1 or SDL2 if you want windowed graphics. Sledge can also use /dev/fb0 instead if available on your platform. If you want to cross-compile for an ARM platform, get arm-none-eabi-gcc and libnewlib-arm-none-eabi.

1b. For a hosted version on Mac OS X, you will need GNU binutils, which can be obtained via homebrew: brew install binutils. You can also get SDL2 via homebrew.

  1. To build the hosted variant, cd to sledge and ./build_x64.sh.

  2. To cross-compile for bare metal, use ./rpi2-build.sh. This will create build/interim-arm.elf.

Running (Hosted)

cd sledge
./sledge

To launch the graphical REPL/Shell:

./sledge < tests/boot2.l

Running (Raspberry Pi 2)

Prepare a bootable SD card with the usual FAT partition that has the Pi-specific boot blobs in it and copy kernel.img into it. You can recycle any other Raspberry OS distribution, i.e. Raspbian for this. Just replace the kernel7.img and delete cmdline.txt. Keyboard input is currently only over UART, so you will probably want to connect a UART->USB cable to another computer and use it to control Interim.

Interim OS Screenshot

Roadmap

  • IEEE 754 double-precision floating point numbers.
  • Vectors.
  • Native string maps (dictionaries) based on the existing sd_hash.
  • JavaScript to Interim Lisp compiler.

Licenses

Interim OS: GNU GPLv3 or later, (C) 2015-2016 Lukas F. Hartmann / @mntmn

Interim OS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

  • newlib: GNU GPLv2, Maintained by Corinna Vinschen, Jeff Johnston / Red Hat Inc.
  • devices/rpi2/uspi: GNU GPLv3, Copyright (C) 2014-2015 R. Stange [email protected]
  • devices/rpi2/rpi-boot: Copyright (C) 2013 by John Cronin [email protected]
  • devices/rpi2/mmu.c for Raspberry Pi 2 adapted from code Copyright (C) 2015 by Goswin von Brederlow, GNU GPLv3+
  • devices/rpi2/fat FAT file system module Copyright by (C) 2013 by ChaN, Free Software / Custom License
  • GNU Unifont: GNU GPLv2+, originally by Roman Czyborra
  • devices/imx233 IMX233 Port contains code from U-Boot, GPLv2+, written by various engineers. See license headers in source files.

Codecs

  • minimp3: GNU LGPL, Copyright (C) 2001, 2002 Fabrice Bellard, (C) 2007 Martin J. Fiedler
  • uPNG: zlib License, Copyright (C) 2005-2010 Lode Vandevenne, (C) 2010 Sean Middleditch
  • NanoJPEG: KeyJ's Research License, Copyright (C) 2014 Martin J. Fiedler

interim's People

Contributors

0xflotus avatar jeapostrophe avatar mntmn avatar neauoire avatar sternenseemann avatar wasamasa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

interim's Issues

Sledge graphical mode on OS X segfaults

With binutils 2.26 and sdl2 2.0.4 I ran:

$ ./sledge < tests/boot2.l
[alloc] cell heap at 0x104fe5000, 2400000 bytes reserved
[compiler] interim knows 55 symbols. enter (symbols) to see them.
[fs] mounted: /framebuffer
...
compiled def spawn-editor
compiled def spawn-repl
Segmentation fault: 11

Wrong stack alignment when calling out to libraries

Sledge crashes for me when I try to use the framebuffer. I am running on a 64-bit Intel architecture, in a Linux environment. The issue seems to be an unaligned address in a MOVAPS instruction that points to the stack, so I'm pretty sure that the issue is that the call to libsdl has badly aligned stack. See the following gdb session:

robryk@sharya-rana ~/V/i/sledge> gdb ./sledge
GNU gdb (GDB) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./sledge...done.
(gdb) r
Starting program: /home/robryk/VC/interim/sledge/sledge 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[compiler] creating global env hash table…
[compiler] init_allocator…

++ cell heap at 0x7fffe892b010, 240000000 bytes reserved
[allocator] initialized.
[compiler] inserting symbols…
[compiler] arithmetic…
[compiler] compare…
[compiler] flow…
[compiler] lists…
[compiler] strings…
[compiler] write/eval…
sledge knows 47 symbols. enter (symbols) to see them.
[fs] mounted: /framebuffer
[fs] mounted: /keyboard
[fs] mounted: /sd
sledge> (eval (read (recv (open "/sd/os/shell.l"))))
[open] found matching fs: /sd for path: /sd/os/shell.l
[open] open_fn: 0x40ae10
filename: os/shell.l
[posixfs] trying to read file of len 13594…
[open] found matching fs: /framebuffer for path: /framebuffer
[open] open_fn: 0x40a956

Program received signal SIGSEGV, Segmentation fault.
0x00007fffdf9da796 in ?? () from /usr/lib/libnvidia-glcore.so.340.76
(gdb) bt
#0  0x00007fffdf9da796 in ?? () from /usr/lib/libnvidia-glcore.so.340.76
#1  0x00007fffdec3f306 in ?? () from /usr/lib/libnvidia-glcore.so.340.76
#2  0x00007fffdec41991 in ?? () from /usr/lib/libnvidia-glcore.so.340.76
#3  0x00007fffdeedc85a in ?? () from /usr/lib/libnvidia-glcore.so.340.76
#4  0x00007fffdec410af in ?? () from /usr/lib/libnvidia-glcore.so.340.76
#5  0x00007fffdec8425c in ?? () from /usr/lib/libnvidia-glcore.so.340.76
#6  0x00007fffdeeddc9c in ?? () from /usr/lib/libnvidia-glcore.so.340.76
#7  0x00007fffdec45266 in ?? () from /usr/lib/libnvidia-glcore.so.340.76
#8  0x00007fffdeed84df in ?? () from /usr/lib/libnvidia-glcore.so.340.76
#9  0x00007fffdec3400d in ?? () from /usr/lib/libnvidia-glcore.so.340.76
#10 0x00007fffdeb1823b in ?? () from /usr/lib/libnvidia-glcore.so.340.76
#11 0x00007fffdeb1ddc5 in ?? () from /usr/lib/libnvidia-glcore.so.340.76
#12 0x00007fffdeb1e43b in ?? () from /usr/lib/libnvidia-glcore.so.340.76
#13 0x00007fffdf46a7cc in ?? () from /usr/lib/libnvidia-glcore.so.340.76
#14 0x00007fffdf477b1f in ?? () from /usr/lib/libnvidia-glcore.so.340.76
#15 0x00007fffdf451d1a in ?? () from /usr/lib/libnvidia-glcore.so.340.76
#16 0x00007ffff7832b3b in ?? () from /usr/lib/libSDL2-2.0.so.0
#17 0x00007ffff782fc3a in ?? () from /usr/lib/libSDL2-2.0.so.0
#18 0x00007ffff7828cfe in ?? () from /usr/lib/libSDL2-2.0.so.0
#19 0x00007ffff7882203 in ?? () from /usr/lib/libSDL2-2.0.so.0
#20 0x00007ffff7882fd0 in ?? () from /usr/lib/libSDL2-2.0.so.0
#21 0x000000000040a899 in sdl_init (fullscreen=0) at ../devices/sdl2.c:34
#22 0x000000000040a964 in fbfs_open () at ../devices/sdl2.c:60
#23 0x000000000040a29c in fs_open (path=0x7fffe89312b0) at stream.c:47
#24 0x00007ffff7fc6014 in ?? ()
#25 0x0000000000000000 in ?? ()
(gdb) x/i $pc
=> 0x7fffdf9da796:  movaps %xmm0,-0x7f(%rax)
(gdb) p/x $rax-0x7f
$1 = 0x7fffffff7ba8

w3m tiling wm

Please make any tiling wmanager.

not it is possible to runt this system on microcontroler too? raspberry pi pico for example?

SDL1 port segfaults on the Open Pandora (ARMv7 TI Cortex-A8)

Hi all,

I just gave the updated master branch a try, as I couldn't apply @wasamasa 's SDL1.2 patch into my local copy of @mntmn 's reform branch (git apply just didn't work).

Good news: compilation no longer crashes on the Pandora :)

cc -g -o sledge --std=gnu99 -Wall -O1 -I. ${CFLAGS} sledge.c reader.c writer.c alloc.c strmap.c stream.c ../devices/sdl.c ../devices/posixfs.c -lm -lSDL -DCPU_ARM -DDEV_SDL -DDEV_POSIXFS

Bad news: the resulting binary still segfaults when trying to run tests/boot2.l. I can see an empty black SDL window (I set the height to 480 in sdl.c btw), but that's it.

/media/Pandora1/dev/interim/sledge$ gdb --args ./sledge tests/boot2.l

[alloc] cell heap at 0x40531008, 1200000 bytes reserved
[compiler] interim knows 55 symbols. enter (symbols) to see them.
[fs] mounted: /framebuffer
[fs] mounted: /keyboard
[fs] mounted: /sd
[open] via /sd: /sd/os/lib.l
[posixfs] trying to read file of len 3323...
[open] via /sd: /sd/os/gfx.l
[posixfs] trying to read file of len 8267...
[mmap] found matching fs: /framebuffer for path: /framebuffer
[open] via /framebuffer: /framebuffer/width
[open] via /framebuffer: /framebuffer/height
[open] via /framebuffer: /framebuffer/depth
("[gfx] fb " (surface 800 480 1 1600 0 0 [ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff] ))
[open] via /framebuffer: /framebuffer
[open] via /sd: /sd/unifont.bin
[posixfs] trying to read file of len 3014656...
[open] via /sd: /sd/os/shell.l
[posixfs] trying to read file of len 6718...
[open] via /keyboard: /keyboard
[open] via /sd: /sd/os/mouse.l
[posixfs] trying to read file of len 1033...

Program received signal SIGSEGV, Segmentation fault.
0x40a4f058 in ?? ()
(gdb) bt
#0 0x40a4f058 in ?? ()
#1 0x40a534e4 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Could this crash be related to the fact that the master branch lacks (AFAIK) the latest commits on the reform branch (i.e even a simple (+ 1 1) crashes on my end)

Could you please have a look ?

Cheers, Sam

Glichtin'

Reproduce:
Eval (buf-load "goa"), try to delete all the text. master branch.

rpi2-build.sh fails to run

Trying to build the RPi2 build in Debian-testing (amd64) and the following error comes up any time I try running the rpi2-build.sh script:

arm-none-eabi-gcc -march=armv7-a -mtune=cortex-a7 -mfloat-abi=hard -Wall -Wno-psabi -fsigned-char -fno-builtin -nostdinc -nostdlib -std=gnu99 -undef -DRASPPI=2 -I ../include -O -c -o uspilibrary.o uspilibrary.c cc1: error: '-mfloat-abi=hard': selected architecture lacks an FPU make: *** [../Rules.mk:49: uspilibrary.o] Error 1

I haven't tried yet, but I wonder if changing the value of -mfloat would allow it to build? It's odd, though; AFAIK there is an FPU on the Pi2.

Missing proper support for configurable keymaps

Quoting an email I got today:

When sledge is run via the example "./sledge < tests/boot2.l", the keyboard alignment appears to be off for the US layout. The exact discontinuity is that the parentheses keys appear to be misaligned in that ')' yields '=' and '(' yields ')', is this documented somewhere or easily configurable?

Cannot boot properly into self-built Raspberry image

After executing

./rpi2-build.sh
./rpi2-release.sh
cp release-rpi2/* /media/boot/
umount /media/boot

and inserting the SD card into the Raspberry Pi, it boots into a white screen and is stuck there. No prompt appears. I can't get serial console working either. More instructions on how to debug this would be welcome, like for example how one can try it out in QEMU.

The following however works:

cd docs
tar -xf interim-0.1.0-rpi.tar.gz
cp release-rpi2/* /media/boot/
umount /media/boot

So I'm fairly sure something about the build process is not quite ideal...

SDL1 port no longer compiles on Open Pandora

Hi,

I'm Sam aka Magic Sam from the Open Pandora community, an handheld computer running GNU/Linux ARM (TI OMAP3). We chatted (with @wasamasa too) on IRC some days ago :)

https://www.pyra-handheld.com/boards/pages/pandora/

I'm trying to build Interim OS' SDL1 port with GCC 8.1, since I'm not too comfortable with SDL2...

My build script reads as follows:

/media/Pandora1/dev/interim/sledge$ cat build_pandora.sh
#!/bin/sh

if [ uname = "Darwin" ] ; then
CFLAGS="${CFLAGS} -I/opt/local/include -L/opt/local/lib -framework Cocoa"
fi

if [ uname -n = "pandora" ] ; then
CFLAGS="${CFLAGS} -I/mnt/utmp/codeblocks/usr/include -L/mnt/utmp/codeblocks/usr/lib"
fi

cc -g -o sledge --std=gnu99 -Wall -O1 -I. ${CFLAGS} sledge.c reader.c writer.c alloc.c strmap.c stream.c ../devices/sdl.c ../devices/posixfs.c -lm -lSDL -DCPU_ARM -DDEV_SDL -DDEV_POSIXFS

Default CFLAGS on the Pandora are:

-ffast-math -O3 -pipe -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -fsingle-precision-constant -fuse-ld=gold -fuse-linker-plugin -fsigned-char

Unfortunately, the compilation fails with this error:

/media/Pandora1/dev/interim/sledge$ ./build_pandora.sh
In file included from sledge.c:9:
compiler_new.c:58:14: warning: ���jit_out��� defined but not used [-Wunused-variable]
static FILE* jit_out;
^~~~~~~
writer.c: In function ���write_���:
writer.c:166:39: warning: format ���%ld��� expects argument of type ���long int���, but argument 4 has type ���uint32_t��� {aka ���unsigned int���} [-Wformat=]
snprintf(buffer, bufsize, "tag:%ld", cell->tag);
~~^ ~~~~~~~~~
%d
../devices/sdl.c: In function ���fbfs_mmap���:
../devices/sdl.c:89:11: error: ���Cell��� {aka ���struct Cell���} has no member named ���addr���; did you mean ���ar���?
fbtest->addr = sdl_get_fb();
^~~~
ar
../devices/sdl.c:90:9: error: ���Cell��� {aka ���struct Cell���} has no member named ���size���
fbtest->size = sdl_get_fbsize();
^~
../devices/sdl.c:91:39: error: ���Cell��� {aka ���struct Cell���} has no member named ���addr���; did you mean ���ar���?
printf("fbtest->addr: %p\n",fbtest->addr);
^~~~
ar
../devices/sdl.c:92:38: error: ���Cell��� {aka ���struct Cell���} has no member named ���size���
printf("fbtest->size: %lx\n",fbtest->size);
^~
../devices/sdl.c:94:18: error: ���Cell��� {aka ���struct Cell���} has no member named ���addr���; did you mean ���ar���?
memset(fbtest->addr,0xff,WIDTHHEIGHTBPP);
^~~~
ar
../devices/sdl.c: In function ���keyfs_read���:
../devices/sdl.c:131:19: error: ���Cell��� {aka ���struct Cell���} has no member named ���addr���; did you mean ���ar���?
((uint8_t*)res->addr)[0] = sdl_key;
^~~~
ar
At top level:
../devices/sdl.c:73:12: warning: ���cursor_y��� defined but not used [-Wunused-variable]
static int cursor_y = 0;
^~~~~~~~
../devices/sdl.c:72:12: warning: ���cursor_x��� defined but not used [-Wunused-variable]
static int cursor_x = 0;
^~~~~~~~
../devices/sdl.c:71:12: warning: ���fb_state��� defined but not used [-Wunused-variable]
static int fb_state = 0;
^~~~~~~~
../devices/posixfs.c: In function ���posixfs_open���:
../devices/posixfs.c:65:56: warning: format ���%zu��� expects argument of type ���size_t���, but argument 2 has type ���off_t��� {aka ���long int���} [-Wformat=]
printf("[posixfs] trying to read file of len %zu...\r\n",len);
~~^ ~~~
%lu

Could you please have a look ?

Best regards,

Sam

Divide by zero crashes

Hello!

I haven't yet gotten this booting on a RaspPi 2 (waiting for it to arrive) but I am having fun running it on my Mac.

I did notice that divide by 0 crashes sledge, and currently only integers are supported.

What kind of numeric support are you planning? Is there a particular place where I could start looking at expanding it?

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.