-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
211 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
# Copyright (c) 2016-2023 Makerdiary | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
board_runner_args(nrfjprog "--nrf-family=NRF52") | ||
board_runner_args(jlink "--device=nRF52840_xxAA" "--speed=4000") | ||
board_runner_args(pyocd "--target=nrf52840") | ||
board_runner_args(uf2 "--board-id=nRF52840-Connect-Kit") | ||
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (c) 2016-2023 Makerdiary | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/* Flash partition table compatible with MCUboot bootloader */ | ||
|
||
/delete-node/ &flash0 ; | ||
|
||
&flash0 { | ||
partitions { | ||
compatible = "fixed-partitions"; | ||
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
boot_partition: partition@0 { | ||
label = "mcuboot"; | ||
reg = <0x00000000 0x0000C000>; | ||
}; | ||
slot0_partition: partition@c000 { | ||
label = "image-0"; | ||
reg = <0x0000C000 0x00067000>; | ||
}; | ||
slot1_partition: partition@73000 { | ||
label = "image-1"; | ||
reg = <0x00073000 0x00067000>; | ||
}; | ||
scratch_partition: partition@da000 { | ||
label = "image-scratch"; | ||
reg = <0x000da000 0x0001e000>; | ||
}; | ||
|
||
/* | ||
* The flash starting at 0x000f8000 and ending at | ||
* 0x000fffff is reserved for use by the application. | ||
*/ | ||
|
||
/* | ||
* Storage partition will be used by FCB/LittleFS/NVS | ||
* if enabled. | ||
*/ | ||
storage_partition: partition@f8000 { | ||
label = "storage"; | ||
reg = <0x000f8000 0x00008000>; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
list(APPEND DTC_OVERLAY_FILE "${CMAKE_CURRENT_LIST_DIR}/boards/mcuboot.overlay") | ||
|
||
list(APPEND mcuboot_OVERLAY_CONFIG "${CMAKE_CURRENT_LIST_DIR}/boards/mcuboot.conf") | ||
list(APPEND mcuboot_DTC_OVERLAY_FILE "${CMAKE_CURRENT_LIST_DIR}/boards/mcuboot.overlay") | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(hello_world) | ||
|
||
target_sources(app PRIVATE src/main.c) |
15 changes: 15 additions & 0 deletions
15
samples/mcuboot_hello_world/boards/connectkit_nrf52840.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# Copyright (c) 2016-2023 Makerdiary | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
CONFIG_SERIAL=y | ||
CONFIG_CONSOLE=y | ||
CONFIG_UART_CONSOLE=y | ||
CONFIG_UART_LINE_CTRL=y | ||
|
||
# USB subsystem configuration | ||
CONFIG_USB_DEVICE_STACK=y | ||
CONFIG_USB_DEVICE_PRODUCT="Zephyr USB Console" | ||
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=y |
17 changes: 17 additions & 0 deletions
17
samples/mcuboot_hello_world/boards/connectkit_nrf52840.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright (c) 2016-2023 Makerdiary | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/ { | ||
chosen { | ||
zephyr,console = &cdc_acm_uart0; | ||
}; | ||
}; | ||
|
||
&zephyr_udc0 { | ||
cdc_acm_uart0: cdc_acm_uart0 { | ||
compatible = "zephyr,cdc-acm-uart"; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# Copyright (c) 2016-2023 Makerdiary | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
CONFIG_SERIAL=y | ||
CONFIG_CONSOLE=y | ||
CONFIG_UART_CONSOLE=y | ||
CONFIG_UART_LINE_CTRL=y | ||
|
||
# USB subsystem configuration | ||
CONFIG_USB_DEVICE_STACK=y | ||
CONFIG_USB_DEVICE_PRODUCT="Zephyr USB Console" | ||
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=y |
17 changes: 17 additions & 0 deletions
17
samples/mcuboot_hello_world/boards/dongle_nrf52840.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright (c) 2016-2023 Makerdiary | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/ { | ||
chosen { | ||
zephyr,console = &cdc_acm_uart0; | ||
}; | ||
}; | ||
|
||
&zephyr_udc0 { | ||
cdc_acm_uart0: cdc_acm_uart0 { | ||
compatible = "zephyr,cdc-acm-uart"; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CONFIG_MULTITHREADING=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2016-2023 Makerdiary | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/* Flash partition table compatible with MCUboot bootloader */ | ||
|
||
/delete-node/ &boot_partition; | ||
/delete-node/ &slot0_partition; | ||
/delete-node/ &storage_partition; | ||
|
||
&flash0 { | ||
partitions { | ||
compatible = "fixed-partitions"; | ||
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
boot_partition: partition@0 { | ||
label = "mcuboot"; | ||
reg = <0x00000000 0x0000C000>; | ||
}; | ||
slot0_partition: partition@c000 { | ||
label = "image-0"; | ||
reg = <0x0000C000 0x00067000>; | ||
}; | ||
slot1_partition: partition@73000 { | ||
label = "image-1"; | ||
reg = <0x00073000 0x00067000>; | ||
}; | ||
scratch_partition: partition@da000 { | ||
label = "image-scratch"; | ||
reg = <0x000da000 0x0001e000>; | ||
}; | ||
|
||
/* | ||
* The flash starting at 0x000f8000 and ending at | ||
* 0x000fffff is reserved for use by the application. | ||
*/ | ||
|
||
/* | ||
* Storage partition will be used by FCB/LittleFS/NVS | ||
* if enabled. | ||
*/ | ||
storage_partition: partition@f8000 { | ||
label = "storage"; | ||
reg = <0x000f8000 0x00008000>; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# nothing here | ||
CONFIG_BOOTLOADER_MCUBOOT=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
sample: | ||
name: Hello World sample | ||
common: | ||
build_only: true | ||
integration_platforms: | ||
- connectkit_nrf52840 | ||
- dongle_nrf52840 | ||
tests: | ||
sample.hello_world: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright (c) 2016-2023 Makerdiary | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/kernel.h> | ||
#include <zephyr/sys/printk.h> | ||
|
||
int main(void) | ||
{ | ||
while (1) { | ||
printk("Hello World with MCUboot enabled! %s\n", CONFIG_BOARD); | ||
k_sleep(K_SECONDS(1)); | ||
} | ||
return 0; | ||
} |