mirror of
https://github.com/pine64/blisp.git
synced 2025-06-22 19:54:45 +00:00
Compare commits
6 Commits
3325f3725e
...
5e09eca00d
Author | SHA1 | Date | |
---|---|---|---|
|
5e09eca00d | ||
|
5a6cd281c3 | ||
|
2141e33c2b | ||
|
a7c69dbcee | ||
|
10b150ee76 | ||
|
cbac0733ee |
66
.github/workflows/build.yml
vendored
Normal file
66
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
name: Build
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build-windows:
|
||||
runs-on: windows-2022
|
||||
defaults:
|
||||
run:
|
||||
shell: cmd
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: lukka/get-cmake@latest
|
||||
- name: Build blisp tool
|
||||
run: |
|
||||
git submodule update --init --recursive
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build . --config Release
|
||||
- name: Upload results
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: blisp Windows x64 build
|
||||
path: |
|
||||
build/tools/blisp/Release/blisp.exe
|
||||
if-no-files-found: error
|
||||
|
||||
build-macos:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: lukka/get-cmake@latest
|
||||
- name: Build blisp tool
|
||||
run: |
|
||||
git submodule update --init --recursive
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build .
|
||||
- name: Upload results
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: blisp macOS x64 build
|
||||
path: |
|
||||
build/tools/blisp/blisp
|
||||
if-no-files-found: error
|
||||
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: lukka/get-cmake@latest
|
||||
- name: Build blisp tool
|
||||
run: |
|
||||
git submodule update --init --recursive
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build .
|
||||
- name: Upload results
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: blisp Linux x64 build
|
||||
path: |
|
||||
build/tools/blisp/blisp
|
||||
if-no-files-found: error
|
@ -20,14 +20,14 @@ add_library(libblisp_static STATIC $<TARGET_OBJECTS:libblisp_obj>)
|
||||
|
||||
set_target_properties(libblisp PROPERTIES
|
||||
PUBLIC_HEADER "include/blisp.h"
|
||||
VERSION 0.0.2
|
||||
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.2
|
||||
VERSION 0.0.3
|
||||
SOVERSION 1
|
||||
ARCHIVE_OUTPUT_DIRECTORY "static"
|
||||
OUTPUT_NAME "blisp")
|
||||
@ -39,7 +39,8 @@ target_sources(libblisp_obj PRIVATE
|
||||
target_include_directories(libblisp_obj PRIVATE ${CMAKE_SOURCE_DIR}/vendor/libserialport)
|
||||
|
||||
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)
|
||||
|
@ -8,6 +8,7 @@ Open source tool and library for flashing Bouffalo RISC-V MCUs.
|
||||
|
||||
- [x] `bl60x` - BL602 / BL604
|
||||
- [x] `bl70x` - BL702 / BL704 / BL706
|
||||
- [ ] `bl70xl` - BL702L / BL704L
|
||||
- [ ] `bl606p` - BL606P
|
||||
- [ ] `bl61x` - BL616 / BL618
|
||||
- [ ] `bl808` - BL808
|
||||
@ -15,7 +16,7 @@ Open source tool and library for flashing Bouffalo RISC-V MCUs.
|
||||
# Supported OS
|
||||
- [x] Windows
|
||||
- [x] Linux
|
||||
- [ ] Apple (WIP: work-in-progress)
|
||||
- [x] Apple
|
||||
|
||||
# Building
|
||||
|
||||
|
@ -130,6 +130,10 @@ int32_t blisp_send_command(struct blisp_device* device,
|
||||
blisp_dlog("Received error or not written all data: %d", ret);
|
||||
return BLISP_ERR_UNKNOWN;
|
||||
}
|
||||
#ifdef __APPLE__
|
||||
sp_drain(serial_port);
|
||||
#endif
|
||||
|
||||
return BLISP_OK;
|
||||
}
|
||||
|
||||
@ -191,6 +195,9 @@ 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);
|
||||
#ifdef __APPLE__
|
||||
sp_drain(serial_port);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
ret = sp_blocking_write(serial_port, handshake_buffer, bytes_count, 500);
|
||||
@ -210,6 +217,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;
|
||||
|
@ -57,17 +57,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 +329,25 @@ int32_t blisp_easy_flash_write(struct blisp_device* device,
|
||||
uint32_t data_size,
|
||||
blisp_easy_progress_callback progress_callback) {
|
||||
int32_t ret;
|
||||
#ifdef __APPLE__
|
||||
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
|
||||
|
@ -45,7 +45,7 @@ int8_t args_parse_exec(int argc, char** argv) {
|
||||
print_help();
|
||||
return 1;
|
||||
} else if (version->count) {
|
||||
printf("blisp v0.0.2\n");
|
||||
printf("blisp v0.0.3\n");
|
||||
printf("Copyright (C) 2023 Marek Kraus and PINE64 Community\n");
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user