Unable to build blinky sample for custom nRF52805 board, missed steps?

I am evaluating a Fanstel BC805M device, which uses the nRF52805 chipset.  I am using VSCode and have installed the nRF Connect Extension Pack, toolchain v2.8.0, and SDK v2.8.0.  If I create a blinky sample application, then create a build configuration that targets the nrf52dk/nrf52805, everything builds successfully, so I think the tools and extension have been set up properly.

Now I am trying to build the sample for the BC805M by adding a custom board, but the build fails.  My steps:

  1. Used the "Create a new board" option in the VSCode extension and successfully created a board at C:\my_boards\boards\fanstel\bc805m.  For reference, I entered "bc805m" for both the human-readable and machine-readable names, then selected the NRF52805 CAAA for the target.  The files in that directory are shown below.
    1. Question 1: are these files named correctly for Zephyr's Hardware Model v2?
  2. Used the "Create a new application" option to create a new blinky app at C:\my_apps\blinky, based on the zephyr blinky sample.
  3. Clicked "Add build configuration" button.
  4. Selected the "Custom" radio button, which automatically selected my custom board, bc805m/nrf52805.
  5. Left the rest of the options default and clicked "Build Configuration"
  6. The app built for a while but eventually threw an warning about drivers__gpio, then errored:
    CMake Warning at C:/ncs/v2.8.0/zephyr/CMakeLists.txt:952 (message):
      No SOURCES given to Zephyr library: drivers__gpio
    
      Excluding target from build.

    In file included from C:/ncs/v2.8.0/zephyr/include/zephyr/toolchain/gcc.h:98,
    from C:/ncs/v2.8.0/zephyr/include/zephyr/toolchain.h:50,
    from C:/ncs/v2.8.0/zephyr/include/zephyr/kernel_includes.h:23,
    from C:/ncs/v2.8.0/zephyr/include/zephyr/kernel.h:17,
    from C:/my_apps/blinky/src/main.c:8:
    C:/ncs/v2.8.0/zephyr/include/zephyr/device.h:92:41: error: '__device_dts_ord_DT_N_ALIAS_led0_P_gpios_IDX_0_PH_ORD' undeclared here (not in a function)

I am assuming there is more I need to do with the custom board files, but I'm having trouble determining what.  DevAcademy's Lesson 3 - Adding custom board support, Exercise 1, indicates I need to add some configuration options to bc805m_defconfig, but a note at the beginning of that lesson says it's only applicable up to SDK v2.6.1, after which the Zephyr Hardware Model 2 was adopted.

Question 2: Are the defconfig options listed in Exercise 1 still valid?  If not, where can I find the currently supported config options to add to bc805m_defconfig?

Exercise 1 also showed using the Devicetree Visual Editor to set up the board device tree, but it does not appear the device tree is in the build output folder.

I found How to work with boards and devices, but that doesn't have information about modifying device tree or config files.

Question 3: Is there a tutorial for custom boards with Zephyr Hardware Model 2?

Parents
  • To answer my own questions, since I was able to get this working.

    Question 1: are these files named correctly for Zephyr's Hardware Model v2?

    Yes, although the filenames do not have the <qualifiers> after the board name, e.g. bc805m.dts instead of bc805m_nrf52805.dts, as outlined in the hardware model transition guide, but that only seems necessary if the board supports more than one SoC.  For example, the Nordic nRF52 DK supports the nrf52805, nrf52810, and nrf52832 SoCs.

    Question 2: Are the defconfig options listed in Exercise 1 still valid?  If not, where can I find the currently supported config options to add to bc805m_defconfig?

    I don't know if the options in Exercise 1 are still valid, but I did not have to change anything in bc805m_defconfig to get the blinky sample (without UART!) working.

    Question 3: Is there a tutorial for custom boards with Zephyr Hardware Model 2?

    I couldn't find an all-in-one tutorial, but I followed the Board Porting Guide, Transition to the current hardware model guide and used  zephyr/boards/nordic/nrf52dk/nrf52dk_nrf52805.dts as a reference.

    This was the .dts for Fanstel's BC805M module that I used to build the blinky project, in case it helps anyone in the future. Please note that I have a 32.768 kHz oscillator connected to pins 13 and 14 of the BC805M.

    /dts-v1/;
    #include <nordic/nrf52805_caaa.dtsi>
    #include "bc805m-pinctrl.dtsi"
    
    / {
    	model = "Custom Board auto generated by nRF Connect for VS Code";
    	compatible = "fanstel,bc805m";
    
    	chosen {
    		zephyr,sram = &sram0;
    		zephyr,flash = &flash0;
    		zephyr,code-partition = &slot0_partition;
    	};
    
    	leds {
    		compatible = "gpio-leds";
    		led0: led_0 {
    			gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
    			label = "Red LED";
    		};	
    	};
    
    	aliases {
    		led0 = &led0;
    	};
    };
    
    &uicr {
    	gpio-as-nreset;
    };
    
    &gpio0 {
    	status = "okay";
    };
    
    &gpiote {
    	status = "okay";
    };
    
    &flash0 {
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		boot_partition: partition@0 {
    			label = "mcuboot";
    			reg = <0x00000000 DT_SIZE_K(48)>;
    		};
    
    		slot0_partition: partition@c000 {
    			label = "image-0";
    			reg = <0x0000c000 DT_SIZE_K(56)>;
    		};
    
    		slot1_partition: partition@1a000 {
    			label = "image-1";
    			reg = <0x0001a000 DT_SIZE_K(56)>;
    		};
    
    		storage_partition: partition@28000 {
    			label = "storage";
    			reg = <0x00028000 DT_SIZE_K(32)>;
    		};
    
    	};
    };

Reply
  • To answer my own questions, since I was able to get this working.

    Question 1: are these files named correctly for Zephyr's Hardware Model v2?

    Yes, although the filenames do not have the <qualifiers> after the board name, e.g. bc805m.dts instead of bc805m_nrf52805.dts, as outlined in the hardware model transition guide, but that only seems necessary if the board supports more than one SoC.  For example, the Nordic nRF52 DK supports the nrf52805, nrf52810, and nrf52832 SoCs.

    Question 2: Are the defconfig options listed in Exercise 1 still valid?  If not, where can I find the currently supported config options to add to bc805m_defconfig?

    I don't know if the options in Exercise 1 are still valid, but I did not have to change anything in bc805m_defconfig to get the blinky sample (without UART!) working.

    Question 3: Is there a tutorial for custom boards with Zephyr Hardware Model 2?

    I couldn't find an all-in-one tutorial, but I followed the Board Porting Guide, Transition to the current hardware model guide and used  zephyr/boards/nordic/nrf52dk/nrf52dk_nrf52805.dts as a reference.

    This was the .dts for Fanstel's BC805M module that I used to build the blinky project, in case it helps anyone in the future. Please note that I have a 32.768 kHz oscillator connected to pins 13 and 14 of the BC805M.

    /dts-v1/;
    #include <nordic/nrf52805_caaa.dtsi>
    #include "bc805m-pinctrl.dtsi"
    
    / {
    	model = "Custom Board auto generated by nRF Connect for VS Code";
    	compatible = "fanstel,bc805m";
    
    	chosen {
    		zephyr,sram = &sram0;
    		zephyr,flash = &flash0;
    		zephyr,code-partition = &slot0_partition;
    	};
    
    	leds {
    		compatible = "gpio-leds";
    		led0: led_0 {
    			gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
    			label = "Red LED";
    		};	
    	};
    
    	aliases {
    		led0 = &led0;
    	};
    };
    
    &uicr {
    	gpio-as-nreset;
    };
    
    &gpio0 {
    	status = "okay";
    };
    
    &gpiote {
    	status = "okay";
    };
    
    &flash0 {
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		boot_partition: partition@0 {
    			label = "mcuboot";
    			reg = <0x00000000 DT_SIZE_K(48)>;
    		};
    
    		slot0_partition: partition@c000 {
    			label = "image-0";
    			reg = <0x0000c000 DT_SIZE_K(56)>;
    		};
    
    		slot1_partition: partition@1a000 {
    			label = "image-1";
    			reg = <0x0001a000 DT_SIZE_K(56)>;
    		};
    
    		storage_partition: partition@28000 {
    			label = "storage";
    			reg = <0x00028000 DT_SIZE_K(32)>;
    		};
    
    	};
    };

Children
No Data
Related