Skip to content

Commit a0267d2

Browse files
nordicjmfabiobaltieri
authored andcommitted
west: runners: Add run once commands and deferred reset
This adds supports for flashing images with sysbuild where there are multiple images per board to prevent using the same command per image flash which might cause issues if they are not ran just once per flash per unique board name. A deferred reset feature is also introduced that prevents a board (or multiple) from being reset if multiple images are to be flashed until the final one has been flashed which prevents issues with e.g. security bits being enabled that then prevent flashing further images. These options can be set at a board level (in board.yml) or a SoC level (in soc.yml), if both are present then the board configuration will be used instead of the SoC, and regex can be used for matching of partial names which allows for matching specific SoCs or CPU cores regardless of the board being used Signed-off-by: Jamie McCrae <[email protected]>
1 parent 568e777 commit a0267d2

File tree

4 files changed

+318
-10
lines changed

4 files changed

+318
-10
lines changed

cmake/modules/soc_v2.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ if(HWMv2)
2727
set(SOC_TOOLCHAIN_NAME ${CONFIG_SOC_TOOLCHAIN_NAME})
2828
set(SOC_FAMILY ${CONFIG_SOC_FAMILY})
2929
set(SOC_V2_DIR ${SOC_${SOC_NAME}_DIR})
30-
set(SOC_FULL_DIR ${SOC_V2_DIR})
30+
set(SOC_FULL_DIR ${SOC_V2_DIR} CACHE PATH "Path to the SoC directory." FORCE)
3131
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${SOC_V2_DIR}/soc.yml)
3232
endif()

scripts/schemas/board-schema.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,54 @@ mapping:
7878
type: seq
7979
sequence:
8080
- include: board-schema
81+
runners:
82+
type: map
83+
mapping:
84+
run_once:
85+
type: map
86+
desc: |
87+
Allows for restricting west flash commands when using sysbuild to run once per given
88+
grouping of board targets. This is to allow for future image program cycles to not
89+
erase the flash of a device which has just been programmed by another image.
90+
mapping:
91+
regex;(.*):
92+
type: seq
93+
desc: |
94+
A dictionary of commands which should be limited to running once per invocation
95+
of west flash for a given set of flash runners and board targets.
96+
sequence:
97+
- type: map
98+
mapping:
99+
run:
100+
required: true
101+
type: str
102+
enum: ['first', 'last']
103+
desc: |
104+
If first, will run this command once when the first image is flashed, if
105+
last, will run this command once when the final image is flashed.
106+
runners:
107+
required: true
108+
type: seq
109+
sequence:
110+
- type: str
111+
desc: |
112+
A list of flash runners that this applies to, can use `all` to apply
113+
to all runners.
114+
groups:
115+
required: true
116+
type: seq
117+
sequence:
118+
- type: map
119+
desc: |
120+
A grouping of board targets which the command should apply to. Can
121+
be used multiple times to have multiple groups.
122+
mapping:
123+
boards:
124+
required: true
125+
type: seq
126+
sequence:
127+
- type: str
128+
desc: |
129+
A board target to match against in regex. Must be one entry
130+
per board target, a single regex entry will not match two
131+
board targets even if they both match.

scripts/schemas/soc-schema.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,54 @@ mapping:
7070
required: false
7171
type: str
7272
desc: Free form comment with extra information regarding the SoC.
73+
runners:
74+
type: map
75+
mapping:
76+
run_once:
77+
type: map
78+
desc: |
79+
Allows for restricting west flash commands when using sysbuild to run once per given
80+
grouping of board targets. This is to allow for future image program cycles to not
81+
erase the flash of a device which has just been programmed by another image.
82+
mapping:
83+
regex;(.*):
84+
type: seq
85+
desc: |
86+
A dictionary of commands which should be limited to running once per invocation
87+
of west flash for a given set of flash runners and board targets.
88+
sequence:
89+
- type: map
90+
mapping:
91+
run:
92+
required: true
93+
type: str
94+
enum: ['first', 'last']
95+
desc: |
96+
If first, will run this command once when the first image is flashed, if
97+
last, will run this command once when the final image is flashed.
98+
runners:
99+
required: true
100+
type: seq
101+
sequence:
102+
- type: str
103+
desc: |
104+
A list of flash runners that this applies to, can use `all` to apply
105+
to all runners.
106+
groups:
107+
required: true
108+
type: seq
109+
sequence:
110+
- type: map
111+
desc: |
112+
A grouping of board targets which the command should apply to. Can
113+
be used multiple times to have multiple groups.
114+
mapping:
115+
qualifiers:
116+
required: true
117+
type: seq
118+
sequence:
119+
- type: str
120+
desc: |
121+
A board qualifier to match against in regex form. Must be one
122+
entry per board target, a single regex entry will not match
123+
two board targets even if they both match.

0 commit comments

Comments
 (0)