nRF51822-mKIT build fails with 'Missing PLATFORM_SPECIFIC_HAL_LIB'

When try to build for the nRF51822-mKIT the build fails:

$yotta build
info: generate for target: nordic-nrf51822-16k-gcc 0.1.3 at /mbed/bt-mbed-explore/yotta_targets/nordic-nrf51822-16k-gcc
GCC version is: 4.9.3
suppressing warnings from ble-nrf51822
CMake Error at /mbed/bt-mbed-explore/yotta_modules/mbed-hal-nrf51822-mcu/CMakeLists.txt:94 (message):
  Missing PLATFORM_SPECIFIC_HAL_LIB


-- Configuring incomplete, errors occurred!
See also "/mbed/bt-mbed-explore/build/nordic-nrf51822-16k-gcc/CMakeFiles/CMakeOutput.log".
error: command ['cmake', '-D', 'CMAKE_BUILD_TYPE=RelWithDebInfo', '-G', 'Ninja', '.'] failed

I tried with all of those targets:

  • nordic-nrf51822-gcc - 0.0.1
  • nordic-nrf51822-16k-gcc - 0.1.3
  • nordic-nrf51822-32k-gcc - 0.1.3

Always the same error.

I followed the Your first application :

yotta init
yotta target nordic-nrf51822-gcc
yotta install mbed-drivers
yotta build

I also do not yet understand the difference of the 3 targets.

Thanks for any info or advice.

there are two mkit targets - mkit-gcc and mkit-armcc.

Those targets you are using are base targets which other targets are based on. Please read the readme here GitHub - ARMmbed/target-nordic-nrf51822: Various mbed-official yotta target descriptions for compiling for nrf51822. (A note - there were some updates recently to consolidate those targets)

Thanks for pointing me to the mkit-gcc, with this one I can now compile the blinky example.

I wouldn’t have found that one, because I just had a look at nRF51822-mKIT page, that one shows Yotta Targets at the bottom, so I tried all the gcc ones, but unfortunately it does not show the mkit-gcc one.

I now have another newbie question:
The tutorial say that once compiled, one should copy the blink.bin to the mbed drive. This does not work for my nRF51822-mKIT. I saw that it also builds a blinky.hex and a blinky-combined.hex. My blinky example only worked when copying the blinky-combined.hex.

How do I find out which file to copy and what is the difference between blinky.hex and blinky-combined.hex.

Thanks

I just tried to run yotta test after adding a test case to my blinky example.
This did not work

info: test blinky: blinky-test-one
MBED: Instrumentation: "/dev/tty.usbmodem1412" and disk: "/Volumes/MBED"
HOST: Copy image onto target...
HOST: Initialize serial port...
...port ready!
HOST: Reset target...
HOST: Detecting test case properties...
error: test blinky-test-one failed (command: blinky-test-one)
info: tests complete: 0 passed, 1 failed

I added a debug output line to the copy_image_raw function inside the mbed_base.py of the > host_tests_runner to see which file is copied. And I see that it copies the blinky-test-one.bin not the hex file and the bin file does not work.

info: test blinky: blinky-test-one
MBED: Instrumentation: "/dev/tty.usbmodem1412" and disk: "/Volumes/MBED"
HOST: Copy image onto target...
DEBUG: copy_image_raw /mbed/blinky/build/mkit-gcc/test/blinky-test-one.bin =>  /Volumes/MBED
HOST: Initialize serial port...
...port ready!
HOST: Reset target...
HOST: Detecting test case properties...
error: test blinky-test-one failed (command: blinky-test-one)
info: tests complete: 0 passed, 1 failed

The tutorial say that once compiled, one should copy the blink.bin to the mbed drive. This does not work for my nRF51822-mKIT. I saw that it also builds a blinky.hex and a blinky-combined.hex. My blinky example only worked when copying the blinky-combined.hex.

Tutorial is for FRDM-K64F which as many other boards accepts .bin (their interface implementations). nordic boards are different in this case.

How do I find out which file to copy and what is the difference between blinky.hex and blinky-combined.hex.

combined - with the softdevice (merged)

I added a debug output line to the copy_image_raw function inside the mbed_base.py of the > host_tests_runner to see which file is copied. And I see that it copies the blinky-test-one.bin not the hex file and the bin file does not work.

I heard about having possibility to specify the output for tests, I’ll have to ask for more information for this. In the meantime, you can run those tests manually, using mbed greentea: GitHub - ARMmbed/greentea: IoT reGREssion ENvironment for TEst Automation

Thanks for your answers. I tried to use Greentea but unfortunately I already have the next set of problems and questions :confused::

I tried the Greentea End to end example:

blinky$mbedgt --list
mbedgt: available tests for built targets, location '/mbed/blinky/build'
	target 'mkit-gcc':
	test 'blinky-test-one'
	target 'st-nucleo-f401re-gcc':
	test 'blinky-test-one'

Example: execute 'mbedgt -t TARGET_NAME -n TEST_NAME' to run test TEST_NAME for target TARGET_NAME
blinky$mbedgt -V
mbedgt: checking for yotta target in current directory
	reason: no --target switch set
mbedgt: checking yotta target in current directory
	calling yotta: yotta --plain target
mbedgt: assuming default target as 'mkit-gcc'
mbedgt: detecting connected mbed-enabled devices...
mbedgt: detected 1 device
	detected 'NRF51822' -> 'NRF51822[0]', console at '/dev/tty.usbmodem1412', mounted at '/Volumes/MBED', target id '1070021853313120313436373130332033313037AED6DEA8'
mbedgt: yotta search for mbed-target 'nrf51822'
	calling yotta: yotta --plain search -k mbed-target:nrf51822 target
	found target 'bbc-microbit-classic-gcc'
	found target 'bbc-microbit-classic-armcc'
	found target 'nordic-nrf51822-16k-gcc'
	found target 'nordic-nrf51822-32k-gcc'
	found target 'nordic-nrf51822-16k-armcc'
	found target 'nordic-nrf51822-32k-armcc'
	found target 'nordic-nrf51822-gcc'
	found target 'bbc-microbit-classic-gcc-nosd'
	found target 'nordic-nrf51822-armcc'
	found target 'bbc-microbit-classic-armcc-nosd'
	use 0 instances for testing
mbedgt: no platform/target matching tests were found!
mbedgt: no target matching platforms were found!
completed in 2.07 sec

So somehow my connected nRF51822-mKIT does not get recognized as device for the mkit-gcc target.

So i tried to specify a target nordic-nrf51822-gcc that is found for the nrf51822 and the mkit-gcc inherits from, but unfortunately this again results in the build error of my initial post:

mbedgt -V -t nordic-nrf51822-gcc
mbedgt: detecting connected mbed-enabled devices...
mbedgt: detected 1 device
	detected 'NRF51822' -> 'NRF51822[0]', console at '/dev/tty.usbmodem1412', mounted at '/Volumes/MBED', target id '1070021853313120313436373130332033313037AED6DEA8'
mbedgt: yotta search for mbed-target 'nrf51822'
	calling yotta: yotta --plain search -k mbed-target:nrf51822 target
	found target 'bbc-microbit-classic-gcc'
	found target 'bbc-microbit-classic-armcc'
	found target 'nordic-nrf51822-16k-gcc'
	found target 'nordic-nrf51822-32k-gcc'
	found target 'nordic-nrf51822-16k-armcc'
	found target 'nordic-nrf51822-32k-armcc'
	found target 'nordic-nrf51822-gcc'
	found target 'bbc-microbit-classic-gcc-nosd'
	found target 'nordic-nrf51822-armcc'
	found target 'bbc-microbit-classic-armcc-nosd'
mbedgt: processing 'nordic-nrf51822-gcc' yotta target compatible platforms...
mbedgt: processing 'NRF51822' platform...
mbedgt: using platform 'NRF51822' for test:
	target_id_mbed_htm = '1070021853313120313436373130332033313037AED6DEA8'
	mount_point = '/Volumes/MBED'
	target_id = '1070021853313120313436373130332033313037AED6DEA8'
	serial_port = '/dev/tty.usbmodem1412'
	target_id_usb_id = '1070021853313120313436373130332033313037AED6DEA8'
	platform_name = 'NRF51822'
	platform_name_unique = 'NRF51822[0]'
mbedgt: building your sources and tests with yotta...
	calling yotta: yotta --target=nordic-nrf51822-gcc,* build
info: generate for target: nordic-nrf51822-gcc 1.0.0 at /mbed/blinky/yotta_targets/nordic-nrf51822-gcc
CMake Warning at /mbed/blinky/yotta_targets/nordic-nrf51822-gcc/CMake/toolchain.cmake:23 (message):
  No definition of YOTTA_CFG_NRF51822_RAM_SIZE found, building image for
  default 16K target.
Call Stack (most recent call first):
  toolchain.cmake:9 (include)
  /usr/local/Cellar/cmake/3.4.0/share/cmake/Modules/CMakeDetermineSystem.cmake:98 (include)
  CMakeLists.txt:85 (project)


GCC version is: 4.9.3
suppressing warnings from nrf51-sdk
-- The ASM compiler identification is GNU
-- Found assembler: /usr/local/bin/arm-none-eabi-gcc
CMake Error at /mbed/blinky/yotta_modules/mbed-hal-nrf51822-mcu/CMakeLists.txt:94 (message):
  Missing PLATFORM_SPECIFIC_HAL_LIB


-- Configuring incomplete, errors occurred!
See also "/mbed/blinky/build/nordic-nrf51822-gcc/CMakeFiles/CMakeOutput.log".
error: command ['cmake', '-D', 'CMAKE_BUILD_TYPE=RelWithDebInfo', '-G', 'Ninja', '.'] failed
mbedgt: yotta build failed!
mbedgt: yotta returned 1
completed in 3.42 sec

So somehow no luck to run my tests on my nRF51822-mKIT board with mbed 3.0.

Thanks for the report, target is missing the keyword which is recognized by mbedgt. If you add to your target.json file (for mkit target) this

`  "keywords": [
    "mbed-target:nrf51822",
  ],

it will be recognized. I’ll send PR fixing it

Thanks. I saw your PR and tried to change my local blinky/yotta_targets/mkit-gcc/target.json file accordingly. Unfortunately this does not help since Greentea uses a yotta search yotta --plain search -k mbed-target:nrf51822 target which does the search on the online repository and therefore uses the online target.json. So it looks like I have to wait for a new release of the mkit-gcc target or is it possible to somehow configure an local repository.

Update your greentea, the latest version should not check registry by default. There was added a new argument --yotta-registry to explicitly enable it.

Therefore if you test that locally (please set target mkit before running mbedgt, so target is present in yotta_targets → mbedgt sees it). It should work

I updated all the mbed tools (yotta, greentea, …) to the latest version and now my local change is considered :+1:. Thanks for the hint.

But still I could not run my test because now also Greentea copies/loads the blinky-test-one.bin not the hex file:

blinky$mbedgt -V
...
mbedgt: running 1 test for target 'mkit-gcc' and platform 'NRF51822'
	use 1 instance for testing
mbedgt: selecting test case observer...
	calling mbedhtrun: mbedhtrun -d /Volumes/MBED -p /dev/tty.usbmodem1412:9600 -f "./build/mkit-gcc/test/blinky-test-one.bin" -C 6 -c shell -m NRF51822
mbedgt: mbed-host-test-runner: started
MBED: Instrumentation: "/dev/tty.usbmodem1412" and disk: "/Volumes/MBED"
HOST: Copy image onto target...
HOST: Initialize serial port...
...port ready!
HOST: Reset target...
HOST: Detecting test case properties...
HOmbedgt: mbed-host-test-runner: stopped
mbedgt: mbed-host-test-runner: returned 'TIMEOUT'
mbedgt: test on hardware with target id: 1070021853313120313436373130332033313037AED6DEA8
	test 'blinky-test-one' ................................................................. TIMEOUT in 10.43 sec
mbedgt: test report:
+----------+---------------+-----------------+---------+--------------------+-------------+
| target   | platform_name | test            | result  | elapsed_time (sec) | copy_method |
+----------+---------------+-----------------+---------+--------------------+-------------+
| mkit-gcc | NRF51822      | blinky-test-one | TIMEOUT | 10.43              | shell       |
+----------+---------------+-----------------+---------+--------------------+-------------+

Result: 1 TIMEOUT
completed in 20.77 sec

Lukily I found the place in Greentea where I have to specify what it should load for the nRF51822-mKIT and added it locally and now I could finally run my test :smiley::

mbedgt: test report:
+----------+---------------+-----------------+--------+--------------------+-------------+
| target   | platform_name | test            | result | elapsed_time (sec) | copy_method |
+----------+---------------+-----------------+--------+--------------------+-------------+
| mkit-gcc | NRF51822      | blinky-test-one | OK     | 3.78               | shell       |
+----------+---------------+-----------------+--------+--------------------+-------------+

Here is the Pull Request against Greentea that adds the info for the nRF51822-mKIT board.

@bittailor Thanks for sending the fix !