Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ const PinMap PinMap_I2C_testing[] = {
{P0_23, 0, 0},
{P0_24, 0, 0},
{P0_25, 0, 0},
{P0_26, 0, 0},
{P0_27, 0, 0},
{P0_28, 0, 0},
{P0_29, 0, 0},
{P0_30, 0, 0},
Expand Down Expand Up @@ -120,6 +122,8 @@ const PinMap PinMap_SPI_testing[] = {
{P0_23, 0, 0},
{P0_24, 0, 0},
{P0_25, 0, 0},
{P0_26, 0, 0},
{P0_27, 0, 0},
{P0_28, 0, 0},
{P0_29, 0, 0},
{P0_30, 0, 0},
Expand Down Expand Up @@ -173,6 +177,8 @@ const PinMap PinMap_UART_testing[] = {
{P0_23, 0, 0},
{P0_24, 0, 0},
{P0_25, 0, 0},
{P0_26, 0, 0},
{P0_27, 0, 0},
{P0_28, 0, 0},
{P0_29, 0, 0},
{P0_30, 0, 0},
Expand Down Expand Up @@ -226,6 +232,8 @@ const PinMap PinMap_PWM_testing[] = {
{P0_23, 0, 0},
{P0_24, 0, 0},
{P0_25, 0, 0},
{P0_26, 0, 0},
{P0_27, 0, 0},
{P0_28, 0, 0},
{P0_29, 0, 0},
{P0_30, 0, 0},
Expand Down Expand Up @@ -279,6 +287,8 @@ const PinMap PinMap_QSPI_testing[] = {
{P0_23, 0, 0},
{P0_24, 0, 0},
{P0_25, 0, 0},
{P0_26, 0, 0},
{P0_27, 0, 0},
{P0_28, 0, 0},
{P0_29, 0, 0},
{P0_30, 0, 0},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,6 @@ typedef enum {
p45 = P1_13,
p46 = P1_14,
p47 = P1_15,

LED1 = p13,
LED2 = p14,
LED3 = p15,
LED4 = p16,

BUTTON1 = p11,
BUTTON2 = p12,
BUTTON3 = p24,
BUTTON4 = p25,

RX_PIN_NUMBER = p8,
TX_PIN_NUMBER = p6,
Expand All @@ -191,69 +181,81 @@ typedef enum {
STDIO_UART_CTS = CTS_PIN_NUMBER,
STDIO_UART_RTS = RTS_PIN_NUMBER,

SPI_PSELMOSI0 = P1_13,
SPI_PSELMISO0 = P1_14,
SPI_PSELSS0 = P1_12,
SPI_PSELSCK0 = P1_15,
ARDUINO_UNO_D0 = P1_1,
ARDUINO_UNO_D1 = P1_2,
ARDUINO_UNO_D2 = P1_3,
ARDUINO_UNO_D3 = P1_4,
ARDUINO_UNO_D4 = P1_5,
ARDUINO_UNO_D5 = P1_6,
ARDUINO_UNO_D6 = P1_7,
ARDUINO_UNO_D7 = P1_8,

ARDUINO_UNO_D8 = P1_10,
ARDUINO_UNO_D9 = P1_11,
ARDUINO_UNO_D10 = P1_12,
ARDUINO_UNO_D11 = P1_13,
ARDUINO_UNO_D12 = P1_14,
ARDUINO_UNO_D13 = P1_15,

SPI_PSELMOSI1 = P1_2,
SPI_PSELMISO1 = P1_3,
SPI_PSELSS1 = P1_1,
SPI_PSELSCK1 = P1_4,
ARDUINO_UNO_D14 = p26,
ARDUINO_UNO_D15 = p27,

SPIS_PSELMOSI = P1_2,
SPIS_PSELMISO = P1_3,
SPIS_PSELSS = P1_1,
SPIS_PSELSCK = P1_4,
ARDUINO_UNO_A0 = p3,
ARDUINO_UNO_A1 = p4,
ARDUINO_UNO_A2 = p28,
ARDUINO_UNO_A3 = p29,
ARDUINO_UNO_A4 = p30,
ARDUINO_UNO_A5 = p31,

// Not connected
NC = (int)0xFFFFFFFF
} PinName;

I2C_SDA0 = p26,
I2C_SCL0 = p27,
// LEDs and buttons
#define LED1 p13
#define LED2 p14
#define LED3 p15
#define LED4 p16

D0 = P1_1,
D1 = P1_2,
D2 = P1_3,
D3 = P1_4,
D4 = P1_5,
D5 = P1_6,
D6 = P1_7,
D7 = P1_8,
#define BUTTON1 p11
#define BUTTON2 p12
#define BUTTON3 p24
#define BUTTON4 p25

D8 = P1_10,
D9 = P1_11,
D10 = P1_12,
D11 = P1_13,
D12 = P1_14,
D13 = P1_15,
// Busses
#define I2C_SDA0 p26
#define I2C_SCL0 p27

D14 = p26,
D15 = p27,
#define SPI_PSELMOSI0 P1_13
#define SPI_PSELMISO0 P1_14
#define SPI_PSELSS0 P1_12
#define SPI_PSELSCK0 P1_15

A0 = p3,
A1 = p4,
A2 = p28,
A3 = p29,
A4 = p30,
A5 = p31,
#define SPI_PSELMOSI1 P1_2
#define SPI_PSELMISO1 P1_3
#define SPI_PSELSS1 P1_1
#define SPI_PSELSCK1 P1_4

/**** QSPI pins ****/
QSPI1_IO0 = P0_20,
QSPI1_IO1 = P0_21,
QSPI1_IO2 = P0_22,
QSPI1_IO3 = P0_23,
QSPI1_SCK = P0_19,
QSPI1_CSN = P0_17,
#define SPIS_PSELMOSI P1_2
#define SPIS_PSELMISO P1_3
#define SPIS_PSELSS P1_1
#define SPIS_PSELSCK P1_4

/**** QSPI FLASH pins ****/
QSPI_FLASH1_IO0 = QSPI1_IO0,
QSPI_FLASH1_IO1 = QSPI1_IO1,
QSPI_FLASH1_IO2 = QSPI1_IO2,
QSPI_FLASH1_IO3 = QSPI1_IO3,
QSPI_FLASH1_SCK = QSPI1_SCK,
QSPI_FLASH1_CSN = QSPI1_CSN,
/**** QSPI pins ****/
#define QSPI1_IO0 P0_20
#define QSPI1_IO1 P0_21
#define QSPI1_IO2 P0_22
#define QSPI1_IO3 P0_23
#define QSPI1_SCK P0_19
#define QSPI1_CSN P0_17

// Not connected
NC = (int)0xFFFFFFFF
} PinName;
/**** QSPI FLASH pins ****/
#define QSPI_FLASH1_IO0 QSPI1_IO0
#define QSPI_FLASH1_IO1 QSPI1_IO1
#define QSPI_FLASH1_IO2 QSPI1_IO2
#define QSPI_FLASH1_IO3 QSPI1_IO3
#define QSPI_FLASH1_SCK QSPI1_SCK
#define QSPI_FLASH1_CSN QSPI1_CSN

typedef enum {
PullNone = 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,17 @@

/* Linker script to configure memory regions. */

/* Default to no softdevice */
#if !defined(MBED_APP_START)
#define MBED_APP_START 0x0
#endif

#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE 0x100000
#endif

#if !defined(MBED_RAM_START)
#define MBED_RAM_START 0x20000000
#define MBED_RAM_SIZE 0x40000
#endif

#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE)
#define MBED_CONF_TARGET_BOOT_STACK_SIZE 0x800
#endif

#define MBED_RAM0_START MBED_RAM_START
#define MBED_RAM0_SIZE 0x100

#define MBED_CRASH_REPORT_RAM_START (MBED_RAM0_START + MBED_RAM0_SIZE)
#define MBED_CRASH_REPORT_RAM_SIZE 0x100

#define MBED_RAM1_START (MBED_CRASH_REPORT_RAM_START + MBED_CRASH_REPORT_RAM_SIZE)
#define MBED_RAM1_SIZE (MBED_RAM_SIZE - (MBED_RAM0_SIZE + MBED_CRASH_REPORT_RAM_SIZE))

MEMORY
{
FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
RAM_NVIC (rwx) : ORIGIN = MBED_RAM0_START, LENGTH = MBED_RAM0_SIZE
RAM_CRASH_DATA (rwx) : ORIGIN = MBED_CRASH_REPORT_RAM_START, LENGTH = MBED_CRASH_REPORT_RAM_SIZE
RAM (rwx) : ORIGIN = MBED_RAM1_START, LENGTH = MBED_RAM1_SIZE
FLASH (rx) : ORIGIN = MBED_CONFIGURED_ROM_BANK_IROM1_START, LENGTH = MBED_CONFIGURED_ROM_BANK_IROM1_SIZE
RAM (rwx) : ORIGIN = MBED_RAM_BANK_IRAM1_START, LENGTH = MBED_RAM_BANK_IRAM1_SIZE
}


OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")

/* Linker script to place sections and symbol values. Should be used together
Expand Down Expand Up @@ -84,6 +59,28 @@ ENTRY(Reset_Handler)

SECTIONS
{
/* RAM vector table */
.nvictable (NOLOAD) :
{
PROVIDE(__start_nvictable = .);
KEEP(*(.nvictable))
PROVIDE(__stop_nvictable = .);
} > RAM

/* Crash data RAM (preserved across resets) */
.crash_data_ram (NOLOAD):
{
. = ALIGN(8);
__CRASH_DATA_RAM__ = .;
__CRASH_DATA_RAM_START__ = .; /* Create a global symbol at data start */
. += MBED_CRASH_REPORT_RAM_SIZE;
__CRASH_DATA_RAM_END__ = .; /* Define a global symbol at data end */

/* Include any used-defined data in the crash data RAM */
KEEP(*(.keep.crash_data_ram))
*(.m_crash_data_ram)
} > RAM

.text :
{
KEEP(*(.Vectors))
Expand Down Expand Up @@ -201,25 +198,6 @@ SECTIONS

__edata = .;

.nvictable (NOLOAD) :
{
PROVIDE(__start_nvictable = .);
KEEP(*(.nvictable))
PROVIDE(__stop_nvictable = .);
} > RAM_NVIC

.crash_data_ram :
{
. = ALIGN(8);
__CRASH_DATA_RAM__ = .;
__CRASH_DATA_RAM_START__ = .; /* Create a global symbol at data start */
KEEP(*(.keep.crash_data_ram))
*(.m_crash_data_ram) /* This is a user defined section */
. += MBED_CRASH_REPORT_RAM_SIZE;
. = ALIGN(8);
__CRASH_DATA_RAM_END__ = .; /* Define a global symbol at data end */
} > RAM_CRASH_DATA

.noinit (NOLOAD) :
{
PROVIDE(__start_noinit = .);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,6 @@
#define NVIC_NUM_VECTORS (16 + 48) // CORE + MCU Peripherals
#define NVIC_USER_IRQ_OFFSET 16

// RAM size defines, same as in the linker script
#if !defined(MBED_APP_START)
#define MBED_APP_START 0x0
#endif

#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE 0x100000
#endif

#if !defined(MBED_RAM_START)
#define MBED_RAM_START 0x20000000
#define MBED_RAM_SIZE 0x40000
#endif

#include "nrf.h"
#include "cmsis.h"

Expand Down
5 changes: 4 additions & 1 deletion targets/targets.json5
Original file line number Diff line number Diff line change
Expand Up @@ -7472,7 +7472,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.",
},
"NRF52840_DK": {
"supported_form_factors": [
"ARDUINO"
"ARDUINO_UNO"
],
"inherits": [
"MCU_NRF52840"
Expand All @@ -7492,6 +7492,9 @@ mode is recommended for target MCUs with small amounts of flash and RAM.",
"supported_application_profiles": [
"full", "bare-metal"
],
"components_add": [
"QSPIF"
],
"image_url": "https://www.nordicsemi.com/-/media/Images/Products/DevKits/nRF52-Series/nRF52840-DK/nRF52840-DK/nRF52840-DK-prod-page.png?h=750&iar=0&mw=350&w=350&hash=3DB140F6AE70CAE159FD911D8E6E9109"
},
"ARDUINO_NANO33BLE": {
Expand Down
36 changes: 36 additions & 0 deletions targets/upload_method_cfg/NRF52840_DK.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Mbed OS upload method configuration file for target NRF52840_DK.
# To change any of these parameters from their default values, set them in your build script between where you
# include app.cmake and where you add mbed os as a subdirectory.

# Notes:
# 1. If you have multiple Mbed devices plugged in to your machine, the MBED upload method only
# works for this device if you set the serial number (e.g. -DMBED_UPLOAD_SERIAL_NUMBER=001050278063).
# This is because for some reason the USB disk mode doesn't make the target name available to the host PC.
# 2. In my testing this device may need a manual reset via the reset button after
# flashing code via the MBED upload method.
# 3. To use this device with PyOCD you need to install the J-Link software package on your system.
# 4. As of Sep 2025, PyOCD can flash but cannot reliably debug. Getting 'cannot read register
# ipsr because core #0 is not halted'.


# General config parameters
# -------------------------------------------------------------
set(UPLOAD_METHOD_DEFAULT MBED)

# Config options for MBED
# -------------------------------------------------------------
set(MBED_UPLOAD_ENABLED TRUE)

# Config options for JLINK
# -------------------------------------------------------------
set(JLINK_UPLOAD_ENABLED TRUE)
set(JLINK_CPU_NAME nRF52840_xxAA)
set(JLINK_UPLOAD_INTERFACE SWD)
set(JLINK_CLOCK_SPEED 4000)

# Config options for PYOCD
# -------------------------------------------------------------

set(PYOCD_UPLOAD_ENABLED TRUE)
set(PYOCD_TARGET_NAME nrf52840)
set(PYOCD_CLOCK_SPEED 4000k)
Loading
Loading