bootloader_serial.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:tockloader 作者: helena-project 项目源码 文件源码
def read_range (self, address, length):
        # Can only read up to 4095 bytes at a time.
        MAX_READ = 4095
        read = bytes()
        this_length = 0
        remaining = length
        while remaining > 0:
            if remaining > MAX_READ:
                this_length = MAX_READ
                remaining -= MAX_READ
            else:
                this_length = remaining
                remaining = 0

            message = struct.pack('<IH', address, this_length)
            success, flash = self._issue_command(self.COMMAND_READ_RANGE, message, True, this_length, self.RESPONSE_READ_RANGE)

            if not success:
                raise TockLoaderException('Error: Could not read flash')
            else:
                read += flash

            address += this_length

        return read
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号