Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ieee_address fix #179

Closed
wants to merge 2 commits into from
Closed

ieee_address fix #179

wants to merge 2 commits into from

Conversation

Bosiux
Copy link

@Bosiux Bosiux commented Aug 22, 2024

Error fix ERROR: int() can't convert non-string with explicit base

Command:

python3 cc2538-bsl.py -p COM7 -evw --bootloader-sonoff-usb CC1352P2_CC2652P_launchpad_coordinator_20230507.hex

Hex reference:

https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20230507.zip

Log:

sonoff
Opening port COM7, baud 500000
Reading data from CC1352P2_CC2652P_launchpad_coordinator_20230507.hex
Your firmware looks like an Intel Hex file
Connecting to target...
CC1350 PG2.0 (7x7mm): 352KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x00057FD8
Primary IEEE Address: 00:12:4B:00:2C:40:10:06
    Performing mass erase
Erasing all main bank flash sectors
    Erase done
Writing 360448 bytes starting at address 0x00000000
Write 104 bytes at 0x00057F988
    Write done
Verifying by comparing CRC32 calculations.
    Verified (match: 0xe83aa727)
ERROR: int() can't convert non-string with explicit base

Problem fix:

Change at line 1224 : added and args.ieee_address != None to if statement.

if args.ieee_address != 0  and args.ieee_address != None:
            ieee_addr = parse_ieee_address(args.ieee_address)
            mdebug(5, "Setting IEEE address to %s"
                       % (':'.join(['%02x' % b
                                    for b in struct.pack('>Q', ieee_addr)])))
            ieee_addr_bytes = struct.pack('<Q', ieee_addr)

            if cmd.writeMemory(device.addr_ieee_address_secondary,
                               ieee_addr_bytes):
                mdebug(5, "    "
                          "Set address done")
            else:
                raise CmdException("Set address failed")

cc2538-bsl.py Outdated Show resolved Hide resolved
@nicktimko
Copy link

On additional perusal, this is a duplicate of #168.

Co-authored-by: Nick Timkovich <[email protected]>
@JelmerT JelmerT self-assigned this Sep 18, 2024
@JelmerT
Copy link
Owner

JelmerT commented Sep 18, 2024

@Bosiux @nicktimko I pulled #168 which I think makes this PR obsolete?
Ok for me to close this one?

Thanks for the detailed PR!

@nicktimko
Copy link

I'd argue this is the more correct form. args.ieee_address can never be 0 because the type will always be a string (unless your parser.add_argument call for it includes type=int). Using != None is technically fine, but stylistically outside the norm.

IMHO the line should be one of:

  • if args.ieee_address (if the address is an empty string this would also skip it)
  • if args.ieee_address is not None

How it is now is misleading because reading it you might think the type is int, not str.

@Bosiux
Copy link
Author

Bosiux commented Sep 19, 2024

Close it, no problem

@Bosiux Bosiux closed this Sep 19, 2024
@JelmerT
Copy link
Owner

JelmerT commented Sep 19, 2024

@nicktimko feel free to open a new PR to fix, your first option seems the most correct to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants