最近在HISI3535平台上要用到node.js,記錄porting上面遇到問題
順便了解一下
更新記錄
item | note |
---|---|
20160203 | 第一版 |
目錄
Node.js
Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine.(出處)
- node.js使用chrome v8解譯器
- V8 is Google’s open source, high performance JavaScript engine.(出處)
- V8 implements ECMAScript as specified in ECMA-262, 5th edition
Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient
- node.js是javascript直譯器,跟lua很像(也是直譯),使用JS語法就可以當成app而且還有一堆package
NodeJS的作者说,他创造NodeJS的目的是为了实现高性能Web服务器,他首先看重的是事件机制和异步IO模型的优越性,而不是JS(出處)
Node.js LTS
Release | LTS End | node / V8 版本 |
---|---|---|
v0.10 | 2016-10-01 | v.0.10.41-rc1 /2012-10-22: Version 3.14.5 |
v0.12 | 2017-04-01 | v.0.12.9 /2014-08-12: Version 3.28.71 |
v4.2.0 | 2018-04-01 | v.4.2.6 / 2015-07-08: Version 4.5.103 |
注意:V8在3.18板之後就不支援VFP2
Cross Compile NodeJS
- Cross Compile V0.10.41-RC1
1 | git clone https://github.com/nodejs/node.git |
- Cross Compile V0.12.9
V8採用3.28.71,即不support VFP2
因此即使用compile成功,但執行但失敗如下,看來還是無使用V0.12.9 node.js(受限於V8 source 改版)
- V8 source
1 | deps/v8/src/base/cpu.cc |
- Hisi3535 runtime error
1 | # ./node-v120-t6 --v8-options | head -2 |
HISI3535 GCC tools採用arch=armv5te產生,但HI3535裡面是armv7-a
在手刪中有強調需要增加(march=armv7-a -mcpu=cortex-a9)
- 手冊中說明
1 | Hi3535无硬浮点单元,文件系统中发布的库都是无硬浮点单元的库。但是,工具链默认的是armv5的指令集,而Hi3535是armv7的指令集,因此请用户注意,所有Hi3535板端代码编译时需要在Makefile里面添加以下命令: |
- gcc tools 使用armv5te產生
1 | root@b682b1efa3d7:/opt/DOCKER-erwin-build-hiv200/work/github/node-org# arm-hisiv200-linux-gcc -v |
- 於板端cpuinfo是無vfpv3 support
1 | # cat /proc/cpuinfo |
arm cross compile">arm cross compile
gcc工具名稱定義
目前手邊工具有:arm-hisiv200-linux-gcc、mips-openwrt-linux-musl-gcc
其名稱定義 arch - vendor - os - eabi
- arch:指名板端CPU架構(ARM/MIPS)
- vendor: 工具提供廠商
- os:板端作業系統(OS)
- eabi:嵌入試應用(Embedded Application Binary Interface)
- ex.
- arm-none-eabi:用於沒有OS(即MCU),因此無提供fork等功能
- arm-none-linux-eabi:用於Linux,使用Glibc等
- arm-none-uclinuxeabli-gcc:用於uCLinux
abi及abihf不同 (arm-linux-gnueabi-gcc 及arm-linux-gnueabihf-gcc)
mfloat-abi=name
Specifies which floating-point ABI to use. Permissible values are: ‘soft’, ‘softfp’ and ‘hard’.soft: causes GCC to generate output containing library calls for floating-point operations
不使FPU硬体進行浮點計算,即使用軟体模式softfp: allows the generation of code using hardware floating-point instructions, but still uses the soft-float calling conventions.
armel(對應gcc: arm-linux-gnuabi-gcc),使用FPU硬体計算,但採用soft return codehard: allows generation of floating-point instructions and uses FPU-specific calling conventions.
armhf(對應gcc: arm-linux-gnueabihf-gcc),使用FPU硬体計算,採用hardware return code
-
- This specifies what floating-point hardware (or hardware emulation) is available on the target. Permissible names are: ‘vfp’, ‘vfpv3’, ‘vfpv3-fp16’, ‘vfpv3-d16’, ‘vfpv3-d16-fp16’, ‘vfpv3xd’, ‘vfpv3xd-fp16’, ‘neon’, ‘neon-fp16’, ‘vfpv4’, ‘vfpv4-d16’, ‘fpv4-sp-d16’, ‘neon-vfpv4’, ‘fpv5-d16’, ‘fpv5-sp-d16’, ‘fp-armv8’, ‘neon-fp-armv8’ and ‘crypto-neon-fp-armv8’.
Floating-point (VFP)定義">Floating-point (VFP)定義
VFP | Description |
---|---|
VFP1 | 已废弃 |
VFP2 | ARMv5TE、ARMv5TEJ 和 ARMv6 架构中 ARM 指令集的可选扩展 |
VFPv2 has 16 64-bit FPU registers | |
VFPv3 or VFPv3-D32 | ARMv7-A 和 ARMv7-R 配置文件中 ARM |
backwards compatible with VFPv2 | |
FPv3 has 32 64-bit FPU registers as standard.. | |
VFPv3-D16 | 16 64-bit FPU registers. Implemented on Cortex-R4 and R5 |
hisi3535: ARM Cortex-a9(即ARMv7)
- ARM Cortex A9 dual core
- 看一下HI3535手冊沒有Support VFPv3
DM8168:ARM Cortex-A8: 930 MHz(即ARMv7)
- ARMv7 ISA plus Thumb-2, Jazelle-X, and media extensions
- NEON floating-point unit
- Little Endian
- Supports Integer and Floating Point (VFPv3)