0

I need to get a web service running on the interface control processor for an embedded hardware box. The vendor claims that because it runs Linux I should be able to compile and run whatever I want. However because it's a very hardware constrained platform (400MHz PPC, 128 MB ram) I suspect that's a somewhat optimistic assessment.

Unfortunately, at the moment I can't pry one from the EE's hands for a few days to try testing stuff on the hardware to see what will or won't work. The need to interface with all of the other controllers in the box over a proprietary connector also means that anything on the line of "use an rPI instead" is not a serious option even though it'd make my job much easier.

  • I understand the device has 128MB of memory? How much of that is still free without the hypothetical webservice? – Frank Meerkötter Feb 29 '16 at 20:29
  • @FrankMeerkötter That's waiting for me to get my hands on one briefly and take a look. From what I understand the only thing the embedded vendor has on it is whatever they need to talk to the can/etc busses used by the rest of the hardware an an ancient CGI script running webserver called BOA that would run well on very low end microcontrollers from >15 years ago. So I suspect the limiting factor is how stripped down their Linux install is. I realize at best I can get a "maybe if the OS is lean enough or not a chance" answer prior to looking at the system. – Dan Is Fiddling By Firelight Feb 29 '16 at 20:43
  • Potentially helpful data points: Just running nodejs v4.3 interactively gives me a VmPeak=728920 kB. Running the same version of node using webpack to "compile" a relatively small front-end only project yields about double that. – Brian McFarland Mar 01 '16 at 21:27
  • @BrianMcFarland Thanks for that data point, could you add how much memory did your test system rested at not running node at all? – Dan Is Fiddling By Firelight Mar 01 '16 at 21:49
  • Not easily... that's just on my x86_64 workstation with multiple GB of ram. – Brian McFarland Mar 01 '16 at 21:56
  • 5
    [this post](http://stackoverflow.com/questions/9613528/node-js-with-v8-suitable-for-limited-memory-device) seems to indicate that 64MB is doable but extremely tight/constraining, where 256MB runs just fine. So 128MB with some restrictions on what kind of modules you can run. – Brian McFarland Mar 01 '16 at 22:00
  • I've been fairly happy with Python + cherrypy (if starting fresh, I might use flask since it seems to have "won" the micro framework battle) for a high-level language web framework on embedded stuff where I don't want the high *disk* footprint of node. – Brian McFarland Mar 01 '16 at 22:06

2 Answers2

1

One possibility would be to create a virtual machine with qemu, and put a small linux system like busybox on it.

A bare linux system runs just fine on 8 MB, a minimal Debian 7 system needs about 32 MB ram.

You can start with some linux-ppc image, install node.js, throw out everything you don't need, and then see how it performs with 128 MB.

1

For running, cross-compiling and testing OpenWRT has a great SDK. I`m using it with git and this Makefile:

include $(TOPDIR)/rules.mk

SRC_REPO:=~/Projects/openwrt/projectname/ #git repo

PKG_NAME:=projectname
PKG_VERSION:=$(shell (git ls-remote $(SRC_REPO) | grep refs/heads/master | cut -f 1 | head -c 7))
PKG_RELEASE:=2

PKG_BUILD_DIR:=$(BUILD_DIR)/projectname-$(PKG_VERSION)


include $(INCLUDE_DIR)/package.mk

define Package/projectname
    SECTION:=MyProjects
    CATEGORY:=MyProjects
    TITLE:=configuration utility
    DEPENDS:=+lua-wsapi-base +luafilesystem +lighttpd +lua-cjson +lighttpd-mod-rewrite +lighttpd-mod-cgi
endef

define Package/projectname/description
    configuration utility
endef

define Build/Prepare
    git clone $(SRC_REPO) $(PKG_BUILD_DIR)
endef

define Build/Compile
    cd $(PKG_BUILD_DIR); make clean build dist
endef

define Package/projectname/install
    $(CP) $(PKG_BUILD_DIR)/dist/* $(1)/
endef

$(eval $(call BuildPackage,projectname))

For websites on embedded systems I using AngularJS ( Ubiquiti uses BackboneJS on its new products ). Idea is to move logic from device to browser and control it by api.

For API realisation I use Lua over CGI. Another CGI-compatable languages is PHP-CI (fork of PHP-2 afaik), Perl, Bash, Python or compile C\C++ code.

eri
  • 3,133
  • 1
  • 23
  • 35