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
01047a0a
Unverified
Commit
01047a0a
authored
4 years ago
by
gendx
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into master
parents
ca15ea43
20674c51
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
-10
41 additions, 10 deletions
deploy.py
with
41 additions
and
10 deletions
deploy.py
+
41
−
10
View file @
01047a0a
...
@@ -269,6 +269,14 @@ class OpenSKInstaller:
...
@@ -269,6 +269,14 @@ class OpenSKInstaller:
port
=
None
,
port
=
None
,
)
)
def
checked_command
(
self
,
cmd
,
env
=
None
,
cwd
=
None
):
stdout
=
None
if
self
.
args
.
verbose_build
else
subprocess
.
DEVNULL
try
:
subprocess
.
run
(
cmd
,
stdout
=
stdout
,
timeout
=
None
,
check
=
True
,
env
=
env
,
cwd
=
cwd
)
except
subprocess
.
CalledProcessError
as
e
:
fatal
(
"
Failed to execute {}: {}
"
.
format
(
cmd
[
0
],
str
(
e
)))
def
checked_command_output
(
self
,
cmd
,
env
=
None
,
cwd
=
None
):
def
checked_command_output
(
self
,
cmd
,
env
=
None
,
cwd
=
None
):
cmd_output
=
""
cmd_output
=
""
try
:
try
:
...
@@ -300,10 +308,18 @@ class OpenSKInstaller:
...
@@ -300,10 +308,18 @@ class OpenSKInstaller:
target_toolchain
[
1
]
in
current_version
):
target_toolchain
[
1
]
in
current_version
):
info
(
"
Updating rust toolchain to {}
"
.
format
(
"
-
"
.
join
(
target_toolchain
)))
info
(
"
Updating rust toolchain to {}
"
.
format
(
"
-
"
.
join
(
target_toolchain
)))
# Need to update
# Need to update
self
.
checked_command_output
(
rustup_install
=
[
"
rustup
"
]
[
"
rustup
"
,
"
install
"
,
target_toolchain_fullstring
])
if
self
.
args
.
verbose_build
:
self
.
checked_command_output
(
rustup_install
.
append
(
"
--verbose
"
)
[
"
rustup
"
,
"
target
"
,
"
add
"
,
SUPPORTED_BOARDS
[
self
.
args
.
board
].
arch
])
rustup_install
.
extend
([
"
install
"
,
target_toolchain_fullstring
])
self
.
checked_command
(
rustup_install
)
rustup_target
=
[
"
rustup
"
]
if
self
.
args
.
verbose_build
:
rustup_target
.
append
(
"
--verbose
"
)
rustup_target
.
extend
(
[
"
target
"
,
"
add
"
,
SUPPORTED_BOARDS
[
self
.
args
.
board
].
arch
])
self
.
checked_command
(
rustup_target
)
info
(
"
Rust toolchain up-to-date
"
)
info
(
"
Rust toolchain up-to-date
"
)
def
build_tockos
(
self
):
def
build_tockos
(
self
):
...
@@ -312,7 +328,11 @@ class OpenSKInstaller:
...
@@ -312,7 +328,11 @@ class OpenSKInstaller:
out_directory
=
os
.
path
.
join
(
"
third_party
"
,
"
tock
"
,
"
target
"
,
props
.
arch
,
out_directory
=
os
.
path
.
join
(
"
third_party
"
,
"
tock
"
,
"
target
"
,
props
.
arch
,
"
release
"
)
"
release
"
)
os
.
makedirs
(
out_directory
,
exist_ok
=
True
)
os
.
makedirs
(
out_directory
,
exist_ok
=
True
)
self
.
checked_command_output
([
"
make
"
],
cwd
=
props
.
path
)
env
=
os
.
environ
.
copy
()
if
self
.
args
.
verbose_build
:
env
[
"
V
"
]
=
"
1
"
self
.
checked_command
([
"
make
"
],
cwd
=
props
.
path
,
env
=
env
)
def
build_example
(
self
):
def
build_example
(
self
):
info
(
"
Building example {}
"
.
format
(
self
.
args
.
application
))
info
(
"
Building example {}
"
.
format
(
self
.
args
.
application
))
...
@@ -347,7 +367,9 @@ class OpenSKInstaller:
...
@@ -347,7 +367,9 @@ class OpenSKInstaller:
]
]
if
is_example
:
if
is_example
:
command
.
extend
([
"
--example
"
,
self
.
args
.
application
])
command
.
extend
([
"
--example
"
,
self
.
args
.
application
])
self
.
checked_command_output
(
command
,
env
=
env
)
if
self
.
args
.
verbose_build
:
command
.
append
(
"
--verbose
"
)
self
.
checked_command
(
command
,
env
=
env
)
app_path
=
os
.
path
.
join
(
"
target
"
,
props
.
arch
,
"
release
"
)
app_path
=
os
.
path
.
join
(
"
target
"
,
props
.
arch
,
"
release
"
)
if
is_example
:
if
is_example
:
app_path
=
os
.
path
.
join
(
app_path
,
"
examples
"
)
app_path
=
os
.
path
.
join
(
app_path
,
"
examples
"
)
...
@@ -383,6 +405,8 @@ class OpenSKInstaller:
...
@@ -383,6 +405,8 @@ class OpenSKInstaller:
elf2tab_args
=
[
elf2tab_args
=
[
"
elf2tab
"
,
package_parameter
,
self
.
args
.
application
,
"
-o
"
,
tab_filename
"
elf2tab
"
,
package_parameter
,
self
.
args
.
application
,
"
-o
"
,
tab_filename
]
]
if
self
.
args
.
verbose_build
:
elf2tab_args
.
append
(
"
--verbose
"
)
for
arch
,
app_file
in
binaries
.
items
():
for
arch
,
app_file
in
binaries
.
items
():
dest_file
=
os
.
path
.
join
(
self
.
tab_folder
,
"
{}.elf
"
.
format
(
arch
))
dest_file
=
os
.
path
.
join
(
self
.
tab_folder
,
"
{}.elf
"
.
format
(
arch
))
shutil
.
copyfile
(
app_file
,
dest_file
)
shutil
.
copyfile
(
app_file
,
dest_file
)
...
@@ -392,7 +416,7 @@ class OpenSKInstaller:
...
@@ -392,7 +416,7 @@ class OpenSKInstaller:
"
--stack={}
"
.
format
(
STACK_SIZE
),
"
--app-heap={}
"
.
format
(
APP_HEAP_SIZE
),
"
--stack={}
"
.
format
(
STACK_SIZE
),
"
--app-heap={}
"
.
format
(
APP_HEAP_SIZE
),
"
--kernel-heap=1024
"
,
"
--protected-region-size=64
"
"
--kernel-heap=1024
"
,
"
--protected-region-size=64
"
])
])
self
.
checked_command
_output
(
elf2tab_args
)
self
.
checked_command
(
elf2tab_args
)
def
install_tab_file
(
self
,
tab_filename
):
def
install_tab_file
(
self
,
tab_filename
):
assert
self
.
args
.
application
assert
self
.
args
.
application
...
@@ -616,14 +640,14 @@ class OpenSKInstaller:
...
@@ -616,14 +640,14 @@ class OpenSKInstaller:
if
self
.
args
.
programmer
==
"
pyocd
"
:
if
self
.
args
.
programmer
==
"
pyocd
"
:
info
(
"
Flashing HEX file
"
)
info
(
"
Flashing HEX file
"
)
self
.
checked_command
_output
([
self
.
checked_command
([
"
pyocd
"
,
"
flash
"
,
"
--target={}
"
.
format
(
board_props
.
pyocd_target
),
"
pyocd
"
,
"
flash
"
,
"
--target={}
"
.
format
(
board_props
.
pyocd_target
),
"
--format=hex
"
,
"
--erase=auto
"
,
dest_file
"
--format=hex
"
,
"
--erase=auto
"
,
dest_file
])
])
if
self
.
args
.
programmer
==
"
nordicdfu
"
:
if
self
.
args
.
programmer
==
"
nordicdfu
"
:
info
(
"
Creating DFU package
"
)
info
(
"
Creating DFU package
"
)
dfu_pkg_file
=
"
target/{}_dfu.zip
"
.
format
(
self
.
args
.
board
)
dfu_pkg_file
=
"
target/{}_dfu.zip
"
.
format
(
self
.
args
.
board
)
self
.
checked_command
_output
([
self
.
checked_command
([
"
nrfutil
"
,
"
pkg
"
,
"
generate
"
,
"
--hw-version=52
"
,
"
--sd-req=0
"
,
"
nrfutil
"
,
"
pkg
"
,
"
generate
"
,
"
--hw-version=52
"
,
"
--sd-req=0
"
,
"
--application-version=1
"
,
"
--application={}
"
.
format
(
dest_file
),
"
--application-version=1
"
,
"
--application={}
"
.
format
(
dest_file
),
dfu_pkg_file
dfu_pkg_file
...
@@ -674,7 +698,7 @@ if __name__ == "__main__":
...
@@ -674,7 +698,7 @@ if __name__ == "__main__":
choices
=
(
"
boards
"
,
"
programmers
"
),
choices
=
(
"
boards
"
,
"
programmers
"
),
default
=
None
,
default
=
None
,
dest
=
"
listing
"
,
dest
=
"
listing
"
,
help
=
(
"
List supported boards or programmers, 1 per line and then exit.
"
)
,
help
=
"
List supported boards or programmers, 1 per line and then exit.
"
,
)
)
action_group
.
add_argument
(
action_group
.
add_argument
(
"
--board
"
,
"
--board
"
,
...
@@ -711,6 +735,13 @@ if __name__ == "__main__":
...
@@ -711,6 +735,13 @@ if __name__ == "__main__":
help
=
(
"
Only compiles and flash the application/example.
"
help
=
(
"
Only compiles and flash the application/example.
"
"
Otherwise TockOS will also be bundled and flashed.
"
),
"
Otherwise TockOS will also be bundled and flashed.
"
),
)
)
main_parser
.
add_argument
(
"
--verbose-build
"
,
action
=
"
store_true
"
,
default
=
False
,
dest
=
"
verbose_build
"
,
help
=
"
Build everything in verbose mode.
"
,
)
main_parser
.
add_argument
(
main_parser
.
add_argument
(
"
--panic-console
"
,
"
--panic-console
"
,
...
...
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