$ git clone https://github.com/spiriou/incubator-nuttx-apps apps
$ git clone https://github.com/apache/incubator-nuttx
$ cd apps
$ git checkout -b iotjs origin/iotjs
Branch 'iotjs' set up to track remote branch 'iotjs' from 'origin'.
Switched to a new branch 'iotjs'
$ cd ../incubator-nuttx
Config:
CONFIG_ARCH_FPU is not set
CONFIG_NSH_ARGCAT is not set
CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_NSH_CMDPARMS is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="stm32f4discovery"
CONFIG_ARCH_BOARD_STM32F4_DISCOVERY=y
CONFIG_ARCH_BUTTONS=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32F407VG=y
CONFIG_ARCH_SETJMP_H=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_FS_FAT=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_INTELHEX_BINARY=y
CONFIG_IOTJS=y
CONFIG_LIBUV=y
CONFIG_LIBUV_FS=y
CONFIG_LIBUV_TCP=y
CONFIG_LIBUV_TIMER=y
CONFIG_LIBUV_WQ=y
CONFIG_MAX_TASKS=16
CONFIG_MM_REGIONS=2
CONFIG_NET=y
CONFIG_NETDEV_LATEINIT=y
CONFIG_NET_SOCKOPTS=y
CONFIG_NET_TCP=y
CONFIG_NET_TCPBACKLOG=y
CONFIG_NET_TCP_KEEPALIVE=y
CONFIG_NFILE_DESCRIPTORS=8
CONFIG_NFILE_STREAMS=8
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=64
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_STM32_JTAG_SW_ENABLE=y
CONFIG_STM32_PWR=y
CONFIG_STM32_SPI1=y
CONFIG_STM32_USART2=y
CONFIG_SYSTEM_NSH=y
CONFIG_USART2_RXBUFSIZE=128
CONFIG_USART2_SERIAL_CONSOLE=y
CONFIG_USART2_TXBUFSIZE=128
CONFIG_USER_ENTRYPOINT="nsh_main"
$ make
$ sudo openocd -f interface/stlink-v2.cfg -f target/stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx.bin 0x08000000"
Create the RAMDISK:
nsh> mkrd 64
nsh> mkfatfs /dev/ram0
nsh> mount -t vfat /dev/ram0 /mnt
Create the sample file:
nsh> echo "var fs = require('fs');" > /mnt/index.js
nsh> echo "console.log('Hello World');" >> /mnt/index.js
Confirm it is correct:
nsh> cat /mnt/index.js
var fs = require('fs');
console.log('Hello World');
Is iotjs here?
nsh> ?
help usage: help [-v] []
. cd exec ifdown mkrd pwd time
[ cp exit ifup mh rm true
? cmp false kill mount rmdir uname
arp dirname free ls mv set umount
basename dd help mb mw sleep unset
break df hexdump mkdir nslookup source usleep
cat echo ifconfig mkfatfs ps test xd
Builtin Apps:
iotjs sh hello nsh
All right, run it:
nsh> iotjs /mnt/index.js
Hello World
nsh>
文章来源: https://acassis.wordpress.com/2020/08/29/testing-iotjs-on-nuttx/
如有侵权请联系:admin#unsafe.sh