65 Commits
Author SHA1 Message Date
Ben V. Brown ec078224bd Unify uploaded artefact names 2023-05-09 14:38:58 +10:00
Ben V. Brown 33c3f36b98 update upload artifact 2023-05-09 14:31:37 +10:00
Ben V. Brown f6f2013c8e Upload with specific names 2023-05-09 14:29:51 +10:00
Ben V. Brown 729609f2c0 Use Actions to recursively checkout 2023-05-09 14:29:51 +10:00
Ben V. Brown 491dd4f8c0 Draft test multi builder 2023-05-09 08:30:09 +10:00
river-mochi de4a9cd5e6 update install instructions 2023-04-10 18:26:06 -07:00
River M 0b363c620a Merge pull request #31 from River-Mochi/master
changed icon colors
2023-04-01 21:28:57 -07:00
River M e7eeef5f85 changed icon colors
Icons in black can not be seen well in dark screen. 
changed to color that matches badges and can be seen in dark mode.
2023-04-01 21:28:08 -07:00
Robert Lipe aaf07b7724 Update README.md
Updated from https://github.com/pine64/blisp/pull/1/files
2023-03-30 13:51:18 -05:00
Marek Kraus 8c3b93cbec Merge pull request #28 from River-Mochi/master
defind ISP
2023-03-30 20:04:35 +02:00
River M cc9ef81934 Update README.md 2023-03-30 10:57:23 -07:00
River M 9cb381d03e Update README.md 2023-03-19 15:49:38 -07:00
Robert Lipe f47bc9f948 Merge pull request #26 from River-Mochi/master
add table, icons, edit doc
2023-03-18 18:08:11 -05:00
River M 4b8713ecd4 Update README.md 2023-03-18 15:01:40 -07:00
River M 935ee4a12c Delete test 2023-03-18 14:55:03 -07:00
River M 55198e9612 Update README.md 2023-03-18 14:05:05 -07:00
River M 63dff45156 Update README.md 2023-03-18 14:03:44 -07:00
River M a98a5090b3 Update README.md 2023-03-18 13:43:53 -07:00
River M 55f40caa60 Update README.md 2023-03-18 13:10:41 -07:00
River M 7618f24c97 Update README.md 2023-03-18 12:41:33 -07:00
River M fb31f9a742 Add files via upload 2023-03-18 12:38:19 -07:00
River M 28d0743742 Create test 2023-03-18 12:37:52 -07:00
River M 042b9a72f0 Update README.md 2023-03-18 12:31:53 -07:00
River M eb55ab4702 Update README.md 2023-03-18 12:29:21 -07:00
River M ca4aca7219 Update README.md 2023-03-18 12:27:18 -07:00
River M 6f174eaffe Update README.md 2023-03-18 12:14:04 -07:00
River M a59d4f7a32 Merge branch 'pine64:master' into master 2023-03-17 04:53:04 -07:00
Marek Kraus 93703a7c2e Merge pull request #25 from porsolic/master
Enable building on FreeBSD hosts
2023-03-17 09:46:02 +01:00
porsolic 6f508d3db8 Enable building on FreeBSD hosts
FreeBSD has libusb built in.
Needs external libserialport.
2023-03-17 00:13:17 +01:00
River M 565c9ff913 Update README.md 2023-03-12 14:54:49 -07:00
River M e219e50efb Update README.md 2023-03-09 16:39:20 -08:00
River M 5a0ae8abc3 Update README.md 2023-03-09 14:15:12 -08:00
River M 0275fad1db Update README.md 2023-03-03 04:20:54 -08:00
River M e63ca04be5 Update README.md 2023-03-03 04:18:14 -08:00
River M 8c21c18b3a Merge branch 'pine64:master' into master 2023-03-03 04:11:38 -08:00
23ca06a336 add Badges (#23)
* Update README.md

syntax error in instructions. this command as written will not work because if flag --chip is used it needs to be --chip=bl70x with the "="
does not work: blisp write --chip bl70x --reset name_of_firmware.bin
or if "=" is not desired then "-c bl70x" could be used instead.

-c, --chip=<chip_type>    Chip Type

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

---------

Co-authored-by: River <97197236+River-b@users.noreply.github.com>
Co-authored-by: Marek Kraus <gamelaster@users.noreply.github.com>
2023-03-02 09:59:05 +01:00
Marek Kraus 5ebcf881b6 Merge branch 'master' into master 2023-03-02 09:58:34 +01:00
River M cda17f2713 Update README.md 2023-03-02 00:53:32 -08:00
River M 933851a775 Update README.md 2023-03-02 00:50:02 -08:00
River M 32e2a64390 Update README.md 2023-03-02 00:46:50 -08:00
River M c157261bf2 Update README.md 2023-03-02 09:44:16 +01:00
River M b54d820408 Update README.md 2023-03-02 09:44:16 +01:00
River M 9d4294f308 Update README.md 2023-03-02 09:44:16 +01:00
River M 44f5c12b40 Update README.md 2023-03-02 00:08:31 -08:00
River M f2605801a4 Update README.md 2023-03-01 22:04:18 -08:00
River M 670ec95507 Update README.md 2023-03-01 19:15:54 -08:00
River M f8acfa2ac1 Merge branch 'pine64:master' into master 2023-03-01 17:58:14 -08:00
Marek Kraus 3d4dfe8b81 Add BL602 branded MCUs 2023-02-28 11:23:18 +01:00
River 4afdfff4b7 Update README.md
syntax error in instructions. this command as written will not work because if flag --chip is used it needs to be --chip=bl70x with the "="
does not work: blisp write --chip bl70x --reset name_of_firmware.bin
or if "=" is not desired then "-c bl70x" could be used instead.

-c, --chip=<chip_type>    Chip Type
2023-02-19 15:48:48 +01:00
River 7669ebbbcb Update README.md
syntax error in instructions. this command as written will not work because if flag --chip is used it needs to be --chip=bl70x with the "="
does not work: blisp write --chip bl70x --reset name_of_firmware.bin
or if "=" is not desired then "-c bl70x" could be used instead.

-c, --chip=<chip_type>    Chip Type
2023-02-15 14:22:20 -08:00
porsolic 6424f9ddf8 Fix it to work under FreeBSD
Add sp_drain() where needed. Without it FreeBSD won't pass the handshake
phase.
Also decreate max buffer size.
Tested with Pinecil v2 and it can write and check new firmware.
2023-02-15 20:21:47 +01:00
porsolic 7fb2cc829c Fix UART baudrate
Set standard baudrate (460800) instead of non-standard (500000).
This enables opening of serial device under FreeBSD without error.
2023-02-15 20:21:47 +01:00
porsolic a67ab9d218 Fix build on FreeBSD 2023-02-15 20:21:47 +01:00
porsolic 3fff531334 Fix compiler warnings 2023-02-15 20:21:47 +01:00
porsolic 53b57c3158 Update README.md
Add missing part about git submodules.
Without it build system won't find dependencies.
2023-02-15 20:21:47 +01:00
Lee Lup Yuen 884142932d The "write" command is missing I think. Thanks :-) 2023-01-25 08:45:59 +01:00
Marek Kraus 5e09eca00d Fix Windows CI build 2023-01-21 15:17:17 +01:00
Marek Kraus 5a6cd281c3 Adds CI 2023-01-21 15:01:18 +01:00
Marek Kraus 2141e33c2b Version v0.0.3 2023-01-21 14:50:35 +01:00
Marek Kraus a7c69dbcee Add BL70XL into status matrix 2023-01-21 14:50:27 +01:00
Marek Kraus 10b150ee76 Update README that Apple is now supported 2023-01-21 14:48:31 +01:00
Marek Kraus cbac0733ee Final support of flashing on macOS
For some reason, macOS have issues with USB CDC,
surprisingly, CH340G convertor works just fine.
But FTDI and Bouffalo's USB CDC didn't worked.
Basically, without writing anything, we don't receive
response from board. This was fixed by adding drain
after writing BOUFALLOLABRESET handshake + adding
drains after every commmand write. Also, for some reason,
in USB CDC, the size of USB payload is limited, else
it will fail.
2023-01-21 14:34:46 +01:00
Marek Kraus 3325f3725e Make macOS build working again 2023-01-21 10:08:26 +01:00
Marek Kraus 626522e074 Version v0.0.2 2023-01-12 11:49:04 +01:00
Marek Kraus b941e60fbd [blisp] Disable compilation of argtable3 tests and other stuff 2023-01-12 11:46:40 +01:00
13 changed files with 263 additions and 45 deletions
+141
View File
@@ -0,0 +1,141 @@
name: Build
on: [push, pull_request]
jobs:
build-windows:
runs-on: windows-2022
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: lukka/get-cmake@latest
- name: Build blisp tool
run: |
mkdir build
cd build
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
- name: Upload results
uses: actions/upload-artifact@v3
with:
name: blips-windows-x86_64.zip
path: |
build/tools/blisp/Release/blisp.exe
if-no-files-found: error
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: lukka/get-cmake@latest
- name: Build blisp tool
run: |
mkdir build
cd build
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
cmake --build .
- name: Upload results
uses: actions/upload-artifact@v3
with:
name: blips-apple-x86_64.zip
path: |
build/tools/blisp/blisp
if-no-files-found: error
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: lukka/get-cmake@latest
- name: Build blisp tool
run: |
mkdir build
cd build
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
cmake --build .
- name: Upload results
uses: actions/upload-artifact@v3
with:
name: blips-linux-x86_64.zip
path: |
build/tools/blisp/blisp
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
+12 -5
View File
@@ -20,30 +20,33 @@ add_library(libblisp_static STATIC $<TARGET_OBJECTS:libblisp_obj>)
set_target_properties(libblisp PROPERTIES
PUBLIC_HEADER "include/blisp.h"
VERSION 0.0.1
VERSION 0.0.3
SOVERSION 1
LIBRARY_OUTPUT_DIRECTORY "shared"
OUTPUT_NAME "blisp")
set_target_properties(libblisp_static PROPERTIES
PUBLIC_HEADER "include/blisp.h"
VERSION 0.0.1
SOVERSION 2
VERSION 0.0.3
SOVERSION 1
ARCHIVE_OUTPUT_DIRECTORY "static"
OUTPUT_NAME "blisp")
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
target_sources(libblisp_obj PRIVATE
${CMAKE_SOURCE_DIR}/vendor/libserialport/serialport.c
${CMAKE_SOURCE_DIR}/vendor/libserialport/timing.c)
target_include_directories(libblisp_obj PRIVATE ${CMAKE_SOURCE_DIR}/vendor/libserialport)
endif()
if(WIN32)
target_link_libraries(libblisp_obj PRIVATE Setupapi.lib)
target_link_libraries(libblisp PRIVATE Setupapi.lib)
target_link_libraries(libblisp_static PRIVATE Setupapi.lib)
target_compile_definitions(libblisp_obj PRIVATE LIBSERIALPORT_MSBUILD)
target_sources(libblisp_obj PRIVATE
${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
${CMAKE_SOURCE_DIR}/vendor/libserialport/linux.c
${CMAKE_SOURCE_DIR}/vendor/libserialport/linux_termios.c)
@@ -55,6 +58,10 @@ elseif(UNIX AND NOT APPLE)
"SP_API=__attribute__((visibility(\"default\")))"
"SP_PRIV=__attribute__((visibility(\"hidden\")))")
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)
target_sources(libblisp_obj PRIVATE
${CMAKE_SOURCE_DIR}/vendor/libserialport/macosx.c)
+50 -21
View File
@@ -1,34 +1,51 @@
# Bouffalo Labs ISP tool & library
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fpine64%2Fblisp&count_bg=%235791AC&title_bg=%23555555&icon=airplayaudio.svg&icon_color=%23D2D9DD&title=hits&edge_flat=false)](https://github.com/pine64/blisp/wiki/Update-Pinecil-V2)
[![GitHub all downloads](https://img.shields.io/github/downloads/pine64/blisp/total?color=5791ac&logo=docusign&logoColor=white)](https://github.com/pine64/blisp/releases/tag/v0.0.3)
[![Discord](https://img.shields.io/discord/463237927984693259?color=5791ac&logo=discord&logoColor=white)](https://discord.com/invite/pine64)
[![GitHub release](https://img.shields.io/github/v/release/pine64/blisp?color=5791ac)](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.
<br>
# Supported MCUs
- [x] `bl60x` - BL602 / BL604
## Supported MCUs
- [x] `bl60x` - BL602 / BL604 / TG7100C / LF686 / LF688
- [x] `bl70x` - BL702 / BL704 / BL706
- [ ] `bl606p` - BL606P
- [ ] `bl61x` - BL616 / BL618
- [ ] `bl808` - BL808
<br>
# Supported OS
- [x] Windows
- [x] Linux
- [ ] Apple (WIP: work-in-progress)
## Supported Devices
| 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 |
| :-----: | :------: | :------: | :------: | :------: |
| 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
```bash
git clone --recursive https://github.com/pine64/blisp.git
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:
@@ -37,21 +54,33 @@ mkdir build && cd build
cmake -DBLISP_BUILD_CLI=ON ..
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
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:
```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

+14 -2
View File
@@ -13,6 +13,12 @@
#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,
struct blisp_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_flowcontrol(serial_port, SP_FLOWCONTROL_NONE);
uint32_t vid, pid;
int vid, pid;
sp_get_port_usb_vid_pid(serial_port, &vid, &pid);
device->is_usb = pid == 0xFFFF;
// if (device->is_usb) {
// device->current_baud_rate = 2000000;
// } else {
device->current_baud_rate = 500000;
device->current_baud_rate = 460800;
// }
#if 0
@@ -130,6 +136,8 @@ int32_t blisp_send_command(struct blisp_device* device,
blisp_dlog("Received error or not written all data: %d", ret);
return BLISP_ERR_UNKNOWN;
}
drain(serial_port);
return BLISP_OK;
}
@@ -191,9 +199,12 @@ int32_t blisp_device_handshake(struct blisp_device* device, bool in_ef_loader) {
if (!in_ef_loader) {
if (device->is_usb) {
sp_blocking_write(serial_port, "BOUFFALOLAB5555RESET\0\0", 22, 100);
drain(serial_port);
}
}
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) {
blisp_dlog("Handshake write failed, ret %d", ret);
return BLISP_ERR_UNKNOWN;
@@ -210,6 +221,7 @@ int32_t blisp_device_handshake(struct blisp_device* device, bool in_ef_loader) {
return BLISP_OK;
}
}
}
blisp_dlog("Received no response from chip.");
return BLISP_ERR_NO_RESPONSE;
+27 -5
View File
@@ -24,6 +24,8 @@ static int64_t blisp_easy_transport_size(struct blisp_easy_transport* transport)
return transport->data.memory.data_size;
} else {
// TODO: Implement
printf("%s() Warning: calling non-implemented function\n", __func__);
return -1;
}
}
@@ -57,17 +59,27 @@ int32_t blisp_easy_load_segment_data(
struct blisp_easy_transport* segment_transport,
blisp_easy_progress_callback progress_callback) {
int32_t ret;
#ifdef __APPLE__
const uint16_t buffer_max_size = 252 * 16;
#else
const uint16_t buffer_max_size = 4092;
#endif
uint32_t sent_data = 0;
uint32_t buffer_size = 0;
#ifdef _WIN32
uint8_t buffer[4092];
#else
uint8_t buffer[buffer_max_size];
#endif
blisp_easy_report_progress(progress_callback, 0, segment_size);
while (sent_data < segment_size) {
buffer_size = segment_size - sent_data;
if (buffer_size > 4092) {
buffer_size = 4092;
if (buffer_size > buffer_max_size) {
buffer_size = buffer_max_size;
}
blisp_easy_transport_read(segment_transport, buffer,
buffer_size); // TODO: Error Handling
@@ -319,15 +331,25 @@ int32_t blisp_easy_flash_write(struct blisp_device* device,
uint32_t data_size,
blisp_easy_progress_callback progress_callback) {
int32_t ret;
#if defined (__APPLE__) || defined (__FreeBSD__)
const uint16_t buffer_max_size = 372 * 1;
#else
const uint16_t buffer_max_size = 2052;
#endif
uint32_t sent_data = 0;
uint32_t buffer_size = 0;
uint8_t buffer[8184];
#ifdef _WIN32
uint8_t buffer[2052];
#else
uint8_t buffer[buffer_max_size];
#endif
blisp_easy_report_progress(progress_callback, 0, data_size);
while (sent_data < data_size) {
buffer_size = data_size - sent_data;
if (buffer_size > 2052) {
buffer_size = 2052;
if (buffer_size > buffer_max_size) {
buffer_size = buffer_max_size;
}
blisp_easy_transport_read(data_transport, buffer,
buffer_size); // TODO: Error Handling
+1 -1
View File
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include "../../data/bl60x_eflash_loader.h"
#include "blisp.h"
+1 -1
View File
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include "../../data/bl70x_eflash_loader.h"
#include "blisp.h"
+3
View File
@@ -1,3 +1,6 @@
set(ARGTABLE3_ENABLE_TESTS OFF CACHE BOOL "Enable unit tests")
set(ARGTABLE3_ENABLE_EXAMPLES OFF CACHE BOOL "Enable examples")
#set(ARGTABLE3_REPLACE_GETOPT OFF CACHE BOOL "Replace getopt in the system C library")
add_subdirectory(${CMAKE_SOURCE_DIR}/vendor/argtable3 ${CMAKE_CURRENT_BINARY_DIR}/argtable3)
add_executable(blisp src/main.c src/cmd/write.c src/util.c src/common.c src/cmd/iot.c)
+2 -2
View File
@@ -3,7 +3,7 @@
#include <argtable3.h>
#include <blisp.h>
#include <inttypes.h>
#include <malloc.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
@@ -11,7 +11,7 @@
#include "util.h"
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));
}
+1 -1
View File
@@ -45,7 +45,7 @@ int8_t args_parse_exec(int argc, char** argv) {
print_help();
return 1;
} else if (version->count) {
printf("blisp 0.0.1\n");
printf("blisp v0.0.3\n");
printf("Copyright (C) 2023 Marek Kraus and PINE64 Community\n");
return 1;
}
+7
View File
@@ -9,6 +9,8 @@
// These are not thread safe, but it doesn't place the responsibility
// to free an allocated buffer on the caller.nn
#include <stdlib.h>
static void util_get_executable_path(char* buffer_out, uint32_t max_size) {
assert(max_size >= PATH_MAX); // n.b. 1024 on MacOS. 4K on most Linux.
@@ -33,6 +35,11 @@ ssize_t util_get_binary_folder(char* buffer, uint32_t buffer_size) {
#elif defined(__APPLE__)
util_get_executable_path(buffer, buffer_size);
char* pos = strrchr(buffer, '/');
#elif __FreeBSD__
if (readlink("/proc/curproc/file", buffer, buffer_size) <= 0) {
return -1;
}
char* pos = strrchr(buffer, '/');
#else
if (GetModuleFileName(NULL, buffer, buffer_size) <= 0) {
return -1;
+4 -7
View File
@@ -4,9 +4,7 @@
#include <stdint.h>
#ifdef __linux__
#include <unistd.h>
#elif defined(_MSC_VER)
#if defined(_MSC_VER)
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#include <windows.h>
@@ -14,10 +12,9 @@ typedef SSIZE_T ssize_t;
#elif defined(__APPLE__)
#include <sys/syslimits.h>
#include <assert.h>
#endif
#ifdef __linux__
#include <linux/limits.h>
#include <sys/types.h>
#else
#include <unistd.h>
#endif
ssize_t util_get_binary_folder(char* buffer, uint32_t buffer_size);