Skip to content

Commit 7ac63d8

Browse files
committed
Add initial support for Nordic nRF54L15
This adds initial support for Nordic nRF54L15. GPIO, timers and UART is implemented. Support for GRTC is still to be added.
1 parent 5f8038e commit 7ac63d8

33 files changed

+5497
-12
lines changed

hw/bsp/nordic_pca10156/boot-nrf54.ld

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
MEMORY
20+
{
21+
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x8000
22+
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x40000
23+
}
24+
25+
/* The bootloader does not contain an image header */
26+
_imghdr_size = 0x0;

hw/bsp/nordic_pca10156/bsp.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
bsp.name: "nRF54L15 PDK"
21+
bsp.url:
22+
bsp.maker: "Nordic Semiconductor"
23+
bsp.arch: cortex_m33
24+
bsp.compiler: "@apache-mynewt-core/compiler/arm-none-eabi-m33"
25+
bsp.linkerscript: autogenerated
26+
bsp.downloadscript: "hw/scripts/download.sh"
27+
bsp.debugscript: "hw/bsp/nordic_pca10156/nordic_pca10156_debug.sh"
28+
29+
bsp.flash_map:
30+
areas:
31+
# System areas.
32+
FLASH_AREA_BOOTLOADER:
33+
device: 0
34+
offset: 0x00000000
35+
size: 32kB
36+
FLASH_AREA_IMAGE_0:
37+
device: 0
38+
offset: 0x0000c000
39+
size: 722kB
40+
FLASH_AREA_IMAGE_1:
41+
device: 0
42+
offset: 0x000C0800
43+
size: 722kB
44+
FLASH_AREA_IMAGE_SCRATCH:
45+
device: 0
46+
offset: 0x00175000
47+
size: 16kB
48+
49+
# User areas.
50+
FLASH_AREA_REBOOT_LOG:
51+
user_id: 0
52+
device: 0
53+
offset: 0x00008000
54+
size: 16kB
55+
FLASH_AREA_NFFS:
56+
user_id: 1
57+
device: 0
58+
offset: 0x00179000
59+
size: 16kB
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
#ifndef _BSP_H_
21+
#define _BSP_H_
22+
23+
#include <inttypes.h>
24+
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
/* Define special stackos sections */
30+
#define sec_data_core __attribute__((section(".data.core")))
31+
#define sec_bss_core __attribute__((section(".bss.core")))
32+
#define sec_bss_nz_core __attribute__((section(".bss.core.nz")))
33+
34+
/* More convenient section placement macros. */
35+
#define bssnz_t sec_bss_nz_core
36+
37+
extern uint8_t _ram_start;
38+
#define RAM_SIZE 0x40000
39+
40+
/* LED pins */
41+
#define LED_1 (73)
42+
#define LED_2 (42)
43+
#define LED_3 (71)
44+
#define LED_4 (46)
45+
#define LED_BLINK_PIN (LED_1)
46+
47+
/* Buttons */
48+
#define BUTTON_1 (45)
49+
#define BUTTON_2 (41)
50+
#define BUTTON_3 (40)
51+
#define BUTTON_4 (4)
52+
53+
#ifdef __cplusplus
54+
}
55+
#endif
56+
57+
#endif /* _BSP_H_ */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/sh
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
# Called with following variables set:
21+
# - CORE_PATH is absolute path to @apache-mynewt-core
22+
# - BSP_PATH is absolute path to hw/bsp/bsp_name
23+
# - BIN_BASENAME is the path to prefix to target binary,
24+
# .elf appended to name is the ELF file
25+
# - FEATURES holds the target features string
26+
# - EXTRA_JTAG_CMD holds extra parameters to pass to jtag software
27+
# - RESET set if target should be reset when attaching
28+
# - NO_GDB set if we should not start gdb to debug
29+
#
30+
31+
. $CORE_PATH/hw/scripts/jlink.sh
32+
33+
FILE_NAME=$BIN_BASENAME.elf
34+
JLINK_DEV="Cortex-M33"
35+
36+
jlink_debug
37+

hw/bsp/nordic_pca10156/nrf54.ld

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
MEMORY
20+
{
21+
FLASH (rx) : ORIGIN = 0x00008000, LENGTH = 0x171000
22+
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x40000
23+
}
24+
25+
/* This linker script is used for images and thus contains an image header */
26+
_imghdr_size = 0x20;

hw/bsp/nordic_pca10156/pkg.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
pkg.name: hw/bsp/nordic_pca10156
21+
pkg.type: bsp
22+
pkg.description: BSP definition for the Nordic PCA10156 (nRF54L15-PDK)
23+
pkg.author: "Apache Mynewt <[email protected]>"
24+
pkg.homepage: "http://mynewt.apache.org/"
25+
pkg.keywords:
26+
- nrf54
27+
- nordic
28+
- pca10156
29+
30+
pkg.cflags:
31+
- '-DNRF54L15_XXAA'
32+
- '-DNRF_APPLICATION'
33+
34+
pkg.cflags.HARDFLOAT:
35+
- -mfloat-abi=hard -mfpu=fpv4-sp-d16
36+
37+
pkg.deps:
38+
- "@apache-mynewt-core/hw/scripts"
39+
- "@apache-mynewt-core/hw/mcu/nordic/nrf54lxx"
40+
- "@apache-mynewt-core/libc/baselibc"
41+
- "@apache-mynewt-core/sys/flash_map"
42+
- "@apache-mynewt-core/boot/startup"
43+
44+
pkg.deps.SOFT_PWM:
45+
- "@apache-mynewt-core/hw/drivers/pwm/soft_pwm"

hw/bsp/nordic_pca10156/src/hal_bsp.c

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
#include <stdint.h>
21+
#include <stddef.h>
22+
#include <assert.h>
23+
#include <os/mynewt.h>
24+
#include <nrfx.h>
25+
#include <flash_map/flash_map.h>
26+
#include <hal/hal_bsp.h>
27+
#include <hal/hal_flash.h>
28+
#include <hal/hal_system.h>
29+
#include <mcu/nrf54l_hal.h>
30+
#include <mcu/nrf54l_periph.h>
31+
#include <bsp/bsp.h>
32+
33+
/*
34+
* What memory to include in coredump.
35+
*/
36+
static const struct hal_bsp_mem_dump dump_cfg[] = {
37+
[0] = {
38+
.hbmd_start = &_ram_start,
39+
.hbmd_size = RAM_SIZE
40+
}
41+
};
42+
43+
const struct hal_flash *
44+
hal_bsp_flash_dev(uint8_t id)
45+
{
46+
/*
47+
* Internal flash mapped to id 0.
48+
*/
49+
if (id == 0) {
50+
return &nrf54l_flash_dev;
51+
}
52+
53+
return NULL;
54+
}
55+
56+
const struct hal_bsp_mem_dump *
57+
hal_bsp_core_dump(int *area_cnt)
58+
{
59+
*area_cnt = sizeof(dump_cfg) / sizeof(dump_cfg[0]);
60+
return dump_cfg;
61+
}
62+
63+
int
64+
hal_bsp_power_state(int state)
65+
{
66+
return 0;
67+
}
68+
69+
void
70+
hal_bsp_init(void)
71+
{
72+
/* Make sure system clocks have started */
73+
hal_system_clock_start();
74+
75+
/* Create all available nRF54 peripherals */
76+
nrf54l_periph_create();
77+
}
78+
79+
void
80+
hal_bsp_deinit(void)
81+
{
82+
}

hw/bsp/nordic_pca10156/src/sbrk.c

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
#include <hal/hal_bsp.h>
21+
22+
/* put these in the data section so they are not cleared by _start */
23+
static char *sbrkBase __attribute__ ((section (".data")));
24+
static char *sbrkLimit __attribute__ ((section (".data")));
25+
static char *brk __attribute__ ((section (".data")));
26+
27+
void
28+
_sbrkInit(char *base, char *limit)
29+
{
30+
sbrkBase = base;
31+
sbrkLimit = limit;
32+
brk = base;
33+
}
34+
35+
void *
36+
_sbrk(int incr)
37+
{
38+
void *prev_brk;
39+
40+
if (incr < 0) {
41+
/* Returning memory to the heap. */
42+
incr = -incr;
43+
if (brk - incr < sbrkBase) {
44+
prev_brk = (void *)-1;
45+
} else {
46+
prev_brk = brk;
47+
brk -= incr;
48+
}
49+
} else {
50+
/* Allocating memory from the heap. */
51+
if (sbrkLimit - brk >= incr) {
52+
prev_brk = brk;
53+
brk += incr;
54+
} else {
55+
prev_brk = (void *)-1;
56+
}
57+
}
58+
59+
return prev_brk;
60+
}

0 commit comments

Comments
 (0)