How to run node js server on Win CE ARM embedded device? - node.js

I have a device that has an ARM processor and runs Win CE OS.
Now I have got a requirement to implement a node js server inside the device.
The same requirement was implemented on another ARM device that was running Linux
Since node is compiled for Linux they were able to run a node js server inside the device.
But there is no Win CE compatible version of node available
Is that not done yet or am i missing something?
I read about Microsoft chakracore, but I didnot understand much.
Does anybody know how to run node on Win CE running devices.
Any kind of leads/help is appreciated. Thanks

Windows CE provides an implementation of the Win32 API that is someway compatible with the full-Win32 version implemented on Windows desktop operating systems.
It also provides C/C++ libraries but, as you know, evil is in the details and those implementations can be considered a subset of those you have on the desktop and missing a single function or feature can force you to re-implement a huge amount of code to work around the limitation.
Windows CE is also meant to run on resource-limited devices with a limited amount of RAM and processing power and, honestly, node.js does not seem to exactly target this kind of platforms.
First I would like to understand if the requirement makes sense and why there is a need to mix a small real-time OS like CE with a huge interpreted and resource-hungry monster like nodejs.

windows CE has not been updated in over 3 years it is unreasonable to expect node.js to work as is on top of CE. windows on arm however (used by windows phone, windows Iot, and the ill fated surface RT) can run this https://github.com/nodejs/node-chakracore. Windows on arm only accepts thumb2 instructions, so you won't be able to use regular node.js.
This is b\c v8 just in time compiler does not produce thumb2 instructions. more reading material here: https://blogs.msdn.microsoft.com/ntdebugging/2014/05/15/understanding-arm-assembly-part-2/

Related

How do I use the "nwjc" versions for Mac and Linux, on Windows?

NW.js has this feature it calls "Protect JavaScript Source Code": https://nwjs.readthedocs.io/en/latest/For%20Users/Advanced/Protect%20JavaScript%20Source%20Code/
The JavaScript source code of your application can be protected by compiling to native code and loaded by NW.js. You only have to distribute the compiled code with your app for production.
JS source code is compiled to native code with the tool nwjc , which is provided in the SDK build.
The compiled code is not cross-platform nor compatible between versions of NW.js. So you’ll need to run nwjc for each of the platforms when you package your application.
I downloaded the SDK distributions for Windows, Mac and Linux, and looked into the files inside them.
The Windows one has a "nwjc.exe" file, ready to be used and works. Good.
But the Mac and Linux ones have no .exe, but instead just a "nwjc" executable. This is obviously for running on macOS and Linux, respectively. Huh?
My used OS is Windows. I am developing my NW.js application on Windows, to be distributed on Windows, Mac and Linux. And I cannot run those Linux/macOS executables on a Windows system. But I have to do so, since they are for some reason not cross-platform.
This seems like a dead end to me. I either have to not "protect" my application (and thus have it stolen/copied/broken/hacked), or buy two separate computers (one expensive Mac and one PC for Linux) and do this step on those. Which of course defeats the whole point of "simple" cross-platform development.
Before you say so, I have tried running Linux in a VM and it's terrible. And Macs cannot even be legally emulated AFAIK.
Most likely, this is going to cause my application to be Windows-only, which is really sad since a major reason for going this route was to have "simple" cross-platformness which "just works".
Is there something I'm missing about this?
PS: I already do "crush" my code with Uglify-JS, before the "protection" stage.
The source protection works by saving a copy of the application as it is currently running in the OS's memory. This means you must run the command on the actual operating system, so it can load the app into memory and then save it as a V8 snapshot (V8 is the JS engine used by Chromium/Node/NW.js).
You can use tools like VirtualBox or VMWare to emulate other OS's on Windows. Getting OSX to run in an emulator is a pain, but there are youtube tutorials to explain how. Linux is very easy though, I'd start there if you are unfamiliar. Though running your application on actual hardware and manually testing in each OS is always best.
If this is too cumbersome, then you may consider not worrying about source protection until later. You can still set up your app for distribution on the other OS's without needing to emulate them if you don't use this feature. Though again, always best to manually test on each OS.

What are ways through which i can develop an application which runs on QNX?

I was wondering around Internet for proper article regarding how to develop a good UI app for QNX . I was able to find things like -
We can use jamaicaVM to port our code developed on java to c .
Following are my questions :
On what platform should i develop the app for QNX .
The app should have proper UI.
This might even help other developer .
You must setup two computers.
One computer so called target machine. In this machine you must install operation system Qnx (qnx microkernel, device drivers, filesystems, libraries and etc). Must important think in this machine is qconn . It is daemon that support network connection with the instrumental machine (please, see 2 item).
Second computer so called instrumental machine . In this machine you must install IDE Qnx Momentics. It is Eclipse based enviroment with gcc, gdb, make and etc. In this computer You will write programms in C or C++ then compile and invoke.
Please, see this http://www.qnx.com/developers/docs/6.4.1/momentics/quickstart/about.html.
Instrumental machine would have any OS with java machine because QNX Momentics is Eclipse based Intergrated Development Enviroment.

How to simulate ThreadX application on Windows OS

I have an application using ThreadX 5.1 as the kernel.
The Image is flashed on to a hardware running an ARM 9 processor.
I'm trying to build a Simulator for the application that can be run on Windows (say XP, 32-bit).
Is there any way I can make it run on Windows, without modifying the entire source code to start calling win32 system calls?
You can build a Simulator for the application that can be run on Windows with "ThreadX for Win32".
"ThreadX for Win32"'s specification is hear.
http://rtos.com/products/threadx/Win32
Yes you can if you are willing to put in the work.
First observe that each threadx system call has an equivalent posix call except for events.
So your threadx program can run as a single process using posix threads, mutexes, etc.
Events can be handled by an external library (there are a few out there).
If you find this difficult in windows then the simplest thing to do is set up a linux vm. I use an ubuntu vm running on Virtual Box. It is very easy to set up. All you will need is the cdt version of eclipse.
Next you need to stub out all of your low level system calls.
This is also easier than you might think. For example, if you have a SPI driver to read and write to flash, you can replace your flash with a big array which is quite easy to work with at this level.
Having said all this, you may get more mileage if your threadx application is modular. Then you can test each module on it's own and you don't need to mess with threads, etc.
As a first approximation this may give you what you need without going the distance to port the whole thing to run under posix.
I have done this successfully in the past and developed a full set of unit tests for a module that allowed me to develop and test it (on my mac) before going to the target. Development is much faster and reliable this way.
Another option you may want to consider is to find a qemu project that supports your microprocessor. With some work you can develop a complete simulator for your platform and then run the real firmware under the emulator.
Good luck.

node.js on Windows. When and why?

Note: There is a similar question called 'installing nodejs on windows machine'.
And various answers explaining how by installing cygwin you can get it working there.
now, I don't want to install cygwin.
I just wish I could run nodejs on a windows box.
I want a "nodejs.exe" to kick off.
Can somebody explain to me
1) why nodejs has not been ported on windows - what are the technical reasons for not providing an exe ?
2) are there any plans to have nodejs on windows ?
I really would like to use it but I can't accept that I have to accept cygwin.
That's just not right.
Update:
For optimum node on windows development I recommend you use the Windows Azure powershell for node.js. It's a powershell optimised for using node, npm and the azure APIs. (the azure apis are optional. I would still use this powershell if I didn't use azure).
When : v0.6
Currently you can get a binary file that (kind of) works under windows. Go ask on the node.js IRC channel. They'll hook you up.
Basically if you read up on node.js road plans you will find that proper windows support is planned for 0.6, we are currently on v0.4.7 and the v0.5.x beta is in full storm.
I won't give an ETA but it's soon.
IRC can be found at the Community links
PDF showing v0.6 road plan
July 2011 update:
#nodejs v0.5.1 is the first to ship with an official Windows executable. We're hoping to get some good feedback.
Microsoft has officially gotten involved with joyent in making node.js run natively on windows.
Running Node under Windows presents several technical problems, mostly related to how Windows' internal design differs from that of Linux and the "change in mindset" required to port Unix applications to Windows.
Background
Linux was designed to be a replacement for Unix, a well-known multitasking operating system, so from day one it has been a multi-user/multi-process, server-oriented operating system. The idea of multiple processes sharing system resources is key to its internal design.
Windows was initially designed as a single-user/single-process desktop operating system and so did not support shared access to system resources. In 1993 Microsoft released a newly redesigned version of Windows--called Windows/NT--to better support the shared resource, multitasking model required by servers, but due to its existing installed base of users, Microsoft required NT to also support all the features of its single-user/single-tasking forebearer.
Windows 7 is a direct descendant of NT and Microsoft's need to support legacy users continues to this day (and in the opinion of many, has severely muddled Windows' internal design.)
Further, Microsoft hired a systems architect named Dave Cutler to design NT. Dave is best known for designing a competitor to Unix called VMS, the internal design of which differs significantly from that of Linux, which has caused a lot of problems for developers interested in porting their Unix programs to Windows.
The clearest example of this "impedance mismatch" between the internal design of Windows and Linux is how they handle event-driven, non-blocking input/output (io) on which Node relies to perform its (apparent) multitasking magic in a single thread of operation.
Linux supports two system-level functions called select() and epoll() which can be used to asynchronously inform a process of changes within the operating system that affect it. Node relies heavily on these functions but Windows doesn't support either, relying instead on "Change Notifications" (mostly) to handle event-driven io.

Can you Run Xcode in Linux?

Can you run Xcode in Linux? Mac OS X was based on BSD Unix, so is it possible?
From what I have heard, there is a MonoDevelop plugin that has an iPhone simulator.
The low-level toolchain for Xcode (the gcc compiler family, the gdb debugger, etc.) is all open source and common to Unix and Linux platforms. But the IDE--the editor, project management, indexing, navigation, build system, graphical debugger, visual data modeling, SCM system, refactoring, project snapshots, etc.--is a Mac OS X Cocoa application, and is not portable.
Nobody suggested Vagrant yet, so here it is, Vagrant box for OSX
vagrant init AndrewDryga/vagrant-box-osx --box-version 0.2.1
vagrant up
# editor's notes:
# - this requires virtualbox
# - version 0.3.1 (2016) is down now, so version 0.2.1 (2015)
# - there are notes for building an image one's self at the site
and you have a MACOS virtual machine. But according to Apple's EULA, you still need to run it on MacOS hardware :D But anywhere, here's one to all of you geeks who wiped MacOS and installed Ubuntu :D
Unfortunately, you can't run the editors from inside using SSH X-forwarding option.
I really wanted to comment, not answer. But just to be precise, OSX is not based on BSD, it is an evolution of NeXTStep. The NeXTStep OS utilizes the Mach kernel developed by CMU. It was originally designed as a MicroKernel, but due to performance constraints, they eventually decided they needed to include the Unix portion of the API into the kernel itself and so a BSD-compatible "server" (originally intended to process requests for BSD-compatible kernel messages) was moved into the kernel, making it a Monolithic kernel. It may be BSD compatible in the programming API, but it is NOT BSD.
The rest of the OS involved ObjectiveC (under arrangements between Stepstone and Richard Stallman of GNU/GCC) with a GUI based on a technology called "Display Postscript" ... sort of like an X Server, but with postscript commands. OS X changed Display Postscript to Display PDF, and increased the general hardware requirements 1000 fold (NeXT could run in 8-16MB, now you need GB).
Due to the close marriage of GCC and Objective C and NeXT, your best bet at running XCode natively under Linux would be to do a port (if you can get ahold of the source - good luck) utilizing the GNUStep libraries. Originally designed for NextStep and then OpenStep compatibility, I've heard they are now more-or-less Cocoa compatible, but I've not played with any of it in almost 2 decades. Of course that only gets you as far as ObjC, not Swift, and I don't know if Apple is going to OpenSource it.
You can run Xcode on Linux NATIVELY using Darling:
Darling is a translation layer that lets you run macOS software on Linux
Once installed you can install Xcode via command-line developer tool following this link.
If you run VMware Player or Workstation (or maybe VirtualBox, I'm not sure if it supports Mac OS X, but may), and then Mac OS X Server (Client can't legally be virtualized). Of course, in this case you are running XCode on OS X, but your host machine could be linux.
If you cannot shell out thousands of dollars for a decent Mac then there is an option to run OSX and XCode in the cloud:
http://www.macincloud.com/
I think you need MonoTouch (not free!) for that plugin.
And no, there is no way to run Xcode on Linux.
Sorry for all the bad news. :)
Nope, you've heard of MonoTouch which is a .NET/mono environment for iPhone development. But you still need a Mac and the official iPhone SDK. And the emulator is the official apple one, this acts as a separate IDE and allows you to not have to code in Objective C, rather you code in c#
It's an interesting project to say the least....
EDIT: apparently, you can distribute on the app store now, early on that was a no go....
The easiest option to do that is running a VM with a OSX copy.
It was weird that no one suggested KVM.
It is gonna provide you almost native performance and it is built-in Linux.
Go and check it out.
you will feel like u are using mac only and then install Xcode there
u may even choose to directly boot into the OSX GUI instead of Linux one on startup
If you really want to use Xcode on linux you could get Virtual Box and install Hackintosh on a VM.
Edit: Virtual Box Guest Additions is not supported with MacOS Movaje. You will want to use VMware
https://www.vmware.com/
https://hackintosh.com/
If you want XCode on another OS, I suggest cloud computing. That way your app is being developed on a Mac and can be submitted to the App Store.
Use quiling framework
For more info check at https://github.com/qilingframework/qiling
I think it is the best
Maybe you can use Virtual Machine and Qiling framework.
If you are planning to use a Mac VM on Linux, check out Docker-OSX. It provides a simple approach to use pre-built Mac VMs with Docker.
To know more about the legality of running Apple software on non-Apple hardware, read this article: Is Hackintosh, OSX-KVM, or Docker-OSX legal?
OSX is based on BSD, not Linux. You cannot run Xcode on a Linux machine.

Resources