Mbedos Jerryscript for NRF52840_DK

03 Apr 2019

I have successfully compiled the jerryscript source ( https://github.com/ARMmbed/mbed-js-repl-example) for nRF52832 by using the "gulp target=NRF52_DK" build command. But faced the following error while build the same jerry source code for nRF52840 by using "gulp target=NRF52840_DK" command.

Lenovo-Z580:/repel/mbed-js-repl-example$ gulp target=NRF52840_DK [17:55:05] Using gulpfile /repel/mbed-js-repl-example/Gulpfile.js [17:55:05] Starting 'make-build-dir'... [17:55:05] Finished 'make-build-dir' after 145 μs [17:55:05] Starting 'makefile'... [17:55:05] Starting 'bundle'... [17:55:05] Starting 'ignorefile'... [17:55:06] Finished 'makefile' after 189 ms [17:55:06] Starting 'get-jerryscript'... [17:55:06] Finished 'get-jerryscript' after 130 μs [17:55:06] Starting 'getlibs'... [17:55:06] Finished 'getlibs' after 13 ms $ make getlibs make: Nothing to be done for 'getlibs'. [17:55:06] Finished 'ignorefile' after 185 ms [17:55:06] Finished 'bundle' after 687 ms [17:55:06] Starting 'cppify'... [17:55:07] Finished 'cppify' after 741 ms [17:55:07] Starting 'build'... [17:55:08] Found native packages: mbed-js-repl $ make BOARD=NRF52840_DK EXTRAS=/home/pc/repel/mbed-js-repl-example/node_modules/mbed-js-repl/. [17:55:10] build/make [17:55:10] Finished 'build' after 3.26 s [17:55:10] Starting 'default'... [17:55:10] Finished 'default' after 55 μs cd jerryscript/targets/mbedos5 && pip install -r tools/requirements.txt && rm -f source/js_encoded.cpp && rm -f source/pins.cpp && rm -f source/main.cpp && make BOARD=NRF52840_DK EXTRA_SRC="/home/pc/repel/mbed-js-repl-example/node_modules/mbed-js-repl/.:../../../source" EXTERN_BUILD_DIR=../../../out/NRF52840_DK NO_JS=1 DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. Requirement already satisfied: pycparser<=2.17 in /usr/local/lib/python2.7/dist-packages (from -r tools/requirements.txt (line 1)) (2.17) Requirement already satisfied: simpleeval in /usr/local/lib/python2.7/dist-packages (from -r tools/requirements.txt (line 2)) (0.9.8) Requirement already satisfied: pycparserext in /usr/local/lib/python2.7/dist-packages (from -r tools/requirements.txt (line 3)) (2016.2) Requirement already satisfied: ply>=3.4 in /usr/local/lib/python2.7/dist-packages (from pycparserext->-r tools/requirements.txt (line 3)) (3.11) make[1]: Entering directory '/home/pc/repel/mbed-js-repl-example/build/jerryscript/targets/mbedos5' python tools/generate_pins.py NRF52840_DK In file included from ./mbed-os/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_SDK13/device/nrf.h:74:0, from ./mbed-os/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_SDK13/drivers_nrf/hal/nrf_gpio.h:41, from ./mbed-os/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/PinNames.h:43: ./mbed-os/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_SDK13/device/nrf52840.h:143:130: fatal error: core_cm4.h: No such file or directory

  1. include "core_cm4.h" /*!< Cortex-M4 processor and core peripherals */ ^ compilation terminated. Traceback (most recent call last): File "tools/generate_pins.py", line 247, in <module> main() File "tools/generate_pins.py", line 240, in main pins = [(x, pins[x]) for x in pins] # turn dict into tuples, which can be sorted TypeError: 'NoneType' object is not iterable Makefile:72: recipe for target 'source/pins.cpp' failed make[1]: Leaving directory '/home/pc/repel/mbed-js-repl-example/build/jerryscript/targets/mbedos5' make[1]: * [source/pins.cpp] Error 1 Makefile:14: recipe for target 'all' failed make: * [all] Error 2 events.js:183 throw er; Unhandled 'error' event ^

Error: Command `make BOARD=NRF52840_DK EXTRAS=/home/pc/repel/mbed-js-repl-example/node_modules/mbed-js-repl/.` exited with code 2 at ChildProcess.handleSubShellExit (/home/pc/repel/mbed-js-repl-example/node_modules/gulp-run/command.js:166:13) at Object.onceWrapper (events.js:317:30) at emitTwo (events.js:126:13) at ChildProcess.emit (events.js:214:7) at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)

I can fix this error by manually copy the cmsis header files into "./mbed-os/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_SDK13/device/nrf52840.h" then the header file required error resolved. But faced the following error

-Lenovo-Z580:/repel/mbed-js-repl-example$ gulp target=NRF52840_DK [18:09:48] Using gulpfile /repel/mbed-js-repl-example/Gulpfile.js [18:09:48] Starting 'make-build-dir'... [18:09:48] Finished 'make-build-dir' after 146 μs [18:09:48] Starting 'makefile'... [18:09:48] Starting 'bundle'... [18:09:48] Starting 'ignorefile'... [18:09:48] Finished 'ignorefile' after 29 ms [18:09:48] Finished 'makefile' after 48 ms [18:09:48] Starting 'get-jerryscript'... [18:09:48] Finished 'get-jerryscript' after 98 μs [18:09:48] Starting 'getlibs'... [18:09:48] Finished 'getlibs' after 16 ms $ make getlibs make: Nothing to be done for 'getlibs'. [18:09:48] Finished 'bundle' after 111 ms [18:09:48] Starting 'cppify'... [18:09:48] Finished 'cppify' after 31 ms [18:09:48] Starting 'build'... [18:09:49] Found native packages: mbed-js-repl $ make BOARD=NRF52840_DK EXTRAS=/home/pc/repel/mbed-js-repl-example/node_modules/mbed-js-repl/. [18:09:50] build/make [18:09:50] Finished 'build' after 1.82 s [18:09:50] Starting 'default'... [18:09:50] Finished 'default' after 31 μs cd jerryscript/targets/mbedos5 && pip install -r tools/requirements.txt && rm -f source/js_encoded.cpp && rm -f source/pins.cpp && rm -f source/main.cpp && make BOARD=NRF52840_DK EXTRA_SRC="/home/pc/repel/mbed-js-repl-example/node_modules/mbed-js-repl/.:../../../source" EXTERN_BUILD_DIR=../../../out/NRF52840_DK NO_JS=1 DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. Requirement already satisfied: pycparser<=2.17 in /usr/local/lib/python2.7/dist-packages (from -r tools/requirements.txt (line 1)) (2.17) Requirement already satisfied: simpleeval in /usr/local/lib/python2.7/dist-packages (from -r tools/requirements.txt (line 2)) (0.9.8) Requirement already satisfied: pycparserext in /usr/local/lib/python2.7/dist-packages (from -r tools/requirements.txt (line 3)) (2016.2) Requirement already satisfied: ply>=3.4 in /usr/local/lib/python2.7/dist-packages (from pycparserext->-r tools/requirements.txt (line 3)) (3.11) make[1]: Entering directory '/home/pc/repel/mbed-js-repl-example/build/jerryscript/targets/mbedos5' python tools/generate_pins.py NRF52840_DK In file included from ./mbed-os/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_SDK13/device/nrf52840.h:143:0, from ./mbed-os/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_SDK13/device/nrf.h:74, from ./mbed-os/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_SDK13/drivers_nrf/hal/nrf_gpio.h:41, from ./mbed-os/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/PinNames.h:43: ./mbed-os/targets/TARGET_NORDIC/TARGET_NRF5/TARGET_SDK13/device/core_cm4.h:220:0: warning: "IO" redefined

  1. define IO volatile /*!< Defines 'read / write' permissions */ ^ <command-line>:0:0: note: this is the location of the previous definition Traceback (most recent call last): File "tools/generate_pins.py", line 247, in <module> main() File "tools/generate_pins.py", line 237, in main pins = enumerate_pins(pins_file, ['./tools'] + list(includes), defines) File "tools/generate_pins.py", line 154, in enumerate_pins parser=GnuCParser()) File "/usr/local/lib/python2.7/dist-packages/pycparser/init.py", line 93, in parse_file return parser.parse(text, filename) File "/usr/local/lib/python2.7/dist-packages/pycparserext/ext_c_parser.py", line 64, in parse return self.cparser.parse(text, lexer=self.clex, debug=debuglevel) File "/usr/local/lib/python2.7/dist-packages/pycparser/ply/yacc.py", line 331, in parse return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc) File "/usr/local/lib/python2.7/dist-packages/pycparser/ply/yacc.py", line 1106, in parseopt_notrack p.callable(pslice) File "/usr/local/lib/python2.7/dist-packages/pycparser/c_parser.py", line 654, in p_decl_body typedef_namespace=True) File "/usr/local/lib/python2.7/dist-packages/pycparser/c_parser.py", line 394, in _build_declarations self._parse_error('Invalid declaration', coord) File "/usr/local/lib/python2.7/dist-packages/pycparser/plyparser.py", line 55, in _parse_error raise ParseError("%s: %s" % (coord, msg)) pycparser.plyparser.ParseError: /usr/include/newlib/sys/_stdint.h:32: Invalid declaration Makefile:72: recipe for target 'source/pins.cpp' failed make[1]: Leaving directory '/home/pc/repel/mbed-js-repl-example/build/jerryscript/targets/mbedos5' make[1]: * [source/pins.cpp] Error 1 Makefile:14: recipe for target 'all' failed make: * [all] Error 2 events.js:183 throw er; Unhandled 'error' event ^

Error: Command `make BOARD=NRF52840_DK EXTRAS=/home/pc/repel/mbed-js-repl-example/node_modules/mbed-js-repl/.` exited with code 2 at ChildProcess.handleSubShellExit (/home/pc/repel/mbed-js-repl-example/node_modules/gulp-run/command.js:166:13) at Object.onceWrapper (events.js:317:30) at emitTwo (events.js:126:13) at ChildProcess.emit (events.js:214:7) at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)

i checked the "/usr/include/newlib/sys/_stdint.h" line 32 & found the Invalid declaration error is "typedef uint32_t uint32_t;"(Refer attached file [/media/uploads/suresh93/_stdint.h _stdint.h ). Based on some of the web reference i include the stdint.h file into the "/usr/include/newlib/sys/_stdint.h:" file . But the issue not resolved.

Could you help to resolve this issue