mirror of
https://github.com/pine64/blisp.git
synced 2025-01-31 01:50:12 +00:00
stdlib
Update dfu_file.c
This commit is contained in:
parent
11c31d6eed
commit
99a30ae9cc
@ -5,7 +5,6 @@
|
|||||||
#ifndef BLISP_BIN_FILE_H
|
#ifndef BLISP_BIN_FILE_H
|
||||||
#define BLISP_BIN_FILE_H
|
#define BLISP_BIN_FILE_H
|
||||||
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Created by ralim on 25/09/22.
|
// Created by ralim on 25/09/22.
|
||||||
//
|
//
|
||||||
#include "dfu_file.h"
|
#include "dfu_file.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define DFU_SUFFIX_LENGTH 16
|
#define DFU_SUFFIX_LENGTH 16
|
||||||
#define LMDFU_PREFIX_LENGTH 8
|
#define LMDFU_PREFIX_LENGTH 8
|
||||||
@ -125,7 +126,7 @@ ssize_t parse_target(const uint8_t* data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
*out_ealt = data[6];
|
*out_ealt = data[6];
|
||||||
uint8_t* tdata = data + 6 + 1 + 4 + 255;
|
uint8_t* tdata = (uint8_t*)data + 6 + 1 + 4 + 255;
|
||||||
uint32_t len_tdata = *((uint32_t*)tdata);
|
uint32_t len_tdata = *((uint32_t*)tdata);
|
||||||
tdata += 4;
|
tdata += 4;
|
||||||
uint32_t num_images = *((uint32_t*)tdata);
|
uint32_t num_images = *((uint32_t*)tdata);
|
||||||
@ -243,7 +244,7 @@ struct dfu_file parse_dfu_suffix(const uint8_t* file_contents,
|
|||||||
output.bcdDevice = (dfu_suffix[1] << 8) + dfu_suffix[0];
|
output.bcdDevice = (dfu_suffix[1] << 8) + dfu_suffix[0];
|
||||||
|
|
||||||
checked:
|
checked:
|
||||||
const int res = probe_prefix(&output);
|
int res = probe_prefix(&output);
|
||||||
|
|
||||||
if (output.size.prefix) {
|
if (output.size.prefix) {
|
||||||
const uint8_t* data = file_contents;
|
const uint8_t* data = file_contents;
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#ifndef BLISP_DFU_FILE_H
|
#ifndef BLISP_DFU_FILE_H
|
||||||
#define BLISP_DFU_FILE_H
|
#define BLISP_DFU_FILE_H
|
||||||
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include "parsed_firmware_file.h"
|
#include "parsed_firmware_file.h"
|
||||||
|
|
||||||
#define PARSED_ERROR_INVALID_FILETYPE -0x1000
|
#define PARSED_ERROR_INVALID_FILETYPE -0x1000
|
||||||
|
Loading…
Reference in New Issue
Block a user