mirror of https://github.com/rusefi/dfu_java.git
hex file support
This commit is contained in:
parent
11b0f3c809
commit
45afc00e7f
|
@ -1,2 +1,3 @@
|
|||
.gradle
|
||||
build
|
||||
sample.hex
|
||||
|
|
|
@ -4,3 +4,10 @@ stm32 java DFU implementation
|
|||
|
||||
ST AN3156 Application note
|
||||
USB DFU protocol used in the STM32 bootloader
|
||||
|
||||
# Windows drama
|
||||
|
||||
https://github.com/libusb/libusb/wiki/Windows#How_to_use_libusb_on_Windows
|
||||
|
||||
|
||||
Uses precompiled https://github.com/j123b567/java-intelhex-parser
|
|
@ -7,4 +7,5 @@ repositories {
|
|||
dependencies {
|
||||
implementation group: 'org.usb4java', name: 'usb4java', version: '1.3.0'
|
||||
implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
|
||||
implementation files('lib/IntelHexParser.jar')
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
See https://github.com/j123b567/java-intelhex-parser
|
|
@ -0,0 +1,32 @@
|
|||
package com.rusefi.dfu;
|
||||
|
||||
import cz.jaybee.intelhex.DataListener;
|
||||
import cz.jaybee.intelhex.IntelHexException;
|
||||
import cz.jaybee.intelhex.Parser;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class HexReaderSandbox {
|
||||
public static void main(String[] args) throws IOException, IntelHexException {
|
||||
InputStream is = new FileInputStream("sample.hex");
|
||||
|
||||
// create IntelHexParserObject
|
||||
Parser ihp = new Parser(is);
|
||||
|
||||
// register parser listener
|
||||
ihp.setDataListener(new DataListener() {
|
||||
@Override
|
||||
public void data(long address, byte[] data) {
|
||||
System.out.printf("Address %x size %x\n", address, data.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eof() {
|
||||
// do some action
|
||||
}
|
||||
});
|
||||
ihp.parse();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue