Skip to content

[nrf fromlist] boards: Add nRF52840DK bare variant #3007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions boards/nordic/nrf52840dongle/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
if BOARD_NRF52840DONGLE

config BOARD_HAS_NRF5_BOOTLOADER
bool "Board has nRF5 bootloader"
default y
bool
default y if !BOARD_NRF52840DONGLE_NRF52840_BARE
help
If selected, applications are linked so that they can be loaded by Nordic
nRF5 bootloader.
Expand Down
12 changes: 3 additions & 9 deletions boards/nordic/nrf52840dongle/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,12 @@ if BOARD_NRF52840DONGLE
# To let the nRF5 bootloader load an application, the application
# must be linked after Nordic MBR, that is factory-programmed on the board.

# Nordic nRF5 bootloader exists outside of the partitions specified in the
# DTS file, so we manually override FLASH_LOAD_OFFSET to link the application
# correctly, after Nordic MBR.

# When building MCUBoot, MCUBoot itself will select USE_DT_CODE_PARTITION
# which will make it link into the correct partition specified in DTS file,
# the offset is applied here so that the full partition size can be used when
# the bootloader Kconfig option has been disabled.
# If the application wants to use the full partition size, a "bare" board
# variant should be used instead.

config FLASH_LOAD_OFFSET
default 0x1000
depends on BOARD_HAS_NRF5_BOOTLOADER && (MCUBOOT || !USE_DT_CODE_PARTITION)
depends on BOARD_HAS_NRF5_BOOTLOADER && !USE_DT_CODE_PARTITION

source "boards/common/usb/Kconfig.cdc_acm_serial.defconfig"

Expand Down
2 changes: 2 additions & 0 deletions boards/nordic/nrf52840dongle/board.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ board:
vendor: nordic
socs:
- name: nrf52840
variants:
- name: bare
12 changes: 4 additions & 8 deletions boards/nordic/nrf52840dongle/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,9 @@ For Segger J-Link debug probes, follow the instructions in the
:ref:`nordic_segger` page to install and configure all the necessary
software. Further information can be found in :ref:`nordic_segger_flashing`.

Locate the DTS file: :zephyr_file:`boards/nordic/nrf52840dongle/nrf52840dongle_nrf52840.dts`.
This file requires a small modification to use a different partition table.
Edit the include directive to include "fstab-debugger" instead of "fstab-stock".

In addition, the Kconfig file in the same directory must be modified by setting
``BOARD_HAS_NRF5_BOOTLOADER`` to be default ``n``, otherwise the code will be
flashed with an offset.
Use the ``nrf52840dongle/nrf52840/bare`` board variant to build your application.
This variant uses a modified partition table, which does not reserve space for
the onboard USB bootloader.

Then build and flash applications as usual (see :ref:`build_an_application` and
:ref:`application_run` for more details).
Expand All @@ -269,7 +265,7 @@ Here is an example for the :zephyr:code-sample:`blinky` application.

.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: nrf52840dongle/nrf52840
:board: nrf52840dongle/nrf52840/bare
:goals: build flash

Observe the LED on the board blinking.
Expand Down
46 changes: 0 additions & 46 deletions boards/nordic/nrf52840dongle/fstab-stock.dtsi

This file was deleted.

204 changes: 29 additions & 175 deletions boards/nordic/nrf52840dongle/nrf52840dongle_nrf52840.dts
Original file line number Diff line number Diff line change
Expand Up @@ -6,191 +6,45 @@
*/

/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include "nrf52840dongle_nrf52840-pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include "nrf52840dongle_nrf52840_common.dtsi"

/ {
model = "Nordic nRF52840 Dongle NRF52840";
compatible = "nordic,nrf52840-dongle-nrf52840";
/* Flash partition table compatible with the onboard USB bootloader */

chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
zephyr,ieee802154 = &ieee802154;
};

leds {
compatible = "gpio-leds";
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

led0_green: led_0 {
gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
label = "Green LED 0";
/* MCUboot placed after Nordic MBR.
* The size of this partition ensures that MCUBoot can
* be built with CDC ACM support and w/o optimizations.
*/
boot_partition: partition@1000 {
label = "mcuboot";
reg = <0x00001000 0x0000f000>;
};

led1_red: led_1 {
gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
label = "Red LED 1";
slot0_partition: partition@10000 {
label = "image-0";
reg = <0x00010000 0x00066000>;
};

led1_green: led_2 {
gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
label = "Green LED 1";
slot1_partition: partition@76000 {
label = "image-1";
reg = <0x00076000 0x00066000>;
};

led1_blue: led_3 {
gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
label = "Blue LED 1";
storage_partition: partition@dc000 {
label = "storage";
reg = <0x000dc000 0x00004000>;
};
};

pwmleds {
compatible = "pwm-leds";

red_pwm_led: pwm_led_0 {
pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
};

green_pwm_led: pwm_led_1 {
pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
};

blue_pwm_led: pwm_led_2 {
pwms = <&pwm0 2 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
};
};

buttons {
compatible = "gpio-keys";

button0: button_0 {
gpios = <&gpio1 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Push button switch 0";
zephyr,code = <INPUT_KEY_0>;
};
/* Onboard USB bootloader <0xe0000 0x1c000>
*
* In addition, the last and second last flash pages
* are used by the onboard USB bootloader and MBR to store
* settings.
*/
};

/* These aliases are provided for compatibility with samples */
aliases {
sw0 = &button0;
led0 = &led0_green;
led1 = &led1_red;
led2 = &led1_green;
led3 = &led1_blue;
led0-green = &led0_green;
led1-red = &led1_red;
led1-green = &led1_green;
led1-blue = &led1_blue;
pwm-led0 = &red_pwm_led;
pwm-led1 = &green_pwm_led;
pwm-led2 = &blue_pwm_led;
red-pwm-led = &red_pwm_led;
green-pwm-led = &green_pwm_led;
blue-pwm-led = &blue_pwm_led;
mcuboot-button0 = &button0;
mcuboot-led0 = &led0_green;
watchdog0 = &wdt0;
};
};

&reg0 {
status = "okay";
};

&reg1 {
regulator-initial-mode = <NRF5X_REG_MODE_DCDC>;
};

&adc {
status = "okay";
};

&gpiote {
status = "okay";
};

&uicr {
nfct-pins-as-gpios;
gpio-as-nreset;
};

&gpio0 {
status = "okay";
};

&gpio1 {
status = "okay";
};

&uart0 {
compatible = "nordic,nrf-uarte";
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
};

&i2c0 {
compatible = "nordic,nrf-twi";
status = "okay";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
};

&i2c1 {
compatible = "nordic,nrf-twi";
/* Cannot be used together with spi1. */
/* status = "okay"; */
pinctrl-0 = <&i2c1_default>;
pinctrl-1 = <&i2c1_sleep>;
pinctrl-names = "default", "sleep";
};

&pwm0 {
status = "okay";
pinctrl-0 = <&pwm0_default>;
pinctrl-1 = <&pwm0_sleep>;
pinctrl-names = "default", "sleep";
};

/*
* By default, not adding all available SPI instances (spi2, spi3) due to
* limited GPIOs available on dongle board.
*/
&spi0 {
compatible = "nordic,nrf-spi";
/* Cannot be used together with i2c0. */
/* status = "okay"; */
pinctrl-0 = <&spi0_default>;
pinctrl-1 = <&spi0_sleep>;
pinctrl-names = "default", "sleep";
};

&spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
pinctrl-0 = <&spi1_default>;
pinctrl-1 = <&spi1_sleep>;
pinctrl-names = "default", "sleep";
};

&ieee802154 {
status = "okay";
};

/* Include flash partition table.
* Two partition tables are available:
* fstab-stock -compatible with Nordic nRF5 bootloader, default
* fstab-debugger -to use an external debugger, w/o the nRF5 bootloader
*/
#include "fstab-stock.dtsi"

zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
};

#include <../boards/common/usb/cdc_acm_serial.dtsi>
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
/*
* Copyright (c) 2019 Nordic Semiconductor ASA
* Copyright (c) 2018-2023 Nordic Semiconductor ASA
* Copyright (c) 2017 Linaro Limited
*
* SPDX-License-Identifier: Apache-2.0
*/

/* Flash partition table without support for Nordic nRF5 bootloader */
/dts-v1/;
#include "nrf52840dongle_nrf52840_common.dtsi"

/* Flash partition table without support for the onboard USB bootloader */

&flash0 {
partitions {
Expand Down
20 changes: 20 additions & 0 deletions boards/nordic/nrf52840dongle/nrf52840dongle_nrf52840_bare.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
identifier: nrf52840dongle/nrf52840/bare
name: nRF52840-Dongle-NRF52840-bare
type: mcu
arch: arm
ram: 256
flash: 1024
toolchain:
- zephyr
- gnuarmemb
supported:
- adc
- usb_device
- ble
- pwm
- spi
- watchdog
- counter
- netif:openthread
- gpio
vendor: nordic
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# SPDX-License-Identifier: Apache-2.0

# Enable MPU
CONFIG_ARM_MPU=y

# Enable hardware stack protection
CONFIG_HW_STACK_PROTECTION=y

# enable GPIO
CONFIG_GPIO=y

# Board Kconfig.defconfig enables USB CDC ACM and should disable USB remote
# wakeup by default. It needs to be disabled here, because the USB nrfx
# driver always overwrites option from Kconfig mentioned above with the
# imply from CONFIG_USB_NRFX.
CONFIG_USB_DEVICE_REMOTE_WAKEUP=n
Loading