Skip to content

[wip] Add support for nRF54H20 #3335

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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions compiler/arm-none-eabi-m33/compiler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ compiler.path.objsize: arm-none-eabi-size
compiler.path.objcopy: arm-none-eabi-objcopy

compiler.flags.base: -mcpu=cortex-m33+nodsp -mthumb-interwork -mthumb -Wall -Werror -fno-exceptions -ffunction-sections -fdata-sections -fno-common
#-E -P
compiler.flags.default: [compiler.flags.base, -O1, -ggdb]
compiler.flags.optimized: [compiler.flags.base, -Os, -ggdb]
compiler.flags.speed: [compiler.flags.base, -O3, -ggdb]
Expand Down
2 changes: 2 additions & 0 deletions hw/bsp/nordic_pca10095/boot-nrf5340.ld
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x8000
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x80000
sram_ipc0_tx (rw) : ORIGIN = 0x20070000, LENGTH = 0x4000
sram_ipc0_rx (rw) : ORIGIN = 0x20074000, LENGTH = 0x4000
}

/* The bootloader does not contain an image header */
Expand Down
2 changes: 2 additions & 0 deletions hw/bsp/nordic_pca10095/nrf5340.ld
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ MEMORY
{
FLASH (rx) : ORIGIN = 0x0000c000, LENGTH = 0x76000
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x80000
sram_ipc0_tx (rw) : ORIGIN = 0x20070000, LENGTH = 0x4000
sram_ipc0_rx (rw) : ORIGIN = 0x20074000, LENGTH = 0x4000
}

/* This linker script is used for images and thus contains an image header */
Expand Down
17 changes: 16 additions & 1 deletion hw/bsp/nordic_pca10095/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,30 @@ syscfg.vals.BLE_TRANSPORT:
BLE_TRANSPORT_LL: nrf5340

syscfg.vals.BSP_NRF5340_NET_ENABLE:
BSP_NRF5340_NET_FLASH_ENABLE: 1
BLE_HCI_VS: 1

syscfg.vals.'BSP_NRF5340_NET_ENABLE && BLE_TRANSPORT_LL != "ipc"':
BSP_NRF5340_NET_FLASH_ENABLE: 1

syscfg.vals.BSP_NRF5340_NET_FLASH_ENABLE:
IPC_NRF5340_CHANNELS: 4

syscfg.vals.IPC_NRF5340_FLASH_CLIENT:
HAL_FLASH_MAX_DEVICE_COUNT: 3

syscfg.vals.'BLE_TRANSPORT_LL=="ipc" || BLE_TRANSPORT_IPC_BACKEND=="icbmsg"':
# The APP core have the same values but switched directions
BLE_TRANSPORT_IPC_TX_CHANNEL: 0
BLE_TRANSPORT_IPC_RX_CHANNEL: 1
IPC_SYNC_TX_CHANNEL: 0
IPC_SYNC_RX_CHANNEL: 1
IPC_ICBMSG_TX_REGION_NAME: "\".ipc0_tx\""
IPC_ICBMSG_RX_REGION_NAME: "\".ipc0_rx\""
IPC_ICBMSG_NUM_TX_BLOCKS: 16
IPC_ICBMSG_NUM_RX_BLOCKS: 24
IPC_ICBMSG_TX_REGION_SIZE: 0x4000
IPC_ICBMSG_RX_REGION_SIZE: 0x4000

syscfg.restrictions.BSP_NRF5340_NET_FLASH_ENABLE:
- 'IPC_NRF5340_CHANNELS >= 4'

Expand Down
2 changes: 2 additions & 0 deletions hw/bsp/nordic_pca10095_net/boot-nrf5340_net.ld
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ MEMORY
FLASH (rx) : ORIGIN = 0x01000000, LENGTH = 0x4000
RAM (rwx) : ORIGIN = 0x21000000, LENGTH = 0x10000
IPC (rw) : ORIGIN = 0x20000400, LENGTH = 0x400
sram_ipc0_tx (rw) : ORIGIN = 0x20070000, LENGTH = 0x4000
sram_ipc0_rx (rw) : ORIGIN = 0x20074000, LENGTH = 0x4000
}

/* The bootloader does not contain an image header */
Expand Down
2 changes: 2 additions & 0 deletions hw/bsp/nordic_pca10095_net/nrf5340_net.ld
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ MEMORY
FLASH (rx) : ORIGIN = 0x01008000, LENGTH = 0x30000
RAM (rwx) : ORIGIN = 0x21000000, LENGTH = 0x10000
IPC (rw) : ORIGIN = 0x20000400, LENGTH = 0x400
sram_ipc0_tx (rw) : ORIGIN = 0x20070000, LENGTH = 0x4000
sram_ipc0_rx (rw) : ORIGIN = 0x20074000, LENGTH = 0x4000
}

/* This linker script is used for images and thus contains an image header */
Expand Down
2 changes: 2 additions & 0 deletions hw/bsp/nordic_pca10095_net/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ pkg.deps:
- "@apache-mynewt-core/hw/scripts"
- "@apache-mynewt-core/hw/mcu/nordic/nrf5340_net"
- "@apache-mynewt-core/libc"

pkg.deps.'BLE_TRANSPORT == 1 && BLE_TRANSPORT_HS != "ipc"':
- "@apache-mynewt-core/sys/flash_map"
- "@apache-mynewt-core/hw/drivers/flash/ipc_nrf5340_flash"
13 changes: 13 additions & 0 deletions hw/bsp/nordic_pca10095_net/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,16 @@ syscfg.vals.BLE_CONTROLLER:

syscfg.vals.BLE_TRANSPORT:
BLE_TRANSPORT_HS: nrf5340

syscfg.vals.'BLE_TRANSPORT_HS=="ipc" || BLE_TRANSPORT_IPC_BACKEND=="icbmsg"':
# The APP core have the same values but switched directions
BLE_TRANSPORT_IPC_TX_CHANNEL: 1
BLE_TRANSPORT_IPC_RX_CHANNEL: 0
IPC_SYNC_TX_CHANNEL: 1
IPC_SYNC_RX_CHANNEL: 0
IPC_ICBMSG_TX_REGION_NAME: "\".ipc0_rx\""
IPC_ICBMSG_RX_REGION_NAME: "\".ipc0_tx\""
IPC_ICBMSG_NUM_TX_BLOCKS: 24
IPC_ICBMSG_NUM_RX_BLOCKS: 16
IPC_ICBMSG_TX_REGION_SIZE: 0x4000
IPC_ICBMSG_RX_REGION_SIZE: 0x4000
27 changes: 27 additions & 0 deletions hw/bsp/nordic_pca10175/boot-nrf54h20.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
MEMORY
{
FLASH (rx) : ORIGIN = 0x01000000, LENGTH = 0x4000
RAM (rwx) : ORIGIN = 0x21000000, LENGTH = 0x10000
IPC (rw) : ORIGIN = 0x20000400, LENGTH = 0x400
}

/* The bootloader does not contain an image header */
_imghdr_size = 0x0;
72 changes: 72 additions & 0 deletions hw/bsp/nordic_pca10175/bsp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

bsp.name: "nRF54H20 DK (Net Core)"
bsp.url: https://www.nordicsemi.com/Software-and-tools/Development-Kits/nRF54H20-DK
bsp.maker: "Nordic Semiconductor"
bsp.arch: cortex_m33
bsp.exclude_site: 1
bsp.compiler: "@apache-mynewt-core/compiler/arm-none-eabi-m33"
bsp.linkerscript:
- "hw/bsp/nordic_pca10175/nrf54h20.ld"
- "@apache-mynewt-core/hw/mcu/nordic/nrf54h20/nrf54h20.ld"
bsp.linkerscript.BOOT_LOADER.OVERWRITE:
- "hw/bsp/nordic_pca10175/boot-nrf54h20.ld"
- "@apache-mynewt-core/hw/mcu/nordic/nrf54h20/nrf54h20.ld"
bsp.part2linkerscript: "hw/bsp/nordic_pca10175/split-nordic_pca10175.ld"
bsp.downloadscript: "hw/scripts/download.sh"
bsp.debugscript: "hw/bsp/nordic_pca10175/nordic_pca10175_debug.sh"

bsp.flash_map:
areas:
# System areas.
FLASH_AREA_BOOTLOADER:
device: 0
offset: 0x01000000
size: 16kB
FLASH_AREA_IMAGE_0:
device: 0
offset: 0x01008000
size: 128kB
FLASH_AREA_COREDUMP:
user_id: 2
device: 0
offset: 0x01028000
size: 68kB
# This maps to app flash and uses vflash
FLASH_AREA_IMAGE_1:
device: 1
offset: 0x00000000
size: 128kB
FLASH_AREA_IMAGE_SCRATCH:
device: 0
offset: 0x0103a000
size: 8kB

# User areas.
FLASH_AREA_REBOOT_LOG:
user_id: 0
device: 0
offset: 0x01004000
size: 16kB
FLASH_AREA_NFFS:
user_id: 1
device: 0
offset: 0x010fc000
size: 16kB
89 changes: 89 additions & 0 deletions hw/bsp/nordic_pca10175/include/bsp/bsp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

#ifndef _BSP_H_
#define _BSP_H_

#include <inttypes.h>

#ifdef __cplusplus
extern "C" {
#endif

/* Define special stackos sections */
#define sec_data_core __attribute__((section(".data.core")))
#define sec_bss_core __attribute__((section(".bss.core")))
#define sec_bss_nz_core __attribute__((section(".bss.core.nz")))

/* More convenient section placement macros. */
#define bssnz_t sec_bss_nz_core

extern uint8_t _ram_start;
#define RAM_SIZE 0x10000

/* LED pins */
#define LED_1 (288)
#define LED_2 (289)
#define LED_3 (290)
#define LED_4 (291)
#define LED_BLINK_PIN (LED_3)

/* Buttons */
#define BUTTON_1 (8)
#define BUTTON_2 (9)
#define BUTTON_3 (10)
#define BUTTON_4 (11)

/* Arduino pins */
#define ARDUINO_PIN_D0 32
#define ARDUINO_PIN_D1 33
#define ARDUINO_PIN_D2 36
#define ARDUINO_PIN_D3 37
#define ARDUINO_PIN_D4 38
#define ARDUINO_PIN_D5 39
#define ARDUINO_PIN_D6 40
#define ARDUINO_PIN_D7 41
#define ARDUINO_PIN_D8 42
#define ARDUINO_PIN_D9 43
#define ARDUINO_PIN_D10 44
#define ARDUINO_PIN_D11 45
#define ARDUINO_PIN_D12 46
#define ARDUINO_PIN_D13 47
#define ARDUINO_PIN_A0 4
#define ARDUINO_PIN_A1 5
#define ARDUINO_PIN_A2 6
#define ARDUINO_PIN_A3 7
#define ARDUINO_PIN_A4 25
#define ARDUINO_PIN_A5 26

#define ARDUINO_PIN_RX ARDUINO_PIN_D0
#define ARDUINO_PIN_TX ARDUINO_PIN_D1

#define ARDUINO_PIN_SCL 35
#define ARDUINO_PIN_SDA 34

#define ARDUINO_PIN_SCK ARDUINO_PIN_D13
#define ARDUINO_PIN_MOSI ARDUINO_PIN_D11
#define ARDUINO_PIN_MISO ARDUINO_PIN_D12

#ifdef __cplusplus
}
#endif

#endif /* _BSP_H_ */
40 changes: 40 additions & 0 deletions hw/bsp/nordic_pca10175/nordic_pca10175_debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

# Called with following variables set:
# - CORE_PATH is absolute path to @apache-mynewt-core
# - BSP_PATH is absolute path to hw/bsp/bsp_name
# - BIN_BASENAME is the path to prefix to target binary,
# .elf appended to name is the ELF file
# - FEATURES holds the target features string
# - EXTRA_JTAG_CMD holds extra parameters to pass to jtag software
# - RESET set if target should be reset when attaching
# - NO_GDB set if we should not start gdb to debug
#

#Use custom ports for debuging so that newt debug works on both cores
EXTRA_JTAG_CMD="-port 3333"

. $CORE_PATH/hw/scripts/jlink.sh

FILE_NAME=$BIN_BASENAME.elf
JLINK_DEV="nrf54h20_xxaa_app"

jlink_debug

40 changes: 40 additions & 0 deletions hw/bsp/nordic_pca10175/nordic_pca10175_download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Called with following variables set:
# - CORE_PATH is absolute path to @apache-mynewt-core
# - BSP_PATH is absolute path to hw/bsp/bsp_name
# - BIN_BASENAME is the path to prefix to target binary,
# .elf appended to name is the ELF file
# - IMAGE_SLOT is the image slot to download to (for non-mfg-image, non-boot)
# - FEATURES holds the target features string
# - EXTRA_JTAG_CMD holds extra parameters to pass to jtag software
# - MFG_IMAGE is "1" if this is a manufacturing image
# - FLASH_OFFSET contains the flash offset to download to
# - BOOT_LOADER is set if downloading a bootloader

. $CORE_PATH/hw/scripts/jlink.sh

if [ "$MFG_IMAGE" ]; then
FLASH_OFFSET=0x01000000
fi

JLINK_DEV="nrf54h20_xxaa_app"

common_file_to_load
jlink_load
Loading