Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OpenSK
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
koenigl2
OpenSK
Commits
4a3ccb48
Commit
4a3ccb48
authored
5 years ago
by
Jean-Michel Picod
Browse files
Options
Downloads
Patches
Plain Diff
Allow flashing only the kernel without any app.
parent
b22832e9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
deploy.py
+41
-31
41 additions, 31 deletions
deploy.py
with
41 additions
and
31 deletions
deploy.py
+
41
−
31
View file @
4a3ccb48
...
@@ -485,25 +485,26 @@ class OpenSKInstaller:
...
@@ -485,25 +485,26 @@ class OpenSKInstaller:
kern_hex
.
frombytes
(
kernel
.
read
(),
offset
=
board_props
.
kernel_address
)
kern_hex
.
frombytes
(
kernel
.
read
(),
offset
=
board_props
.
kernel_address
)
final_hex
.
merge
(
kern_hex
,
overlap
=
"
error
"
)
final_hex
.
merge
(
kern_hex
,
overlap
=
"
error
"
)
# Add padding
if
self
.
args
.
application
:
if
board_props
.
padding_address
:
# Add padding
padding_hex
=
intelhex
.
IntelHex
()
if
board_props
.
padding_address
:
padding_hex
.
frombytes
(
padding_hex
=
intelhex
.
IntelHex
()
self
.
get_padding
(),
offset
=
board_props
.
padding_address
)
padding_hex
.
frombytes
(
final_hex
.
merge
(
padding_hex
,
overlap
=
"
error
"
)
self
.
get_padding
(),
offset
=
board_props
.
padding_address
)
final_hex
.
merge
(
padding_hex
,
overlap
=
"
error
"
)
# Now we can add the application from the TAB file
app_tab_path
=
"
target/tab/{}.tab
"
.
format
(
self
.
args
.
application
)
# Now we can add the application from the TAB file
assert
os
.
path
.
exists
(
app_tab_path
)
app_tab_path
=
"
target/tab/{}.tab
"
.
format
(
self
.
args
.
application
)
app_tab
=
tab
.
TAB
(
app_tab_path
)
assert
os
.
path
.
exists
(
app_tab_path
)
if
board_props
.
arch
not
in
app_tab
.
get_supported_architectures
():
app_tab
=
tab
.
TAB
(
app_tab_path
)
fatal
((
"
It seems that the TAB file was not produced for the
"
if
board_props
.
arch
not
in
app_tab
.
get_supported_architectures
():
"
architecture {}
"
.
format
(
board_props
.
arch
)))
fatal
((
"
It seems that the TAB file was not produced for the
"
app_hex
=
intelhex
.
IntelHex
()
"
architecture {}
"
.
format
(
board_props
.
arch
)))
app_hex
.
frombytes
(
app_hex
=
intelhex
.
IntelHex
()
app_tab
.
extract_app
(
board_props
.
arch
).
get_binary
(),
app_hex
.
frombytes
(
offset
=
board_props
.
app_address
)
app_tab
.
extract_app
(
board_props
.
arch
).
get_binary
(),
final_hex
.
merge
(
app_hex
)
offset
=
board_props
.
app_address
)
final_hex
.
merge
(
app_hex
)
info
(
"
Generating all-merged HEX file: {}
"
.
format
(
dest_file
))
info
(
"
Generating all-merged HEX file: {}
"
.
format
(
dest_file
))
final_hex
.
tofile
(
dest_file
,
format
=
"
hex
"
)
final_hex
.
tofile
(
dest_file
,
format
=
"
hex
"
)
...
@@ -546,9 +547,6 @@ class OpenSKInstaller:
...
@@ -546,9 +547,6 @@ class OpenSKInstaller:
self
.
check_prerequisites
()
self
.
check_prerequisites
()
self
.
update_rustc_if_needed
()
self
.
update_rustc_if_needed
()
if
self
.
args
.
application
is
None
:
fatal
(
"
Please specify an application to be flashed
"
)
# Compile what needs to be compiled
# Compile what needs to be compiled
if
self
.
args
.
tockos
:
if
self
.
args
.
tockos
:
self
.
build_tockos
()
self
.
build_tockos
()
...
@@ -556,6 +554,8 @@ class OpenSKInstaller:
...
@@ -556,6 +554,8 @@ class OpenSKInstaller:
if
self
.
args
.
application
==
"
ctap2
"
:
if
self
.
args
.
application
==
"
ctap2
"
:
self
.
generate_crypto_materials
(
self
.
args
.
regenerate_keys
)
self
.
generate_crypto_materials
(
self
.
args
.
regenerate_keys
)
self
.
build_opensk
()
self
.
build_opensk
()
elif
self
.
args
.
application
is
None
:
info
(
"
No application selected.
"
)
else
:
else
:
self
.
build_example
()
self
.
build_example
()
...
@@ -568,16 +568,19 @@ class OpenSKInstaller:
...
@@ -568,16 +568,19 @@ class OpenSKInstaller:
if
self
.
args
.
tockos
:
if
self
.
args
.
tockos
:
# Install Tock OS
# Install Tock OS
self
.
install_tock_os
()
self
.
install_tock_os
()
# Install padding and application
# Install padding and application if needed
self
.
install_padding
()
if
self
.
args
.
application
:
self
.
install_tab_file
(
"
target/tab/{}.tab
"
.
format
(
self
.
args
.
application
))
self
.
install_padding
()
if
self
.
verify_flashed_app
(
self
.
args
.
application
):
self
.
install_tab_file
(
"
target/tab/{}.tab
"
.
format
(
self
.
args
.
application
))
info
(
"
You
'
re all set!
"
)
if
self
.
verify_flashed_app
(
self
.
args
.
application
):
return
0
info
(
"
You
'
re all set!
"
)
error
((
"
It seems that something went wrong. App/example not found
"
return
0
error
(
(
"
It seems that something went wrong. App/example not found
"
"
on your board. Ensure the connections between the programmer and
"
"
on your board. Ensure the connections between the programmer and
"
"
the board are correct.
"
))
"
the board are correct.
"
))
return
1
return
1
return
0
if
self
.
args
.
programmer
in
(
"
pyocd
"
,
"
nordicdfu
"
,
"
none
"
):
if
self
.
args
.
programmer
in
(
"
pyocd
"
,
"
nordicdfu
"
,
"
none
"
):
dest_file
=
"
target/{}_merged.hex
"
.
format
(
self
.
args
.
board
)
dest_file
=
"
target/{}_merged.hex
"
.
format
(
self
.
args
.
board
)
...
@@ -734,7 +737,14 @@ if __name__ == "__main__":
...
@@ -734,7 +737,14 @@ if __name__ == "__main__":
"
storage (i.e. unplugging the key will reset the key).
"
),
"
storage (i.e. unplugging the key will reset the key).
"
),
)
)
apps_group
=
main_parser
.
add_mutually_exclusive_group
()
apps_group
=
main_parser
.
add_mutually_exclusive_group
(
required
=
True
)
apps_group
.
add_argument
(
"
--no-app
"
,
dest
=
"
application
"
,
action
=
"
store_const
"
,
const
=
None
,
help
=
(
"
Doesn
'
t compile nor install any application. Useful when you only
"
"
want to update Tock OS kernel.
"
))
apps_group
.
add_argument
(
apps_group
.
add_argument
(
"
--opensk
"
,
"
--opensk
"
,
dest
=
"
application
"
,
dest
=
"
application
"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment