Tuesday, May 6, 2014

Notes: Towards developing with ECL on a Samsung Chromebook

Overview: The Samsung Chromebook
  • Samsung Chromebook model XE303C12-A01US
    • Available at BestBuy
  • Affordable PC platform, running ChromeOS 
    • ChromeOS: Branded edition of ChromiumOS
    • Linux kernel
    • X.org display server
    • Chromium OS security model
  • CPU: Samsung Exynos 5 Dual  SoC (ARM Cortex A15 / armv7l) 
  • Minimal power consumption on DC power supply 
    • may provide up to 9 hours PC runtime with wifi disabled and no USB devices connected
    • may provide aprpox. 6 hours PC runtime with wifi activated and no USB devices connected 
    • approx 2 hour charge time (YMMV)
  • Ultrathin notebook
  • SSD internal storage (16 GB) (eMMC interface may be available via Linux kernel)
  • Internal storage extensible via built-in SD card reader and USB
  • Supports USB 3.0 "SuperSpeed" devices 
  • In Chromebook "developer mode," a Chromebook can run an individual Linux chroot environment, on top of ChromeOS
Overview: ANSI Common Lisp (CLtL2) on ARM
  • CCL
    • Uses CCL's FFIGEN4 (fork of FFIGEN) in developing CCL interfaces onto OS machine code
    • Does not run "out of the box" on Samsung Chromebook
      • "CPU doesn't support required features"
      • Patch available (?), must be cross-compiled
        • Cross Compiling, CCL Wiki
          • Alternate representation:
            ;; arm-xcompile.lisp
            (in-package #:ccl)
            ;; referencing lib/compile-ccl.lisp
            (eval-when (:compile-toplevel :load-toplevel :execute)
               (defparameter *arm-compiler-modules*
               (defparameter *arm-compiler-backend-modules*
                  '(arm-backend arm-vinsns arm2))
               (defparameter *arm-xdev-modules* '(arm-lapmacros ))
            ;; referencing
            ;; http://trac.clozure.com/ccl/wiki/CrossCompiling
            (require-update-modules *arm-compiler-modules* t)
            (require-update-modules *arm-compiler-backend-modules* t)
            (require-update-modules *arm-xdev-modules* t)
            (defpackage "ARM-LINUX")
            (load "ccl:lib;ffi-linuxarm")
            (require-update-modules *arm-xload-modules* t)
            (setup-arm-ftd (find-backend :linuxarm))
            (defun cl-user::do-xcompile ()
              (cross-xload-level-0 :linuxarm :force)
              (cross-compile-ccl :linuxarm t))
          • CCL, in successfully evaluating the lisp form
            (cross-compile-ccl :linuxarm t)
            will generate a file, arm-boot (How to build into armcl* ?)
  • SBCL
    • ARM ports available
    • Must be cross-compiled
  • GCL
    • Available via Ubuntu ports repository for armel
  • ECL
    • Available via Ubuntu ports repository for armel
    • ABI / FFI interface (host OS): libffi 
      • documentation available in TeXinfo format: 
        • libffi source code, doc subdirectory
        • published as HTML documentation in Debian package libffi-dev (Ubuntu  12.04 armel architecture)
    • For documentation about the Lisp interface to FFI in ECL, see also:
      •  ECL Manual, Section II, Chapter, 3, Foreign Function Interface
        • Static FFI and Dynamic FFI
        • For developing Static FFI interfaces, assistance is available for the developer, via the function FFI:C-INLINE
    • For portable FFI, see also: 
    • McCLIM fork for ECL, Github
      • Current status: "No multiple-value SETF" (Multiple-value SETF developed locally, using define-setf-expander.  Regression testing framework needed -- therefore, a substantial design decision onto the fork.)
Overview: Developing ECL for multiple hardware architectures, on the Linux platform
  • Recommendation: Build ECL distribution packages from Ubuntu repository source packages 
    • Possible relevance / use cases:
      • Context: Software distribution and OS imaging
        • Develop an ECL "back-port" for a single Debian-based Linux OS distribution 
        • Distribute ECL development packages, while developing ECL
      • Context: ECL development
        • Install build-dependencies for ECL
        • Cross-compile ECL
    • Shell command (without cross-compile)
      export V=13.5.1+dfsg2 &&
          export DV=ecl-${V} &&
          export PV=ecl_${V}-4.1ubuntu1_i386 &&
          apt-get source ecl && 
          sudo aptitude build-dep ecl &&
          cd ${DV} &&
          debuild -uc -us -b &&
          sudo dpkg -i ../${PV}.deb
  • Multi-architecture development in Debian GNU Linux and Debian-based Linux distributions