Changed use of memory addresses in mac address reader to hex representation.
This commit is contained in:
parent
1174bcab67
commit
39f839b794
2 changed files with 5 additions and 5 deletions
|
|
@ -6,7 +6,7 @@ from pyocd.core.helpers import ConnectHelper
|
|||
from pyocd.core.target import Target
|
||||
from pyocd.flash.file_programmer import FileProgrammer
|
||||
|
||||
from mac_converter import MacConverter
|
||||
from mac_address_reader import MacAddressReader
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-a", "--all", action="store_true", help="Flash softdevice and firmware.")
|
||||
|
|
@ -37,6 +37,6 @@ with ConnectHelper.session_with_chosen_probe() as session:
|
|||
target.reset_and_halt()
|
||||
target.resume()
|
||||
|
||||
mac_converter = MacConverter(target)
|
||||
mac_converter = MacAddressReader(target)
|
||||
mac_address = mac_converter.get_mac_address()
|
||||
print(f'Device MAC Address: {mac_address}')
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
from pyocd.core.target import Target
|
||||
|
||||
|
||||
class MacConverter():
|
||||
class MacAddressReader():
|
||||
|
||||
MEMORY_ADDRESS = 268435620 # 0x100000A4
|
||||
MEMORY_ADDRESS = 0x100000A4
|
||||
|
||||
def __init__(self, target: Target) -> None:
|
||||
self.target = target
|
||||
|
|
@ -21,7 +21,7 @@ class MacConverter():
|
|||
def _convert_blocks(self, memory_blocks: list[int]) -> str:
|
||||
first_block = f'{memory_blocks[0]:x}'.rjust(8, '0')
|
||||
|
||||
modified_second_block = memory_blocks[1] | 49152 # Bitwise OR with 0xc000
|
||||
modified_second_block = memory_blocks[1] | 0xc000 # Bitwise OR
|
||||
|
||||
second_block = f'{modified_second_block:x}'
|
||||
|
||||
Loading…
Add table
Reference in a new issue