-
Notifications
You must be signed in to change notification settings - Fork 158
Adding a sysbuild example #83
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
base: main
Are you sure you want to change the base?
Changes from all commits
cd8915e
853c022
69357ca
519a6f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (c) 2021 Nordic Semiconductor ASA | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/* This devicetree overlay file will be automatically picked by the Zephyr | ||
* build system when building the sample for the nucleo_f413zh board. It shows | ||
* how the example-application can be built on sample boards already provided | ||
* by Zephyr. | ||
*/ | ||
|
||
/ { | ||
example_sensor: example-sensor { | ||
compatible = "zephyr,example-sensor"; | ||
input-gpios = <&gpioc 13 (GPIO_ACTIVE_HIGH)>; | ||
}; | ||
|
||
blink_led: blink-led { | ||
compatible = "blink-gpio-led"; | ||
led-gpios = <&gpiob 0 GPIO_ACTIVE_HIGH>; | ||
blink-period-ms = <1000>; | ||
}; | ||
}; | ||
|
||
&gpioc { | ||
status = "okay"; | ||
}; | ||
|
||
&gpiob { | ||
status = "okay"; | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Author: James Walmsley <james@fullfat-fs.co.uk> | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
test_sysbuild() | ||
|
||
project(hello_world) | ||
|
||
target_sources(app PRIVATE mfg_image/src/main.c) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this will confuse people a lot. I feel like the main image should have its own source files, so that all 3 images will do something distinct, even if it is just printing different logs. The README and possibly some comments in the code can then highlight what the images could do in a "full" implementation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I was also confused that the top-level CMake generates an app. And the others are just extra. |
||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,11 @@ | ||||||
# Example Sysbuild Project | ||||||
|
||||||
The aim of this folder is to demonstrate a typical sysbuild project from the ground-up. | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is the example application project, we want to explain as much as possible here. We should assume that the reader knows very little about Zephyr. I would add more text here explaining what exactly sysbuild is (link to the docs), and explain what exactly will be built, and what the expected use-case for those build targets/aretifacts is. A newbie should be pointed into the correct direction, to the right docs, so they can learn further. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea! I'll try to write a "getting started" guide from my understanding, and simple explanations of the concepts. I'll need you help to review, and correct any mis-understandings I have. |
||||||
## Build | ||||||
|
||||||
``` | ||||||
cd my-workspace/example-application | ||||||
west build --sysbuild sysbuild | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this not be
Suggested change
? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, yes I renamed the folder from |
||||||
``` | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright (c) 2025 James Walmsley <james@fullfat-fs.co.uk> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
find_package(Zephyr REQUIRED HINTS $ENV{ZPEHYR_BASE}) | ||
|
||
project(dfu_app) | ||
target_sources(app PRIVATE src/main.c) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CONFIG_BOOTLOADER_MCUBOOT=y | ||
CONFIG_MCUBOOT_SIGNATURE_KEY_FILE="bootloader/mcuboot/root-rsa-2048.pem" | ||
CONFIG_FLASH=y | ||
CONFIG_IMG_MANAGER=y | ||
CONFIG_STREAM_FLASH=y | ||
CONFIG_USB_DFU_CLASS=y | ||
CONFIG_USB_DEVICE_STACK=y | ||
CONFIG_FLASH_MAP=y | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright (c) 2025 James Walmsley | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/sys/printk.h> | ||
|
||
int main(void) | ||
{ | ||
printk("Hello world from %s\n", CONFIG_BOARD_TARGET); | ||
|
||
return 0; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright (c) 2025 James Walmsley <james@fullfat-fs.co.uk> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
find_package(Zephyr REQUIRED HINTS $ENV{ZPEHYR_BASE}) | ||
|
||
project(mfg_image) | ||
target_sources(app PRIVATE src/main.c) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CONFIG_BOOTLOADER_MCUBOOT=y |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright (c) 2025 James Walmsley | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/sys/printk.h> | ||
|
||
int main(void) | ||
{ | ||
printk("Manufacturing image on: %s\n", CONFIG_BOARD_TARGET); | ||
|
||
return 0; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) 2025 James Walmsley <james@fullfat-fs.co.uk> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
ExternalZephyrProject_Add( | ||
APPLICATION mfg_image | ||
SOURCE_DIR ${APP_DIR}/mfg_image | ||
) | ||
|
||
ExternalZephyrProject_Add( | ||
APPLICATION dfu_app | ||
SOURCE_DIR ${APP_DIR}/dfu_app | ||
) | ||
|
||
add_dependencies(${DEFAULT_IMAGE} mfg_image) | ||
add_dependencies(${DEFAULT_IMAGE} dfu_app) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SB_CONFIG_BOOTLOADER_MCUBOOT=y |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CONFIG_BOOT_SWAP_USING_SCRATCH=y | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add the required flag, since the whole point is to show sysbuild?
If not, the the README should highlight what happens when building with sysbuild and when building without.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Yes sysbuild() is REQUIRED.