Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tockloader/app_padding.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def get_binary(self, address=None):
tbfh_binary = self.tbfh.get_binary()
# Calculate the padding length.
padding_binary_size = self.get_size() - len(tbfh_binary)
return tbfh_binary + b"\xFF" * padding_binary_size
return tbfh_binary + b"\xff" * padding_binary_size

def info(self, verbose=False):
"""
Expand Down
2 changes: 1 addition & 1 deletion tockloader/board_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ def get_apps_start_address(self):
"""
Return the address in flash where apps start.
"""
if hasattr(self, "app_address") and self.app_address:
if hasattr(self, "app_address") and self.app_address is not None:
return self.app_address
else:
attributes = self.get_all_attributes()
Expand Down
6 changes: 3 additions & 3 deletions tockloader/flash_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def translate_address(self, address):
return address - flash_address

def get_flash_address(self):
if hasattr(self, "flash_address") and self.flash_address:
if hasattr(self, "flash_address") and self.flash_address is not None:
return self.flash_address
return None

Expand Down Expand Up @@ -216,9 +216,9 @@ def set_local_board(
local_board = {"board": board, "filepath": filepath}
if arch:
local_board["arch"] = arch
if app_address:
if app_address is not None:
local_board["app_address"] = app_address
if flash_address:
if flash_address is not None:
local_board["flash_address"] = flash_address
if flush_command:
local_board["flush_command"] = flush_command
Expand Down
4 changes: 2 additions & 2 deletions tockloader/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,9 @@ def command_local_board_set(args):
logging.status(f"Setting the default local board to '{board_name}'")
if args.arch:
logging.status(f" Using arch {args.arch}")
if args.app_address:
if args.app_address is not None:
logging.status(f" Using app_address {args.app_address:#02x}")
if args.flash_address:
if args.flash_address is not None:
logging.status(f" Using flash_address {args.flash_address:#02x}")
if args.flush_command:
logging.status(f' Using flush_command "{args.flush_command}"')
Expand Down
10 changes: 5 additions & 5 deletions tockloader/tockloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,20 +1098,20 @@ def _get_apps_start_address(self):
# have a good way to mark it as unset since
# app_settings['start_address'] is set by default.
cached = getattr(self, "apps_start_address", None)
if cached:
if cached is not None:
return cached

# Highest priority is the command line argument. If the user specifies
# that, we use that unconditionally.
cmdline_app_address = getattr(self.args, "app_address", None)
if cmdline_app_address:
if cmdline_app_address is not None:
self.apps_start_address = cmdline_app_address
return cmdline_app_address

# Next we check if the attached board can tell us.
if self.channel:
channel_apps_start_address = self.channel.get_apps_start_address()
if channel_apps_start_address:
if channel_apps_start_address is not None:
self.apps_start_address = channel_apps_start_address
return channel_apps_start_address

Expand All @@ -1127,7 +1127,7 @@ def _get_flash_start_address(self):
# Check if the attached board can tell us.
if self.channel:
channel_flash_address = self.channel.get_flash_address()
if channel_flash_address:
if channel_flash_address is not None:
return channel_flash_address

# In the default case flash starts at address 0.
Expand All @@ -1143,7 +1143,7 @@ def _get_memory_start_address(self):
# app RAM address often, so we don't want to have to query the board for
# it each time.
cached = getattr(self, "app_ram_address", None)
if cached:
if cached is not None:
return cached

# Next we check for kernel attributes.
Expand Down