The following issues were found
ports/teensy/make-pins.py
46 issues
Line: 148
Column: 9
return "pin_{:s}_af".format(self.cpu_pin_name())
def adc_num_str(self):
str = ""
for adc_num in range(1, 4):
if self.adc_num & (1 << (adc_num - 1)):
if len(str) > 0:
str += " | "
str += "PIN_ADC"
Reported by Pylint.
Line: 226
Column: 17
for row in rows:
try:
(port_num, pin_num) = parse_port_pin(row[pinname_col])
except:
continue
pin = Pin(port_num, pin_num)
for af_idx in range(af_col, len(row)):
if af_idx >= af_col:
pin.parse_af(af_idx - af_col, row[af_idx])
Reported by Pylint.
Line: 240
Column: 17
for row in rows:
try:
(port_num, pin_num) = parse_port_pin(row[1])
except:
continue
pin = self.find_pin(port_num, pin_num)
if pin:
pin.set_is_board_pin()
self.board_pins.append(NamedPin(row[0], pin))
Reported by Pylint.
Line: 261
Column: 13
)
print("};")
print(
"MP_DEFINE_CONST_DICT(pin_{:s}_pins_locals_dict, pin_{:s}_pins_locals_dict_table);".format(
label, label
)
)
def print(self):
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
"""Creates the pin file for the Teensy."""
from __future__ import print_function
import argparse
import sys
import csv
Reported by Pylint.
Line: 33
Column: 1
return (port, int(pin_str))
def split_name_num(name_num):
num = None
for num_idx in range(len(name_num) - 1, -1, -1):
if not name_num[num_idx].isdigit():
name = name_num[0 : num_idx + 1]
num_str = name_num[num_idx + 1 :]
Reported by Pylint.
Line: 45
Column: 1
return name, num
class AlternateFunction(object):
"""Holds the information associated with a pins alternate function."""
def __init__(self, idx, af_str):
self.idx = idx
self.af_str = af_str
Reported by Pylint.
Line: 66
Column: 5
if self.pin_type in pin_types:
self.supported = True
def is_supported(self):
return self.supported
def ptr(self):
"""Returns the numbered function (i.e. USART6) for this AF."""
if self.fn_num is None:
Reported by Pylint.
Line: 75
Column: 5
return self.func
return "{:s}{:d}".format(self.func, self.fn_num)
def mux_name(self):
return "AF{:d}_{:s}".format(self.idx, self.ptr())
def print(self):
"""Prints the C representation of this AF."""
if self.supported:
Reported by Pylint.
Line: 93
Column: 5
)
)
def qstr_list(self):
return [self.mux_name()]
class Pin(object):
"""Holds the information associated with a pin."""
Reported by Pylint.
ports/stm32/mboot/mboot_pack_dfu.py
44 issues
Line: 36
Column: 1
import zlib
sys.path.append(os.path.dirname(__file__) + "/../../../tools")
import dfu
try:
import pyhy
except ImportError:
raise SystemExit(
Reported by Pylint.
Line: 30
Column: 1
import argparse
import os
import re
import struct
import sys
import zlib
sys.path.append(os.path.dirname(__file__) + "/../../../tools")
Reported by Pylint.
Line: 41
Column: 5
try:
import pyhy
except ImportError:
raise SystemExit(
"ERROR: pyhy not found. Please install python pyhy for encrypted mboot support: pip3 install pyhy"
)
# Currenty supported version of a packed DFU file.
Reported by Pylint.
Line: 65
Column: 9
def generate(self):
kp = pyhy.hydro_sign_keygen()
self.sign_sk = kp.sk
self.sign_pk = kp.pk
self.secretbox = pyhy.hydro_secretbox_keygen()
def _save_data(self, name, data, file_, hide=False):
prefix = "//" if hide else ""
Reported by Pylint.
Line: 66
Column: 9
def generate(self):
kp = pyhy.hydro_sign_keygen()
self.sign_sk = kp.sk
self.sign_pk = kp.pk
self.secretbox = pyhy.hydro_secretbox_keygen()
def _save_data(self, name, data, file_, hide=False):
prefix = "//" if hide else ""
data = ",".join("0x{:02x}".format(b) for b in data)
Reported by Pylint.
Line: 67
Column: 9
kp = pyhy.hydro_sign_keygen()
self.sign_sk = kp.sk
self.sign_pk = kp.pk
self.secretbox = pyhy.hydro_secretbox_keygen()
def _save_data(self, name, data, file_, hide=False):
prefix = "//" if hide else ""
data = ",".join("0x{:02x}".format(b) for b in data)
file_.write("{}const uint8_t {}[] = {{{}}};\n".format(prefix, name, data))
Reported by Pylint.
Line: 104
Column: 14
with open(filename, "rb") as f:
hdr = f.read(11)
sig, ver, size, num_targ = struct.unpack("<5sBIB", hdr)
file_offset = 11
for i in range(num_targ):
hdr = f.read(274)
sig, alt, has_name, name, t_size, num_elem = struct.unpack("<6sBi255sII", hdr)
Reported by Pylint.
Line: 104
Column: 9
with open(filename, "rb") as f:
hdr = f.read(11)
sig, ver, size, num_targ = struct.unpack("<5sBIB", hdr)
file_offset = 11
for i in range(num_targ):
hdr = f.read(274)
sig, alt, has_name, name, t_size, num_elem = struct.unpack("<6sBi255sII", hdr)
Reported by Pylint.
Line: 107
Column: 13
sig, ver, size, num_targ = struct.unpack("<5sBIB", hdr)
file_offset = 11
for i in range(num_targ):
hdr = f.read(274)
sig, alt, has_name, name, t_size, num_elem = struct.unpack("<6sBi255sII", hdr)
file_offset += 274
file_offset_t = file_offset
Reported by Pylint.
Line: 109
Column: 23
for i in range(num_targ):
hdr = f.read(274)
sig, alt, has_name, name, t_size, num_elem = struct.unpack("<6sBi255sII", hdr)
file_offset += 274
file_offset_t = file_offset
for j in range(num_elem):
hdr = f.read(8)
Reported by Pylint.
ports/stm32/mboot/fwupdate.py
43 issues
Line: 4
Column: 1
# Update Mboot or MicroPython from a .dfu.gz file on the board's filesystem
# MIT license; Copyright (c) 2019-2020 Damien P. George
from micropython import const
import struct, time
import uzlib, machine, stm
# Constants to be used with update_mpy
VFS_FAT = 1
Reported by Pylint.
Line: 6
Column: 1
from micropython import const
import struct, time
import uzlib, machine, stm
# Constants to be used with update_mpy
VFS_FAT = 1
VFS_LFS1 = 2
VFS_LFS2 = 3
Reported by Pylint.
Line: 6
Column: 1
from micropython import const
import struct, time
import uzlib, machine, stm
# Constants to be used with update_mpy
VFS_FAT = 1
VFS_LFS1 = 2
VFS_LFS2 = 3
Reported by Pylint.
Line: 6
Column: 1
from micropython import const
import struct, time
import uzlib, machine, stm
# Constants to be used with update_mpy
VFS_FAT = 1
VFS_LFS1 = 2
VFS_LFS2 = 3
Reported by Pylint.
Line: 145
Column: 5
return
print("Programming Mboot, do not turn off!")
time.sleep_ms(50)
irq = machine.disable_irq()
flash_unlock()
flash_erase_sector(0)
if len(mboot_fw) > 16 * 1024 and not check_mem_erased(mboot_addr + 16 * 1024, 16 * 1024):
Reported by Pylint.
Line: 57
Column: 5
elems = []
hdr = f.read(11)
sig, ver, size, num_targ = struct.unpack("<5sBIB", hdr)
file_offset = 11
for i in range(num_targ):
hdr = f.read(274)
Reported by Pylint.
Line: 57
Column: 10
elems = []
hdr = f.read(11)
sig, ver, size, num_targ = struct.unpack("<5sBIB", hdr)
file_offset = 11
for i in range(num_targ):
hdr = f.read(274)
Reported by Pylint.
Line: 61
Column: 9
file_offset = 11
for i in range(num_targ):
hdr = f.read(274)
sig, alt, has_name, name, t_size, num_elem = struct.unpack("<6sBi255sII", hdr)
file_offset += 274
file_offset_t = file_offset
Reported by Pylint.
Line: 63
Column: 29
for i in range(num_targ):
hdr = f.read(274)
sig, alt, has_name, name, t_size, num_elem = struct.unpack("<6sBi255sII", hdr)
file_offset += 274
file_offset_t = file_offset
for j in range(num_elem):
hdr = f.read(8)
Reported by Pylint.
Line: 63
Column: 19
for i in range(num_targ):
hdr = f.read(274)
sig, alt, has_name, name, t_size, num_elem = struct.unpack("<6sBi255sII", hdr)
file_offset += 274
file_offset_t = file_offset
for j in range(num_elem):
hdr = f.read(8)
Reported by Pylint.
ports/rp2/modules/rp2.py
43 issues
Line: 4
Column: 1
# rp2 module: uses C code from _rp2, plus asm_pio decorator implemented in Python.
# MIT license; Copyright (c) 2020-2021 Damien P. George
from _rp2 import *
from micropython import const
_PROG_DATA = const(0)
_PROG_OFFSET_PIO0 = const(1)
_PROG_OFFSET_PIO1 = const(2)
Reported by Pylint.
Line: 5
Column: 1
# MIT license; Copyright (c) 2020-2021 Damien P. George
from _rp2 import *
from micropython import const
_PROG_DATA = const(0)
_PROG_OFFSET_PIO0 = const(1)
_PROG_OFFSET_PIO1 = const(2)
_PROG_EXECCTRL = const(3)
Reported by Pylint.
Line: 39
Column: 9
):
# uarray is a built-in module so importing it here won't require
# scanning the filesystem.
from uarray import array
self.labels = {}
execctrl = 0
shiftctrl = (
fifo_join << 30
Reported by Pylint.
Line: 4
Column: 1
# rp2 module: uses C code from _rp2, plus asm_pio decorator implemented in Python.
# MIT license; Copyright (c) 2020-2021 Damien P. George
from _rp2 import *
from micropython import const
_PROG_DATA = const(0)
_PROG_OFFSET_PIO0 = const(1)
_PROG_OFFSET_PIO1 = const(2)
Reported by Pylint.
Line: 67
Column: 13
if pass_ == 1:
if not self.wrap_used and self.num_instr:
self.wrap()
self.delay_max = 31
if self.sideset_count:
self.sideset_opt = self.num_sideset != self.num_instr
if self.sideset_opt:
self.prog[_PROG_EXECCTRL] |= 1 << 30
self.sideset_count += 1
Reported by Pylint.
Line: 69
Column: 17
self.wrap()
self.delay_max = 31
if self.sideset_count:
self.sideset_opt = self.num_sideset != self.num_instr
if self.sideset_opt:
self.prog[_PROG_EXECCTRL] |= 1 << 30
self.sideset_count += 1
self.delay_max >>= self.sideset_count
self.pass_ = pass_
Reported by Pylint.
Line: 74
Column: 9
self.prog[_PROG_EXECCTRL] |= 1 << 30
self.sideset_count += 1
self.delay_max >>= self.sideset_count
self.pass_ = pass_
self.num_instr = 0
self.num_sideset = 0
def __getitem__(self, key):
return self.delay(key)
Reported by Pylint.
Line: 75
Column: 9
self.sideset_count += 1
self.delay_max >>= self.sideset_count
self.pass_ = pass_
self.num_instr = 0
self.num_sideset = 0
def __getitem__(self, key):
return self.delay(key)
Reported by Pylint.
Line: 76
Column: 9
self.delay_max >>= self.sideset_count
self.pass_ = pass_
self.num_instr = 0
self.num_sideset = 0
def __getitem__(self, key):
return self.delay(key)
def delay(self, delay):
Reported by Pylint.
Line: 274
Column: 5
# sideset_count is inclusive of enable bit
def asm_pio_encode(instr, sideset_count):
emit = PIOASMEmit()
emit.delay_max = 31
emit.sideset_count = sideset_count
if emit.sideset_count:
emit.delay_max >>= emit.sideset_count
emit.pass_ = 1
emit.num_instr = 0
Reported by Pylint.
ports/mimxrt/boards/make-pins.py
43 issues
Line: 7
Column: 1
from __future__ import print_function
import argparse
import sys
import csv
import re
SUPPORTED_AFS = {"GPIO"}
MAX_AF = 10 # AF0 .. AF9
Reported by Pylint.
Line: 29
Column: 5
for supported_af in SUPPORTED_AFS:
if af_str.startswith(supported_af):
return True
else:
return False
class Pin(object):
"""Holds the information associated with a pin."""
Reported by Pylint.
Line: 178
Column: 13
af_end_col = af_start_col + MAX_AF
with open(filename, "r") as csvfile:
rows = csv.reader(csvfile)
header = next(rows)
for idx, row in enumerate(rows):
pad = row[pad_col]
gpio, pin = row[6].split("_")
pin_number = pin.lstrip("IO")
Reported by Pylint.
Line: 208
Column: 13
)
print("};")
print(
"MP_DEFINE_CONST_DICT(machine_pin_{:s}_pins_locals_dict, pin_{:s}_pins_locals_dict_table);".format(
label, label
)
)
def print(self):
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python
"""Creates the pin file for the MIMXRT10xx."""
from __future__ import print_function
import argparse
import sys
import csv
import re
Reported by Pylint.
Line: 25
Column: 1
return pad_str
def af_supported(af_str):
for supported_af in SUPPORTED_AFS:
if af_str.startswith(supported_af):
return True
else:
return False
Reported by Pylint.
Line: 33
Column: 1
return False
class Pin(object):
"""Holds the information associated with a pin."""
def __init__(self, pad, gpio, pin, idx=0):
self.idx = idx
self.name = pad
Reported by Pylint.
Line: 33
Column: 1
return False
class Pin(object):
"""Holds the information associated with a pin."""
def __init__(self, pad, gpio, pin, idx=0):
self.idx = idx
self.name = pad
Reported by Pylint.
Line: 46
Column: 5
self.adc_fns = []
self.board_pin = False
def set_is_board_pin(self):
self.board_pin = True
def is_board_pin(self):
return self.board_pin
Reported by Pylint.
Line: 49
Column: 5
def set_is_board_pin(self):
self.board_pin = True
def is_board_pin(self):
return self.board_pin
def parse_adc(self, adc_str):
adc_regex = r"ADC(?P<instance>\d*)_IN(?P<channel>\d*)"
Reported by Pylint.
tests/basics/equal.py
43 issues
Line: 17
Column: 7
print(() == None)
print(() == False)
print(() == print)
print([] == None)
print([] == False)
print([] == print)
Reported by Pylint.
Line: 21
Column: 7
print([] == None)
print([] == False)
print([] == print)
print({} == None)
print({} == False)
print({} == print)
Reported by Pylint.
Line: 25
Column: 7
print({} == None)
print({} == False)
print({} == print)
print(1 == 1)
print(1 == 2)
print(1 == ())
print(1 == [])
Reported by Pylint.
Line: 55
Column: 7
print(() != None)
print(() != False)
print(() != print)
print([] != None)
print([] != False)
print([] != print)
Reported by Pylint.
Line: 59
Column: 7
print([] != None)
print([] != False)
print([] != print)
print({} != None)
print({} != False)
print({} != print)
Reported by Pylint.
Line: 63
Column: 7
print({} != None)
print({} != False)
print({} != print)
print(1 != 1)
print(1 != 2)
print(1 != ())
print(1 != [])
Reported by Pylint.
Line: 1
Column: 1
# test equality
print(None == None)
print(False == None)
print(False == False)
print(False == True)
print(() == ())
Reported by Pylint.
Line: 3
Column: 7
# test equality
print(None == None)
print(False == None)
print(False == False)
print(False == True)
print(() == ())
Reported by Pylint.
Line: 3
Column: 7
# test equality
print(None == None)
print(False == None)
print(False == False)
print(False == True)
print(() == ())
Reported by Pylint.
Line: 5
Column: 7
print(None == None)
print(False == None)
print(False == False)
print(False == True)
print(() == ())
print(() == [])
Reported by Pylint.
tests/run-perfbench.py
43 issues
Line: 14
Column: 1
from glob import glob
sys.path.append("../tools")
import pyboard
# Paths for host executables
if os.name == "nt":
CPYTHON3 = os.getenv("MICROPY_CPYTHON3", "python3.exe")
MICROPYTHON = os.getenv("MICROPY_MICROPYTHON", "../ports/windows/micropython.exe")
Reported by Pylint.
Line: 11
Column: 1
import subprocess
import sys
import argparse
from glob import glob
sys.path.append("../tools")
import pyboard
# Paths for host executables
Reported by Pylint.
Line: 54
Column: 17
else:
# Run local executable
try:
p = subprocess.run(
target, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, input=script
)
output = p.stdout
except subprocess.CalledProcessError as er:
err = er
Reported by Pylint.
Line: 112
Column: 9
test_script += b"bm_run(%u, %u)\n" % (param_n, param_m)
# Write full test script if needed
if 0:
with open("%s.full" % test_file, "wb") as f:
f.write(test_script)
# Run MicroPython a given number of times
times = []
Reported by Pylint.
Line: 150
Column: 13
t_avg, 100 * t_sd / t_avg, s_avg, 100 * s_sd / s_avg
)
)
if 0:
print(" times: ", times)
print(" scores:", scores)
sys.stdout.flush()
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
# This file is part of the MicroPython project, http://micropython.org/
# The MIT License (MIT)
# Copyright (c) 2019 Damien P. George
import os
import subprocess
import sys
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
# This file is part of the MicroPython project, http://micropython.org/
# The MIT License (MIT)
# Copyright (c) 2019 Damien P. George
import os
import subprocess
import sys
Reported by Pylint.
Line: 8
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess
# Copyright (c) 2019 Damien P. George
import os
import subprocess
import sys
import argparse
from glob import glob
sys.path.append("../tools")
Reported by Bandit.
Line: 14
Column: 1
from glob import glob
sys.path.append("../tools")
import pyboard
# Paths for host executables
if os.name == "nt":
CPYTHON3 = os.getenv("MICROPY_CPYTHON3", "python3.exe")
MICROPYTHON = os.getenv("MICROPY_MICROPYTHON", "../ports/windows/micropython.exe")
Reported by Pylint.
Line: 29
Column: 1
BENCH_SCRIPT_DIR = "perf_bench/"
def compute_stats(lst):
avg = 0
var = 0
for x in lst:
avg += x
var += x * x
Reported by Pylint.
tests/wipy/i2c.py
43 issues
Line: 6
Column: 1
A MPU-9150 sensor must be connected to the I2C bus.
"""
from machine import I2C
import os
import time
mch = os.uname().machine
if "LaunchPad" in mch:
Reported by Pylint.
Line: 10
Column: 7
import os
import time
mch = os.uname().machine
if "LaunchPad" in mch:
i2c_pins = ("GP11", "GP10")
elif "WiPy" in mch:
i2c_pins = ("GP15", "GP10")
else:
Reported by Pylint.
Line: 42
Column: 1
# reset the sensor
reg[0] |= 0x80
print(1 == i2c.writeto_mem(addr, 107, reg))
time.sleep_ms(100) # wait for the sensor to reset...
print(1 == i2c.readfrom_mem_into(addr, 107, reg)) # read the power management register 1
print(0x40 == reg[0])
# now just read one byte
Reported by Pylint.
Line: 82
Column: 1
# reset the sensor
reg[0] |= 0x80
print(1 == i2c.writeto_mem(addr, 107, reg))
time.sleep_ms(100) # wait for the sensor to reset...
# now read and write two register at a time
print(2 == i2c.readfrom_mem_into(addr, 107, reg2))
print(0x40 == reg2[0])
print(0x00 == reg2[1])
Reported by Pylint.
Line: 100
Column: 1
# reset the sensor
reg[0] = 0x80
print(1 == i2c.writeto_mem(addr, 107, reg))
time.sleep_ms(100) # wait for the sensor to reset...
# try some raw read and writes
reg[0] = 117 # register address
print(1 == i2c.writeto(addr, reg, stop=False)) # just write the register address
# now read
Reported by Pylint.
Line: 135
Column: 8
# next ones should raise
try:
i2c.scan()
except Exception:
print("Exception")
try:
i2c.readfrom(addr, 1)
except Exception:
Reported by Pylint.
Line: 140
Column: 8
try:
i2c.readfrom(addr, 1)
except Exception:
print("Exception")
try:
i2c.readfrom_into(addr, reg)
except Exception:
Reported by Pylint.
Line: 145
Column: 8
try:
i2c.readfrom_into(addr, reg)
except Exception:
print("Exception")
try:
i2c.readfrom_mem_into(addr, 107, reg)
except Exception:
Reported by Pylint.
Line: 150
Column: 8
try:
i2c.readfrom_mem_into(addr, 107, reg)
except Exception:
print("Exception")
try:
i2c.writeto(addr, reg, stop=False)
except Exception:
Reported by Pylint.
Line: 155
Column: 8
try:
i2c.writeto(addr, reg, stop=False)
except Exception:
print("Exception")
try:
i2c.writeto_mem(addr, 107, reg)
except Exception:
Reported by Pylint.
tests/multi_bluetooth/stress_log_filesystem.py
42 issues
Line: 5
Column: 1
# particularly relevant on STM32WB where the second core is stalled while
# flash operations are in progress.
from micropython import const
import time, machine, bluetooth, os
TIMEOUT_MS = 10000
LOG_PATH_INSTANCE0 = "stress_log_filesystem_0.log"
Reported by Pylint.
Line: 6
Column: 1
# flash operations are in progress.
from micropython import const
import time, machine, bluetooth, os
TIMEOUT_MS = 10000
LOG_PATH_INSTANCE0 = "stress_log_filesystem_0.log"
LOG_PATH_INSTANCE1 = "stress_log_filesystem_1.log"
Reported by Pylint.
Line: 6
Column: 1
# flash operations are in progress.
from micropython import const
import time, machine, bluetooth, os
TIMEOUT_MS = 10000
LOG_PATH_INSTANCE0 = "stress_log_filesystem_0.log"
LOG_PATH_INSTANCE1 = "stress_log_filesystem_1.log"
Reported by Pylint.
Line: 55
Column: 9
def periodic_log_write():
global last_file_write
t = time.ticks_ms()
if time.ticks_diff(t, last_file_write) > 50:
write_log("tick")
last_file_write = t
Reported by Pylint.
Line: 56
Column: 8
def periodic_log_write():
global last_file_write
t = time.ticks_ms()
if time.ticks_diff(t, last_file_write) > 50:
write_log("tick")
last_file_write = t
def irq(event, data):
Reported by Pylint.
Line: 108
Column: 10
def wait_for_event(event, timeout_ms):
t0 = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
periodic_log_write()
if event in waiting_events:
return waiting_events.pop(event)
machine.idle()
Reported by Pylint.
Line: 109
Column: 11
def wait_for_event(event, timeout_ms):
t0 = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
periodic_log_write()
if event in waiting_events:
return waiting_events.pop(event)
machine.idle()
raise ValueError("Timeout waiting for {}".format(event))
Reported by Pylint.
Line: 109
Column: 27
def wait_for_event(event, timeout_ms):
t0 = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
periodic_log_write()
if event in waiting_events:
return waiting_events.pop(event)
machine.idle()
raise ValueError("Timeout waiting for {}".format(event))
Reported by Pylint.
Line: 124
Column: 5
write_log("start")
ble.active(1)
ble.irq(irq)
multitest.globals(BDADDR=ble.config("mac"))
((char_handle,),) = ble.gatts_register_services(SERVICES)
multitest.next()
try:
for repeat in range(2):
print("gap_advertise")
Reported by Pylint.
Line: 126
Column: 5
ble.irq(irq)
multitest.globals(BDADDR=ble.config("mac"))
((char_handle,),) = ble.gatts_register_services(SERVICES)
multitest.next()
try:
for repeat in range(2):
print("gap_advertise")
ble.gap_advertise(50_000, b"\x02\x01\x06\x04\xffMPY")
# Wait for central to connect, do a sequence of read/write, then disconnect.
Reported by Pylint.
ports/stm32/boards/NUCLEO_WB55/rfcore_firmware.py
41 issues
Line: 65
Column: 1
# from your application code.
import struct, os
import machine, stm
from micropython import const
_OGF_VENDOR = const(0x3F)
_OCF_FUS_GET_STATE = const(0x52)
Reported by Pylint.
Line: 65
Column: 1
# from your application code.
import struct, os
import machine, stm
from micropython import const
_OGF_VENDOR = const(0x3F)
_OCF_FUS_GET_STATE = const(0x52)
Reported by Pylint.
Line: 66
Column: 1
import struct, os
import machine, stm
from micropython import const
_OGF_VENDOR = const(0x3F)
_OCF_FUS_GET_STATE = const(0x52)
_OCF_FUS_FW_UPGRADE = const(0x54)
Reported by Pylint.
Line: 1
Column: 1
# This file is part of the MicroPython project, http://micropython.org/
#
# The MIT License (MIT)
#
# Copyright (c) 2020 Damien P. George
# Copyright (c) 2020 Jim Mussared
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Reported by Pylint.
Line: 38
Column: 1
# To perform a firmware update:
#
# 1. Generate "obfuscated" binary images using rfcore_makefirmware.py
# ./boards/NUCLEO_WB55/rfcore_makefirmware.py ~/src/github.com/STMicroelectronics/STM32CubeWB/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x/ /tmp
# This will generate /tmp/{fus_102,fus_110,ws_ble_hci}.bin
#
# 2. Copy required files to the device filesystem.
# In general, it's always safe to copy all three files and the updater will
# figure out what needs to be done. This is the recommended option.
Reported by Pylint.
Line: 64
Column: 1
# You can use the built-in stm.rfcore_fw_version() to query the installed version
# from your application code.
import struct, os
import machine, stm
from micropython import const
_OGF_VENDOR = const(0x3F)
Reported by Pylint.
Line: 65
Column: 1
# from your application code.
import struct, os
import machine, stm
from micropython import const
_OGF_VENDOR = const(0x3F)
_OCF_FUS_GET_STATE = const(0x52)
Reported by Pylint.
Line: 190
Column: 1
_INSTALLING_WS_GET_STATE_TIMEOUT = const(6000)
def log(msg, *args, **kwargs):
print("[rfcore update]", msg.format(*args, **kwargs))
class _Flash:
_FLASH_KEY1 = 0x45670123
Reported by Pylint.
Line: 202
Column: 5
_FLASH_CR_LOCK_MASK = 1 << 31
_FLASH_SR_BSY_MASK = 1 << 16
def wait_not_busy(self):
while machine.mem32[stm.FLASH + stm.FLASH_SR] & _Flash._FLASH_SR_BSY_MASK:
machine.idle()
def unlock(self):
if machine.mem32[stm.FLASH + stm.FLASH_CR] & _Flash._FLASH_CR_LOCK_MASK:
Reported by Pylint.
Line: 202
Column: 5
_FLASH_CR_LOCK_MASK = 1 << 31
_FLASH_SR_BSY_MASK = 1 << 16
def wait_not_busy(self):
while machine.mem32[stm.FLASH + stm.FLASH_SR] & _Flash._FLASH_SR_BSY_MASK:
machine.idle()
def unlock(self):
if machine.mem32[stm.FLASH + stm.FLASH_CR] & _Flash._FLASH_CR_LOCK_MASK:
Reported by Pylint.