This is the scenario :
I have the nRF52-DK with nRF52832 on board. I tried creating Mbed Studio (1.1.0) projects with Mbed OS 6 (6.2.0) for the DK. Mbed Studio detects the board, configures it, compiles the code and flashes it on to the MCU through DAP-Link. Everything including the debugging works fine.
Now I have the Laird Connectivity’s BL651 series BLE module 453-00005 which uses nRF52810. I want the Mbed OS project to be compiled for nRF52810 and flash it. Since I know that there are no dedicated development kits from either Nordic or Laird to evaluate the SoC, but the nRF52-DK provides a way of emulating nRF52810 on it, I thought I could change the build target CPU on Mbed Studio and compile the project.
So I did this,
I created a custom target by renaming it and choosing the right SoC. The project compiles fine and the binary file is generated as shown below.
Now the problem : I am able to flash this binary file to my external BL651 moulde over SWD using the Debug-Out port (J-Link OB firmware on interface MCU). But when run, the CPU on the BL651 module (nRF52810) halts with a hard fault. I found this was happening from the Ozone debugging interface.
The cause of the fault is the NOCP exception which is described as,
NOCP- Indicates that a Cortex-M coprocessor instruction was issued but the coprocessor was disabled or not present. One common case where this fault happens is when code is compiled to use the Floating Point extension (
-mfpu=fpv4-sp-d16) but the coprocessor was not enabled on boot.
This clearly shows that Mbed Studio did not compile the source files for the configured target CPU nRF52810, because the nRF52810 is a stripped down version of nRF52832, without an FPU. I did a clean build and there was no difference. I could verify this by flashing the binary to the nRF52823 on the DK which runs fine over there.
If somebody could tell me how to tell Mbed Studio to compile for the selected target CPU, that would me save a lot of time.