5 years, 7 months ago.

nordic platform can't be compiled.

There is a error message as shown below. It will appear, when any Nordic platform is built on the newest mbed-src.

Error: #error directive: "Device family must be defined. See nrf.h." in "mbed-src/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/nrf.h", Line: 40, Col: 6

Why? Thanks

Question relating to:

Hello World for DigitalOut

When below snippet code in nrf.h is commented, the compile is pass.

#error "Device family must be defined. See nrf.h."

Why? Thanks Marco

posted by Marco Hsu 15 Apr 2015

I'm getting the same error on the Nordic nRF51-DK platform. Any suggestions on how to fix?

Error: #error directive: "Device family must be defined. See nrf.h." in "extras/mbed_433970e64889/TARGET_NRF51_DK/nrf.h", Line: 40, Col: 6

posted by Rafael Feliciano 15 Apr 2015

When I comment that out the compiler doesnt seem to notice the chage. how do you tell it that you edited one of the libarries?

posted by Michael Dietz 16 Apr 2015

Marco, did you get yours to work yet? If so, what solution did you use?

posted by William Bransby 17 Apr 2015

Working samples here, older mbed i think. http://developer.mbed.org/users/dragosIQ/code/

posted by Radu Radoveneanu 20 Apr 2015

7 Answers

5 years, 7 months ago.

There's new mbed lib v97, I was able to compile nrf demos. I believe this is now fixed also with mbed-src. Can you retest?

Accepted Answer

Hi Martin,

There are some information for you. 1, import mbed-src, compile nrf.h error. 2, import mbed, compile nrf.h pass. 3, import mbed then convert to library, compile nrf.h error.

Hope these information can help you.

Thanks Marco

posted by Marco Hsu 16 Apr 2015

I cant comment on his answer, so here For Radu: Update all libraries to the newest one, I did and it compiles ;) At least with mbed library rev97, once I add mbed-src there's an error with Gpio IRQ

posted by Martin Kojtal 16 Apr 2015

Ble Thermometer - update all librareies, so BLE_API is 341, mbed lib is 97, nrf lib is 111. Selected platform - nordic nrf51822 - compiles. Then I remove mbed lib, add mbed-src revs 514 - GPiO error, which I am going to report.

Guys, provide complete details, how can we reproduce it.

posted by Martin Kojtal 16 Apr 2015

I reported this issue I found : https://github.com/mbedmicro/mbed/issues/1045.

I can't reproduce the nrf51 error you are talking about. Share the program, all libraries revisions, platfrom you are compiling for, I'll give it a shot

posted by Martin Kojtal 16 Apr 2015

It should be fixed. Can you test it?

posted by Martin Kojtal 17 Apr 2015

Yes, It is work, now. Thank you.

posted by Marco Hsu 21 Apr 2015
5 years, 7 months ago.

Im having this problem too. has anybody fixed it or found a work aroudn? thanks

temporary solution /media/uploads/Marcomissyou/2015-04-16_093245.jpg

waiting mbed to solve

posted by Marco Hsu 16 Apr 2015
5 years, 7 months ago.

I had the same problem with RedBearLab BLE Nano. It worked good after the following process. 1. Import mbed-src library. 2. Remove the original mbed.bld file. 3. Change the revision of mbed-src to the past one. I have tried the first rev. of Feb. 2015 and it did work successfully.

5 years, 7 months ago.

I am having this problem too. Even with the Blinky or Ble_HeartRate Template I got same error.

5 years, 7 months ago.

Also having the same problem here in multiple projects using RedBearLab BLE Nano.

5 years, 7 months ago.

I to got the same issue while compiling mbed-src. I'm using offline arm-gcc compiler with a custom Makefile. I was able to fix the issue:

diff --git a/libraries/mbed/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/nrf.h b/libraries/mbed/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/nrf.h
index e77307f..75a42c1 100644
--- a/libraries/mbed/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/nrf.h
+++ b/libraries/mbed/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/nrf.h
@@ -32,6 +32,8 @@
 
 #ifndef _WIN32
 
+#define NRF51
+
 /* Family selection for main includes. NRF51 must be selected. */
 #ifdef NRF51
     #include "nrf51.h"

May be this is the workaround, not sure!