mirror of
https://github.com/pine64/blisp.git
synced 2026-09-19 23:21:29 +00:00
Compare commits
56
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec078224bd | ||
|
|
33c3f36b98 | ||
|
|
f6f2013c8e | ||
|
|
729609f2c0 | ||
|
|
491dd4f8c0 | ||
|
|
de4a9cd5e6 | ||
|
|
0b363c620a | ||
|
|
e7eeef5f85 | ||
|
|
aaf07b7724 | ||
|
|
8c3b93cbec | ||
|
|
cc9ef81934 | ||
|
|
9cb381d03e | ||
|
|
f47bc9f948 | ||
|
|
4b8713ecd4 | ||
|
|
935ee4a12c | ||
|
|
55198e9612 | ||
|
|
63dff45156 | ||
|
|
a98a5090b3 | ||
|
|
55f40caa60 | ||
|
|
7618f24c97 | ||
|
|
fb31f9a742 | ||
|
|
28d0743742 | ||
|
|
042b9a72f0 | ||
|
|
eb55ab4702 | ||
|
|
ca4aca7219 | ||
|
|
6f174eaffe | ||
|
|
a59d4f7a32 | ||
|
|
93703a7c2e | ||
|
|
6f508d3db8 | ||
|
|
565c9ff913 | ||
|
|
e219e50efb | ||
|
|
5a0ae8abc3 | ||
|
|
0275fad1db | ||
|
|
e63ca04be5 | ||
|
|
8c21c18b3a | ||
|
|
23ca06a336 | ||
|
|
5ebcf881b6 | ||
|
|
cda17f2713 | ||
|
|
933851a775 | ||
|
|
32e2a64390 | ||
|
|
c157261bf2 | ||
|
|
b54d820408 | ||
|
|
9d4294f308 | ||
|
|
44f5c12b40 | ||
|
|
f2605801a4 | ||
|
|
670ec95507 | ||
|
|
f8acfa2ac1 | ||
|
|
3d4dfe8b81 | ||
|
|
4afdfff4b7 | ||
|
|
7669ebbbcb | ||
|
|
6424f9ddf8 | ||
|
|
7fb2cc829c | ||
|
|
a67ab9d218 | ||
|
|
3fff531334 | ||
|
|
53b57c3158 | ||
|
|
884142932d |
+87
-12
@@ -8,19 +8,20 @@ jobs:
|
|||||||
run:
|
run:
|
||||||
shell: cmd
|
shell: cmd
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: 'recursive'
|
||||||
- uses: lukka/get-cmake@latest
|
- uses: lukka/get-cmake@latest
|
||||||
- name: Build blisp tool
|
- name: Build blisp tool
|
||||||
run: |
|
run: |
|
||||||
git submodule update --init --recursive
|
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
|
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
|
||||||
cmake --build . --config Release
|
cmake --build . --config Release
|
||||||
- name: Upload results
|
- name: Upload results
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: blisp Windows x64 build
|
name: blips-windows-x86_64.zip
|
||||||
path: |
|
path: |
|
||||||
build/tools/blisp/Release/blisp.exe
|
build/tools/blisp/Release/blisp.exe
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
@@ -28,19 +29,20 @@ jobs:
|
|||||||
build-macos:
|
build-macos:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: 'recursive'
|
||||||
- uses: lukka/get-cmake@latest
|
- uses: lukka/get-cmake@latest
|
||||||
- name: Build blisp tool
|
- name: Build blisp tool
|
||||||
run: |
|
run: |
|
||||||
git submodule update --init --recursive
|
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
|
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
|
||||||
cmake --build .
|
cmake --build .
|
||||||
- name: Upload results
|
- name: Upload results
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: blisp macOS x64 build
|
name: blips-apple-x86_64.zip
|
||||||
path: |
|
path: |
|
||||||
build/tools/blisp/blisp
|
build/tools/blisp/blisp
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
@@ -48,19 +50,92 @@ jobs:
|
|||||||
build-linux:
|
build-linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: 'recursive'
|
||||||
- uses: lukka/get-cmake@latest
|
- uses: lukka/get-cmake@latest
|
||||||
- name: Build blisp tool
|
- name: Build blisp tool
|
||||||
run: |
|
run: |
|
||||||
git submodule update --init --recursive
|
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
|
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
|
||||||
cmake --build .
|
cmake --build .
|
||||||
- name: Upload results
|
- name: Upload results
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: blisp Linux x64 build
|
name: blips-linux-x86_64.zip
|
||||||
path: |
|
path: |
|
||||||
build/tools/blisp/blisp
|
build/tools/blisp/blisp
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
|
build-linux-alternative-arch:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Build on ${{ matrix.distro }} ${{ matrix.arch }}
|
||||||
|
|
||||||
|
# Run steps on a matrix of 4 arch/distro combinations
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- arch: aarch64
|
||||||
|
distro: ubuntu_latest
|
||||||
|
- arch: armv7
|
||||||
|
distro: ubuntu_latest
|
||||||
|
- arch: riscv64
|
||||||
|
distro: ubuntu_latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: 'recursive'
|
||||||
|
- uses: uraimo/run-on-arch-action@v2
|
||||||
|
name: Build artifact
|
||||||
|
id: build
|
||||||
|
with:
|
||||||
|
arch: ${{ matrix.arch }}
|
||||||
|
distro: ${{ matrix.distro }}
|
||||||
|
|
||||||
|
# Create an artifacts directory
|
||||||
|
setup: |
|
||||||
|
mkdir -p "${PWD}/artifacts"
|
||||||
|
|
||||||
|
# Mount the artifacts directory as /artifacts in the container
|
||||||
|
dockerRunArgs: |
|
||||||
|
--volume "${PWD}/artifacts:/artifacts"
|
||||||
|
|
||||||
|
# Pass some environment variables to the container
|
||||||
|
env: | # YAML, but pipe character is necessary
|
||||||
|
artifact_name: blisp-linux-${{ matrix.arch }}
|
||||||
|
|
||||||
|
# The shell to run commands with in the container
|
||||||
|
shell: /bin/sh
|
||||||
|
|
||||||
|
# Install some dependencies in the container. This speeds up builds if
|
||||||
|
# you are also using githubToken. Any dependencies installed here will
|
||||||
|
# be part of the container image that gets cached, so subsequent
|
||||||
|
# builds don't have to re-install them. The image layer is cached
|
||||||
|
# publicly in your project's package repository, so it is vital that
|
||||||
|
# no secrets are present in the container state or logs.
|
||||||
|
install: |
|
||||||
|
case "${{ matrix.distro }}" in
|
||||||
|
ubuntu*|jessie|stretch|buster|bullseye)
|
||||||
|
apt-get update -q -y
|
||||||
|
apt-get install -q -y git cmake build-essential
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Produce a binary artifact and place it in the mounted volume
|
||||||
|
run: |
|
||||||
|
git config --global --add safe.directory /home/runner/work/blisp/blisp
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
|
||||||
|
cmake --build . -j2
|
||||||
|
cp ./tools/blisp/blisp "/artifacts/${artifact_name}"
|
||||||
|
echo "Produced artifact at /artifacts/${artifact_name}"
|
||||||
|
|
||||||
|
- name: Upload results
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: blisp-linux-${{ matrix.arch }}.zip
|
||||||
|
path: |
|
||||||
|
artifacts/blisp-*
|
||||||
|
if-no-files-found: error
|
||||||
|
|||||||
+7
-1
@@ -32,11 +32,13 @@ set_target_properties(libblisp_static PROPERTIES
|
|||||||
ARCHIVE_OUTPUT_DIRECTORY "static"
|
ARCHIVE_OUTPUT_DIRECTORY "static"
|
||||||
OUTPUT_NAME "blisp")
|
OUTPUT_NAME "blisp")
|
||||||
|
|
||||||
|
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
target_sources(libblisp_obj PRIVATE
|
target_sources(libblisp_obj PRIVATE
|
||||||
${CMAKE_SOURCE_DIR}/vendor/libserialport/serialport.c
|
${CMAKE_SOURCE_DIR}/vendor/libserialport/serialport.c
|
||||||
${CMAKE_SOURCE_DIR}/vendor/libserialport/timing.c)
|
${CMAKE_SOURCE_DIR}/vendor/libserialport/timing.c)
|
||||||
|
|
||||||
target_include_directories(libblisp_obj PRIVATE ${CMAKE_SOURCE_DIR}/vendor/libserialport)
|
target_include_directories(libblisp_obj PRIVATE ${CMAKE_SOURCE_DIR}/vendor/libserialport)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(libblisp PRIVATE Setupapi.lib)
|
target_link_libraries(libblisp PRIVATE Setupapi.lib)
|
||||||
@@ -44,7 +46,7 @@ if(WIN32)
|
|||||||
target_compile_definitions(libblisp_obj PRIVATE LIBSERIALPORT_MSBUILD)
|
target_compile_definitions(libblisp_obj PRIVATE LIBSERIALPORT_MSBUILD)
|
||||||
target_sources(libblisp_obj PRIVATE
|
target_sources(libblisp_obj PRIVATE
|
||||||
${CMAKE_SOURCE_DIR}/vendor/libserialport/windows.c)
|
${CMAKE_SOURCE_DIR}/vendor/libserialport/windows.c)
|
||||||
elseif(UNIX AND NOT APPLE)
|
elseif(UNIX AND NOT APPLE AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
target_sources(libblisp_obj PRIVATE
|
target_sources(libblisp_obj PRIVATE
|
||||||
${CMAKE_SOURCE_DIR}/vendor/libserialport/linux.c
|
${CMAKE_SOURCE_DIR}/vendor/libserialport/linux.c
|
||||||
${CMAKE_SOURCE_DIR}/vendor/libserialport/linux_termios.c)
|
${CMAKE_SOURCE_DIR}/vendor/libserialport/linux_termios.c)
|
||||||
@@ -56,6 +58,10 @@ elseif(UNIX AND NOT APPLE)
|
|||||||
"SP_API=__attribute__((visibility(\"default\")))"
|
"SP_API=__attribute__((visibility(\"default\")))"
|
||||||
"SP_PRIV=__attribute__((visibility(\"hidden\")))")
|
"SP_PRIV=__attribute__((visibility(\"hidden\")))")
|
||||||
write_file(${CMAKE_SOURCE_DIR}/vendor/libserialport/config.h "// bypass errors.")
|
write_file(${CMAKE_SOURCE_DIR}/vendor/libserialport/config.h "// bypass errors.")
|
||||||
|
elseif(UNIX AND ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
|
target_include_directories(libblisp_obj PRIVATE /usr/local/include/)
|
||||||
|
target_link_libraries(libblisp PRIVATE -L/usr/local/lib usb serialport)
|
||||||
|
target_link_libraries(libblisp_static PRIVATE -L/usr/local/lib usb serialport)
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
target_sources(libblisp_obj PRIVATE
|
target_sources(libblisp_obj PRIVATE
|
||||||
${CMAKE_SOURCE_DIR}/vendor/libserialport/macosx.c)
|
${CMAKE_SOURCE_DIR}/vendor/libserialport/macosx.c)
|
||||||
|
|||||||
@@ -1,35 +1,51 @@
|
|||||||
# Bouffalo Labs ISP tool & library
|
[](https://github.com/pine64/blisp/wiki/Update-Pinecil-V2)
|
||||||
|
[](https://github.com/pine64/blisp/releases/tag/v0.0.3)
|
||||||
|
[](https://discord.com/invite/pine64)
|
||||||
|
[](https://github.com/pine64/blisp/releases/tag/v0.0.3)
|
||||||
|
|
||||||
Open source tool and library for flashing Bouffalo RISC-V MCUs.
|
<img src="./img/Gradient-white-blue-03.png" align="left" width="60" > <br clear="left" />
|
||||||
|
# BLISP
|
||||||
|
|
||||||
|
Bouffalo Labs ISP (in-system-programming) tool & library: an open source tool to flash Bouffalo RISC-V MCUs.
|
||||||
|
|
||||||
**NOTE:** Library API and `blisp` tool cli arguments are not stable yet.
|
**NOTE:** Library API and `blisp` tool cli arguments are not stable yet.
|
||||||
|
<br>
|
||||||
|
|
||||||
# Supported MCUs
|
## Supported MCUs
|
||||||
|
- [x] `bl60x` - BL602 / BL604 / TG7100C / LF686 / LF688
|
||||||
- [x] `bl60x` - BL602 / BL604
|
|
||||||
- [x] `bl70x` - BL702 / BL704 / BL706
|
- [x] `bl70x` - BL702 / BL704 / BL706
|
||||||
- [ ] `bl70xl` - BL702L / BL704L
|
<br>
|
||||||
- [ ] `bl606p` - BL606P
|
|
||||||
- [ ] `bl61x` - BL616 / BL618
|
|
||||||
- [ ] `bl808` - BL808
|
|
||||||
|
|
||||||
# Supported OS
|
## Supported Devices
|
||||||
- [x] Windows
|
| System | <img width="15" src="https://cdn.simpleicons.org/Windows11/5791ac" /> Windows | <img width="15" src="https://cdn.simpleicons.org/Apple/5791ac" /> MacOS| <img width="17" src="https://cdn.simpleicons.org/Linux/5791ac" /> Linux| <img width="15" src="https://cdn.simpleicons.org/Freebsd/5791ac" /> FreeBSD |
|
||||||
- [x] Linux
|
| :-----: | :------: | :------: | :------: | :------: |
|
||||||
- [x] Apple
|
| Pinecil V2 |<img width="22" src="https://cdn.simpleicons.org/cachet/5791ac" />|<img width="22" src="https://cdn.simpleicons.org/cachet/5791ac" />| <img width="22" src="https://cdn.simpleicons.org/cachet/5791ac" />| <img width="22" src="https://cdn.simpleicons.org/cachet/5791ac" /> |
|
||||||
|
| Pinecone |<img width="22" src="https://cdn.simpleicons.org/cachet/5791ac" />|<img width="22" src="https://cdn.simpleicons.org/cachet/5791ac" />|<img width="22" src="https://cdn.simpleicons.org/cachet/5791ac" />| <img width="22" src="https://cdn.simpleicons.org/cachet/5791ac" /> |
|
||||||
|
<br>
|
||||||
|
|
||||||
|
## How to update Pinecil V2
|
||||||
|
|
||||||
# Building
|
Download the newest release of [Blisp updater here](https://github.com/pine64/blisp/releases/).
|
||||||
|
|
||||||
## Clone repository
|
Check out the [wiki page](https://github.com/pine64/blisp/wiki/Update-Pinecil-V2) for install instructions.
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
## Building from code
|
||||||
|
|
||||||
|
### Clone repository
|
||||||
|
|
||||||
If you have not cloned this repository locally; clone the git repository locally by running
|
If you have not cloned this repository locally; clone the git repository locally by running
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone --recursive https://github.com/pine64/blisp.git
|
git clone --recursive https://github.com/pine64/blisp.git
|
||||||
cd blisp
|
cd blisp
|
||||||
|
git submodule update --init --recursive
|
||||||
```
|
```
|
||||||
|
|
||||||
## Build the library and command line utility
|
If vendor/argtable3 and vendor/libserialport/ are empty, this last step has
|
||||||
|
failed and should be investigated.
|
||||||
|
|
||||||
|
### Build the library and command line utility
|
||||||
|
|
||||||
For building `blisp` command line tool, use following commands:
|
For building `blisp` command line tool, use following commands:
|
||||||
|
|
||||||
@@ -38,21 +54,33 @@ mkdir build && cd build
|
|||||||
cmake -DBLISP_BUILD_CLI=ON ..
|
cmake -DBLISP_BUILD_CLI=ON ..
|
||||||
cmake --build .
|
cmake --build .
|
||||||
```
|
```
|
||||||
|
#### Need more build details? [See here](https://github.com/pine64/blisp/wiki/Update-Pinecil-V2#build-blisp-flasher-from-code).
|
||||||
|
|
||||||
# Usage
|
## Usage
|
||||||
|
|
||||||
For BL70X, BL61X, BL808 and BL606P, connected via USB, you can use following command, which will auto-detect serial port:
|
For BL70X, BL61X, BL808 and BL606P, connected via USB, you can use following command, which will auto-detect serial port on Windows:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
blisp write --chip bl70x --reset name_of_firmware.bin
|
.\blisp.exe write --chip=bl70x --reset .\name_of_firmware.bin
|
||||||
|
or
|
||||||
|
.\blisp.exe write -c bl70x --reset .\name_of_firmware.bin
|
||||||
```
|
```
|
||||||
|
|
||||||
For BL60X, you need to specify also the serial port path:
|
For BL60X, you need to specify also the serial port path:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
blisp --chip bl60x --reset -p /dev/ttyUSB0 name_of_firmware.bin
|
blisp write --chip bl60x --reset -p /dev/ttyUSB0 name_of_firmware.bin
|
||||||
```
|
```
|
||||||
|
|
||||||
# How to flash Pinecil V2
|
If you wish to see additional debugging, set the environmental
|
||||||
|
variable LIBSERIALPORT_DEBUG before running. You can either export this
|
||||||
|
in your shell or change it for a single run via
|
||||||
|
|
||||||
Check out the [wiki page](https://github.com/pine64/blisp/wiki/Update-Pinecil-V2).
|
```bash
|
||||||
|
LIBSERIALPORT_DEBUG=y ./a.out write -c bl70x -p /dev/tty.usbmodem0000000200001
|
||||||
|
```
|
||||||
|
|
||||||
|
Because this is done at the lowest level of serial communication, the
|
||||||
|
displays aren't packet-aware or know about the chip's command set or such.
|
||||||
|
This is really only useful for debugging systems-level issues withing
|
||||||
|
the device or blisp itself.
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
+12
-8
@@ -13,6 +13,12 @@
|
|||||||
|
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
|
|
||||||
|
static void drain(struct sp_port* port) {
|
||||||
|
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
|
sp_drain(port);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int32_t blisp_device_init(struct blisp_device* device,
|
int32_t blisp_device_init(struct blisp_device* device,
|
||||||
struct blisp_chip* chip) {
|
struct blisp_chip* chip) {
|
||||||
device->chip = chip;
|
device->chip = chip;
|
||||||
@@ -73,13 +79,13 @@ int32_t blisp_device_open(struct blisp_device* device, const char* port_name) {
|
|||||||
sp_set_stopbits(serial_port, 1);
|
sp_set_stopbits(serial_port, 1);
|
||||||
sp_set_flowcontrol(serial_port, SP_FLOWCONTROL_NONE);
|
sp_set_flowcontrol(serial_port, SP_FLOWCONTROL_NONE);
|
||||||
|
|
||||||
uint32_t vid, pid;
|
int vid, pid;
|
||||||
sp_get_port_usb_vid_pid(serial_port, &vid, &pid);
|
sp_get_port_usb_vid_pid(serial_port, &vid, &pid);
|
||||||
device->is_usb = pid == 0xFFFF;
|
device->is_usb = pid == 0xFFFF;
|
||||||
// if (device->is_usb) {
|
// if (device->is_usb) {
|
||||||
// device->current_baud_rate = 2000000;
|
// device->current_baud_rate = 2000000;
|
||||||
// } else {
|
// } else {
|
||||||
device->current_baud_rate = 500000;
|
device->current_baud_rate = 460800;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -130,9 +136,7 @@ int32_t blisp_send_command(struct blisp_device* device,
|
|||||||
blisp_dlog("Received error or not written all data: %d", ret);
|
blisp_dlog("Received error or not written all data: %d", ret);
|
||||||
return BLISP_ERR_UNKNOWN;
|
return BLISP_ERR_UNKNOWN;
|
||||||
}
|
}
|
||||||
#ifdef __APPLE__
|
drain(serial_port);
|
||||||
sp_drain(serial_port);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return BLISP_OK;
|
return BLISP_OK;
|
||||||
}
|
}
|
||||||
@@ -195,12 +199,12 @@ int32_t blisp_device_handshake(struct blisp_device* device, bool in_ef_loader) {
|
|||||||
if (!in_ef_loader) {
|
if (!in_ef_loader) {
|
||||||
if (device->is_usb) {
|
if (device->is_usb) {
|
||||||
sp_blocking_write(serial_port, "BOUFFALOLAB5555RESET\0\0", 22, 100);
|
sp_blocking_write(serial_port, "BOUFFALOLAB5555RESET\0\0", 22, 100);
|
||||||
#ifdef __APPLE__
|
drain(serial_port);
|
||||||
sp_drain(serial_port);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret = sp_blocking_write(serial_port, handshake_buffer, bytes_count, 500);
|
ret = sp_blocking_write(serial_port, handshake_buffer, bytes_count, 500);
|
||||||
|
// not sure about Apple part, but FreeBSD needs it
|
||||||
|
drain(serial_port);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
blisp_dlog("Handshake write failed, ret %d", ret);
|
blisp_dlog("Handshake write failed, ret %d", ret);
|
||||||
return BLISP_ERR_UNKNOWN;
|
return BLISP_ERR_UNKNOWN;
|
||||||
|
|||||||
+3
-1
@@ -24,6 +24,8 @@ static int64_t blisp_easy_transport_size(struct blisp_easy_transport* transport)
|
|||||||
return transport->data.memory.data_size;
|
return transport->data.memory.data_size;
|
||||||
} else {
|
} else {
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
|
printf("%s() Warning: calling non-implemented function\n", __func__);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,7 +331,7 @@ int32_t blisp_easy_flash_write(struct blisp_device* device,
|
|||||||
uint32_t data_size,
|
uint32_t data_size,
|
||||||
blisp_easy_progress_callback progress_callback) {
|
blisp_easy_progress_callback progress_callback) {
|
||||||
int32_t ret;
|
int32_t ret;
|
||||||
#ifdef __APPLE__
|
#if defined (__APPLE__) || defined (__FreeBSD__)
|
||||||
const uint16_t buffer_max_size = 372 * 1;
|
const uint16_t buffer_max_size = 372 * 1;
|
||||||
#else
|
#else
|
||||||
const uint16_t buffer_max_size = 2052;
|
const uint16_t buffer_max_size = 2052;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
void blisp_common_progress_callback(uint32_t current_value, uint32_t max_value) {
|
void blisp_common_progress_callback(uint32_t current_value, uint32_t max_value) {
|
||||||
printf("%" PRIu32 "b / %ldb (%.2f%%)\n", current_value, max_value,
|
printf("%" PRIu32 "b / %u (%.2f%%)\n", current_value, max_value,
|
||||||
(((float)current_value / (float)max_value) * 100.0f));
|
(((float)current_value / (float)max_value) * 100.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ ssize_t util_get_binary_folder(char* buffer, uint32_t buffer_size) {
|
|||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
util_get_executable_path(buffer, buffer_size);
|
util_get_executable_path(buffer, buffer_size);
|
||||||
char* pos = strrchr(buffer, '/');
|
char* pos = strrchr(buffer, '/');
|
||||||
|
#elif __FreeBSD__
|
||||||
|
if (readlink("/proc/curproc/file", buffer, buffer_size) <= 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
char* pos = strrchr(buffer, '/');
|
||||||
#else
|
#else
|
||||||
if (GetModuleFileName(NULL, buffer, buffer_size) <= 0) {
|
if (GetModuleFileName(NULL, buffer, buffer_size) <= 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef __linux__
|
#if defined(_MSC_VER)
|
||||||
#include <unistd.h>
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#include <BaseTsd.h>
|
#include <BaseTsd.h>
|
||||||
typedef SSIZE_T ssize_t;
|
typedef SSIZE_T ssize_t;
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@@ -15,6 +13,8 @@ typedef SSIZE_T ssize_t;
|
|||||||
#include <sys/syslimits.h>
|
#include <sys/syslimits.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ssize_t util_get_binary_folder(char* buffer, uint32_t buffer_size);
|
ssize_t util_get_binary_folder(char* buffer, uint32_t buffer_size);
|
||||||
|
|||||||
Reference in New Issue
Block a user