Skip to content

Commit 7ceb030

Browse files
authored
Add nrf52820 HIC (#882)
2 parents b462003 + 3df6695 commit 7ceb030

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+69196
-16
lines changed

docs/hic/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
| [lpc4322](lpc4322.md) | M4 | 96 MHz | 256 KB | 256 KB | HS |
1111
| [lpc55xx](lpc55xx.md) | M33 | 150 MHz | 272 KB | 320 KB | HS |
1212
| [max32625](max32625.md) | M4 | 96 MHz | 160 KB | 512 KB | FS |
13+
| [nrf52820](nrf52820.md) | M4 | 64 MHz | 32 KB | 256 KB | FS |
1314
| [sam3u2c](sam3u2c.md) | M3 | 96 MHz | 32 KB | 128 KB | HS |
1415
| [stm32f103xb](stm32f103xb.md) | M3 | 72 Mhz | 20 KB | 128 KB | FS |
15-

docs/hic/nrf52820.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# nrf52820 HIC
2+
3+
Based on Nordic [nRF52820](https://www.nordicsemi.com/Products/nRF52820)
4+
and [nRF52833](https://www.nordicsemi.com/Products/nRF52833):
5+
- Cortex-M4 64 MHz
6+
- 256 KB Flash
7+
- 32 KB RAM
8+
- Full-speed USB 2.0 device controller
9+
- QFN40 packaging
10+
11+
## Memory Map
12+
13+
| Region | Size | Start | End |
14+
|----------|--------|-------------|-------------|
15+
| Flash | 128 KB | 0x0000_0000 | 0x0002_0000 |
16+
| SRAM | 32 KB | 0x2000_0000 | 0x2000_8000 |
17+
18+
Bootloader size is 32 KB
19+
Limiting flash usage to 128 KB
20+
21+
## DAPLink default pin assignment
22+
23+
# nrf52820
24+
25+
| Signal | I/O | Symbol | Pin |
26+
|-------------|:---:|---------|:---:|
27+
| SWD |
28+
| SWCLK | O | P0.01 | 3 |
29+
| SWDIO | I/O | P0.00 | 2 |
30+
| UART |
31+
| UART TX | I | P0.29 | 32 |
32+
| UART RX | O | P0.08 | 31 |
33+
| Button |
34+
| F-RST But. | I | P0.06 | 6 |
35+
| LEDs |
36+
| HID LED | O | P0.14 | 14 |
37+
| MSD LED | O | P0.14 | 14 |
38+
| CDC LED | O | P0.14 | 14 |
39+
| POWER LED | O | P0.15 | 15 |
40+
41+
Note:
42+
- LEDs have active state high.
43+
44+
# nrf52833
45+
46+
| Signal | I/O | Symbol | Pin |
47+
|-------------|:---:|---------|:---:|
48+
| SWD |
49+
| SWCLK | O | P0.01 | 3 |
50+
| SWDIO | I/O | P0.00 | 2 |
51+
| UART |
52+
| UART TX | I | P0.02 | 32 |
53+
| UART RX | O | P0.03 | 31 |
54+
| Button |
55+
| F-RST But. | I | P1.09 | 6 |
56+
| LEDs |
57+
| HID LED | O | P0.15 | 14 |
58+
| MSD LED | O | P0.15 | 14 |
59+
| CDC LED | O | P0.15 | 14 |
60+
| POWER LED | O | P0.17 | 15 |
61+
62+
Note:
63+
- LEDs have active state high.

projects.yaml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,25 @@ module:
6666
- records/rtos/rtos-cm33.yaml
6767
- records/hic_hal/lpc55s69.yaml
6868
- records/usb/usb-bulk.yaml
69-
hic_sam3u2c: &module_hic_sam3u2c
70-
- records/rtos/rtos-cm3.yaml
71-
- records/hic_hal/sam3u2c.yaml
72-
hic_stm32f103xb: &module_hic_stm32f103xb
73-
- records/rtos/rtos-cm3.yaml
74-
- records/hic_hal/stm32f103xb.yaml
69+
hic_m48ssidae: &module_hic_m48ssidae
70+
- records/rtos/rtos-cm4.yaml
71+
- records/hic_hal/m48ssidae.yaml
7572
hic_max32620: &module_hic_max32620
7673
- records/rtos/rtos-cm4.yaml
7774
- records/hic_hal/max32620.yaml
7875
hic_max32625: &module_hic_max32625
7976
- records/rtos/rtos-cm4.yaml
8077
- records/hic_hal/max32625.yaml
81-
hic_m48ssidae: &module_hic_m48ssidae
78+
hic_nrf52820: &module_hic_nrf52820
8279
- records/rtos/rtos-cm4.yaml
83-
- records/hic_hal/m48ssidae.yaml
80+
- records/hic_hal/nrf52820.yaml
81+
- records/usb/usb-bulk.yaml
82+
hic_sam3u2c: &module_hic_sam3u2c
83+
- records/rtos/rtos-cm3.yaml
84+
- records/hic_hal/sam3u2c.yaml
85+
hic_stm32f103xb: &module_hic_stm32f103xb
86+
- records/rtos/rtos-cm3.yaml
87+
- records/hic_hal/stm32f103xb.yaml
8488

8589
projects:
8690
# HIC bootloaders and all target interfaces
@@ -160,6 +164,14 @@ projects:
160164
- *module_hic_max32625
161165
- records/family/all_family.yaml
162166
- records/usb/usb-bulk.yaml
167+
nrf52820_bl:
168+
- *module_bl
169+
- records/hic_hal/nrf52820.yaml
170+
- records/board/nrf52820_bl.yaml
171+
nrf52820_if:
172+
- *module_if
173+
- *module_hic_nrf52820
174+
- records/family/all_family.yaml
163175
sam3u2c_bl:
164176
- *module_bl
165177
- records/hic_hal/sam3u2c.yaml

records/board/nrf52820_bl.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
common:
2+
sources:
3+
board:
4+
- source/board/nrf52820_bl.c

records/hic_hal/nrf52820.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
common:
2+
target:
3+
- Cortex-M4
4+
core:
5+
- Cortex-M4
6+
macros:
7+
- INTERFACE_NRF52820
8+
- NRF52820_XXAA
9+
- DAPLINK_HIC_ID=0x6E052820 # DAPLINK_HIC_ID_NRF52820
10+
- OS_CLOCK=64000000
11+
- __DAPLINK
12+
includes:
13+
- source/hic_hal/nordic/nrf52820
14+
- source/hic_hal/nordic/nrf52820/cmsis
15+
- source/hic_hal/nordic/nrf52820/nrfx
16+
- source/hic_hal/nordic/nrf52820/nrfx/drivers
17+
- source/hic_hal/nordic/nrf52820/nrfx/drivers/include
18+
- source/hic_hal/nordic/nrf52820/nrfx/hal
19+
- source/hic_hal/nordic/nrf52820/nrfx/mdk
20+
sources:
21+
hic_hal:
22+
- source/hic_hal/nordic/nrf52820
23+
- source/hic_hal/nordic/nrf52820/cmsis
24+
- source/hic_hal/nordic/nrf52820/nrfx/drivers
25+
26+
tool_specific:
27+
uvision:
28+
misc:
29+
ld_flags:
30+
- --predefine="-I..\..\..\source\hic_hal\nordic\nrf52820"
31+
sources:
32+
hic_hal:
33+
- source/hic_hal/nordic/nrf52820/armcc
34+
armcc:
35+
sources:
36+
hic_hal:
37+
- source/hic_hal/nordic/nrf52820/armcc
38+
armclang:
39+
misc:
40+
common_flags:
41+
- -mfpu=none
42+
sources:
43+
hic_hal:
44+
- source/hic_hal/nordic/nrf52820/armcc
45+
gcc_arm:
46+
sources:
47+
hic_hal:
48+
- source/hic_hal/nordic/nrf52820/gcc

source/board/nrf52820_bl.c

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* @file nrf52820_bl.c
3+
* @brief board ID and meta-data for HIC based on Nordic Semiconductor nRF52820
4+
*
5+
* DAPLink Interface Firmware
6+
* Copyright (c) 2009-2021, Arm Limited, All Rights Reserved
7+
* SPDX-License-Identifier: Apache-2.0
8+
*
9+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
10+
* not use this file except in compliance with the License.
11+
* You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software
16+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
* See the License for the specific language governing permissions and
19+
* limitations under the License.
20+
*/
21+
22+
#include "target_config.h"
23+
#include "daplink_addr.h"
24+
#include "compiler.h"
25+
#include "target_board.h"
26+
#include "target_family.h"
27+
28+
// Warning - changing the interface start will break backwards compatibility
29+
COMPILER_ASSERT(DAPLINK_ROM_IF_START == 0x00008000);
30+
COMPILER_ASSERT(DAPLINK_ROM_IF_SIZE == KB(92));
31+
32+
/**
33+
* List of start and size for each size of flash sector
34+
* The size will apply to all sectors between the listed address and the next address
35+
* in the list.
36+
* The last pair in the list will have sectors starting at that address and ending
37+
* at address start + size.
38+
*/
39+
static const sector_info_t sectors_info[] = {
40+
{DAPLINK_ROM_IF_START, 0x1000},
41+
};
42+
43+
// nrf52820 target information
44+
target_cfg_t target_device = {
45+
.sectors_info = sectors_info,
46+
.sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)),
47+
.flash_regions[0].start = DAPLINK_ROM_IF_START,
48+
.flash_regions[0].end = DAPLINK_ROM_IF_START + DAPLINK_ROM_IF_SIZE,
49+
.flash_regions[0].flags = kRegionIsDefault,
50+
.ram_regions[0].start = DAPLINK_RAM_START,
51+
.ram_regions[0].end = DAPLINK_RAM_START + DAPLINK_RAM_SIZE,
52+
/* .flash_algo not needed for bootloader */
53+
};
54+
55+
// bootloader has no family
56+
const target_family_descriptor_t *g_target_family = NULL;
57+
58+
const board_info_t g_board_info = {
59+
.info_version = kBoardInfoVersion,
60+
.board_id = "0000",
61+
.daplink_url_name = "HELP_FAQHTM",
62+
.daplink_drive_name = "MAINTENANCE",
63+
.daplink_target_url = "https://mbed.com/daplink",
64+
.target_cfg = &target_device,
65+
};

source/daplink/daplink.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ COMPILER_ASSERT(DAPLINK_RAM_SHARED_START + DAPLINK_RAM_SHARED_SIZE == DAPLINK_RA
6767
#define DAPLINK_HIC_ID_LPC55XX 0x4C504355 // 'LPC\x55'
6868
#define DAPLINK_HIC_ID_M48SSIDAE 0x97969921
6969
#define DAPLINK_HIC_ID_PSOC5 0x2E127069
70+
#define DAPLINK_HIC_ID_NRF52820 0x6E052820 // 'n\x05\x28\x20'
7071
//@}
7172

7273
#define DAPLINK_INFO_OFFSET 0x20

source/daplink/interface/swd_host.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@
2222
*/
2323

2424
#ifndef TARGET_MCU_CORTEX_A
25+
#include "device.h"
2526
#include "cmsis_os2.h"
2627
#include "target_config.h"
27-
#include "swd_host.h"
28-
#include "debug_cm.h"
2928
#include "DAP_config.h"
3029
#include "DAP.h"
3130
#include "target_family.h"
32-
#include "device.h"
31+
#include "swd_host.h"
3332

3433
// Default NVIC and Core debug base addresses
3534
// TODO: Read these addresses from ROM.

source/daplink/interface/swd_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* DAPLink Interface Firmware
66
* Copyright (c) 2009-2019, ARM Limited, All Rights Reserved
7-
* Copyright 2019, Cypress Semiconductor Corporation
7+
* Copyright 2019, Cypress Semiconductor Corporation
88
* or a subsidiary of Cypress Semiconductor Corporation.
99
* SPDX-License-Identifier: Apache-2.0
1010
*

source/family/nordic/target_reset_nrf51.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
* limitations under the License.
2020
*/
2121

22-
#include "swd_host.h"
2322
#include "DAP_config.h"
2423
#include "target_family.h"
2524
#include "target_board.h"
25+
#include "swd_host.h"
2626

2727
static void swd_set_target_reset_nrf(uint8_t asserted)
2828
{

0 commit comments

Comments
 (0)