Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DC motor driver hat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
DC motor driver hat
Commits
6dd0516f
Commit
6dd0516f
authored
6 months ago
by
Samuel Tardieu
Browse files
Options
Downloads
Patches
Plain Diff
Remove unused bootloader.py module
parent
bce7a398
No related branches found
Branches containing commit
No related tags found
2 merge requests
!16
Resolve "Add README to the firmware package"
,
!15
Resolve "Remove bootloader.py"
Pipeline
#98565
canceled
6 months ago
Stage: check
Stage: build
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+0
-2
0 additions, 2 deletions
.gitlab-ci.yml
bootloader/build.rs
+0
-1
0 additions, 1 deletion
bootloader/build.rs
bootloader/python/bootloader.py
+0
-90
0 additions, 90 deletions
bootloader/python/bootloader.py
with
0 additions
and
93 deletions
.gitlab-ci.yml
+
0
−
2
View file @
6dd0516f
...
...
@@ -46,7 +46,6 @@ lint:python:
stage
:
check
script
:
-
apk add py3-flake8
-
flake8 bootloader/python
-
flake8 controller/python
build:rust:embedded
:
...
...
@@ -114,7 +113,6 @@ deploy:
-
cp target/thumbv7m-none-eabi/production/controller firmware/
-
cp target/thumbv7m-none-eabi/production/controller-without-bootloader firmware/
-
cp target/aarch64-unknown-linux-musl/production/firmware-updater firmware/
-
cp bootloader/python/bootloader.py firmware/
-
cp controller/python/controller.py firmware/
artifacts
:
paths
:
...
...
This diff is collapsed.
Click to expand it.
bootloader/build.rs
+
0
−
1
View file @
6dd0516f
...
...
@@ -2,7 +2,6 @@ use bootloader_params::{BOOTLOADER_SIZE, FLASH_START};
use
build_support
::
MemoryConfig
;
fn
main
()
->
Result
<
(),
build_support
::
Error
>
{
build_support
::
check_python_library_consistency
(
"python/bootloader.py"
)
?
;
build_support
::
make_version
()
?
;
build_support
::
make_memory_x
(
&
MemoryConfig
{
flash_start
:
FLASH_START
,
...
...
This diff is collapsed.
Click to expand it.
bootloader/python/bootloader.py
deleted
100644 → 0
+
0
−
90
View file @
bce7a398
import
struct
# Major and minor version of required firmware
_REQUIRED_FIRMWARE_VERSION
=
(
0
,
2
)
class
FirmwareVersionMismatch
(
Exception
):
pass
class
WhoAmIMismatch
(
Exception
):
pass
class
Bootloader
:
I2C_ADDR
=
0x58
FIRMWARE_VERSION
=
0x08
WHO_AM_I
=
0x0F
RESET
=
0xE0
DEVICE_ID
=
0xF0
def
__init__
(
self
,
i2c_bus
=
8
):
import
smbus
self
.
i2c_bus
=
i2c_bus
self
.
i2c
=
smbus
.
SMBus
(
self
.
i2c_bus
)
self
.
check_who_am_i
()
self
.
check_firmware_version
()
def
_read
(
self
,
command
,
n
,
unpack_spec
)
->
tuple
:
return
struct
.
unpack
(
unpack_spec
,
bytes
(
self
.
i2c
.
read_i2c_block_data
(
self
.
I2C_ADDR
,
command
,
n
)),
)
def
_write
(
self
,
command
:
int
,
data
:
list
[
int
]):
self
.
i2c
.
write_i2c_block_data
(
self
.
I2C_ADDR
,
command
,
data
)
def
who_am_i
(
self
)
->
int
:
"""
Check that the motors controller board is present. This
should return the same value as Bootloader.I2C_ADDR.
"""
return
self
.
_read
(
self
.
WHO_AM_I
,
1
,
"
B
"
)[
0
]
def
check_who_am_i
(
self
):
"""
Check that the device answers to WHO_AM_I is correct.
"""
w
=
self
.
who_am_i
()
if
w
!=
self
.
I2C_ADDR
:
error
=
(
f
"
WHO_AM_I returns
{
w
:
#04x
}
"
f
"
instead of the expected
{
self
.
I2C_ADDR
:
#04x
}
"
)
raise
WhoAmIMismatch
(
error
)
def
get_firmware_version
(
self
)
->
tuple
[
int
,
int
,
int
]:
"""
Get the firmware version (major, minor, patch).
"""
return
self
.
_read
(
self
.
FIRMWARE_VERSION
,
3
,
"
BBB
"
)
def
check_firmware_version
(
self
):
"""
Check that the firmware uses a version compatible with this
library.
"""
version
=
self
.
get_firmware_version
()
Bootloader
.
_check_firmware_version_consistency
(
_REQUIRED_FIRMWARE_VERSION
,
version
)
def
_check_firmware_version_consistency
(
required
:
tuple
[
int
,
int
],
version
:
tuple
[
int
,
int
,
int
]
):
(
MAJOR
,
MINOR
)
=
required
(
major
,
minor
,
patch
)
=
version
error
=
None
if
major
!=
MAJOR
or
minor
<
MINOR
:
version
=
f
"
{
major
}
.
{
minor
}
.
{
patch
}
"
VERSION
=
f
"
{
MAJOR
}
.
{
MINOR
}
.*
"
error
=
(
f
"
Hardware runs firmware version
{
version
}
which
"
f
"
is not compatible with this library version (
{
VERSION
}
)
"
)
raise
FirmwareVersionMismatch
(
error
)
def
reset
(
self
):
"""
Reset the device. Used mainly for testing.
"""
self
.
_write
(
self
.
RESET
,
[])
def
get_device_id
(
self
):
"""
Return the 8 bytes composing the device id.
"""
return
list
(
self
.
_read
(
self
.
DEVICE_ID
,
8
,
"
BBBBBBBB
"
))
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