Skip to content

Write serial number after flashing works with commander but not API #1510

Answered by edcloudcycle
edcloudcycle asked this question in Q&A
Discussion options

You must be logged in to vote

Ok I think I managed to figure this out but it would be good to get any suggestions to make it better. It was not very intuitive that I would need to call an init() function and that I would need to set the region explicitly when I am already passing the target. Perhaps I have missed an example somewhere!

    board = session.board
    target = board.target
    flash = target.memory_map.get_boot_memory()
    
    # Load firmware into device.
    FileProgrammer(session).program("TM_v1.7.hex")

    flasher = Flash(target, flash.algo)
    flasher.region = flash
    flasher.init(operation=Flash.Operation.PROGRAM)
    flasher.program_phrase(address=0x10001080, bytes=[0x07, 0x00, 0xff, 0xff, 0xf…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by edcloudcycle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant