mirror of
https://github.com/pine64/blisp.git
synced 2026-09-20 17:21:30 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e09eca00d | ||
|
|
5a6cd281c3 | ||
|
|
2141e33c2b | ||
|
|
a7c69dbcee | ||
|
|
10b150ee76 | ||
|
|
cbac0733ee | ||
|
|
3325f3725e | ||
|
|
626522e074 | ||
|
|
b941e60fbd |
@@ -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
|
||||||
+5
-4
@@ -20,15 +20,15 @@ add_library(libblisp_static STATIC $<TARGET_OBJECTS:libblisp_obj>)
|
|||||||
|
|
||||||
set_target_properties(libblisp PROPERTIES
|
set_target_properties(libblisp PROPERTIES
|
||||||
PUBLIC_HEADER "include/blisp.h"
|
PUBLIC_HEADER "include/blisp.h"
|
||||||
VERSION 0.0.1
|
VERSION 0.0.3
|
||||||
SOVERSION 1
|
SOVERSION 1
|
||||||
LIBRARY_OUTPUT_DIRECTORY "shared"
|
LIBRARY_OUTPUT_DIRECTORY "shared"
|
||||||
OUTPUT_NAME "blisp")
|
OUTPUT_NAME "blisp")
|
||||||
|
|
||||||
set_target_properties(libblisp_static PROPERTIES
|
set_target_properties(libblisp_static PROPERTIES
|
||||||
PUBLIC_HEADER "include/blisp.h"
|
PUBLIC_HEADER "include/blisp.h"
|
||||||
VERSION 0.0.1
|
VERSION 0.0.3
|
||||||
SOVERSION 2
|
SOVERSION 1
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "static"
|
ARCHIVE_OUTPUT_DIRECTORY "static"
|
||||||
OUTPUT_NAME "blisp")
|
OUTPUT_NAME "blisp")
|
||||||
|
|
||||||
@@ -39,7 +39,8 @@ target_sources(libblisp_obj PRIVATE
|
|||||||
target_include_directories(libblisp_obj PRIVATE ${CMAKE_SOURCE_DIR}/vendor/libserialport)
|
target_include_directories(libblisp_obj PRIVATE ${CMAKE_SOURCE_DIR}/vendor/libserialport)
|
||||||
|
|
||||||
if(WIN32)
|
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_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)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ Open source tool and library for flashing Bouffalo RISC-V MCUs.
|
|||||||
|
|
||||||
- [x] `bl60x` - BL602 / BL604
|
- [x] `bl60x` - BL602 / BL604
|
||||||
- [x] `bl70x` - BL702 / BL704 / BL706
|
- [x] `bl70x` - BL702 / BL704 / BL706
|
||||||
|
- [ ] `bl70xl` - BL702L / BL704L
|
||||||
- [ ] `bl606p` - BL606P
|
- [ ] `bl606p` - BL606P
|
||||||
- [ ] `bl61x` - BL616 / BL618
|
- [ ] `bl61x` - BL616 / BL618
|
||||||
- [ ] `bl808` - BL808
|
- [ ] `bl808` - BL808
|
||||||
@@ -15,7 +16,7 @@ Open source tool and library for flashing Bouffalo RISC-V MCUs.
|
|||||||
# Supported OS
|
# Supported OS
|
||||||
- [x] Windows
|
- [x] Windows
|
||||||
- [x] Linux
|
- [x] Linux
|
||||||
- [ ] Apple (WIP: work-in-progress)
|
- [x] Apple
|
||||||
|
|
||||||
# Building
|
# 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);
|
blisp_dlog("Received error or not written all data: %d", ret);
|
||||||
return BLISP_ERR_UNKNOWN;
|
return BLISP_ERR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
#ifdef __APPLE__
|
||||||
|
sp_drain(serial_port);
|
||||||
|
#endif
|
||||||
|
|
||||||
return BLISP_OK;
|
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 (!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__
|
||||||
|
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);
|
||||||
@@ -210,6 +217,7 @@ int32_t blisp_device_handshake(struct blisp_device* device, bool in_ef_loader) {
|
|||||||
return BLISP_OK;
|
return BLISP_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
blisp_dlog("Received no response from chip.");
|
blisp_dlog("Received no response from chip.");
|
||||||
return BLISP_ERR_NO_RESPONSE;
|
return BLISP_ERR_NO_RESPONSE;
|
||||||
|
|||||||
+25
-5
@@ -57,17 +57,27 @@ int32_t blisp_easy_load_segment_data(
|
|||||||
struct blisp_easy_transport* segment_transport,
|
struct blisp_easy_transport* segment_transport,
|
||||||
blisp_easy_progress_callback progress_callback) {
|
blisp_easy_progress_callback progress_callback) {
|
||||||
int32_t ret;
|
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 sent_data = 0;
|
||||||
uint32_t buffer_size = 0;
|
uint32_t buffer_size = 0;
|
||||||
|
#ifdef _WIN32
|
||||||
uint8_t buffer[4092];
|
uint8_t buffer[4092];
|
||||||
|
#else
|
||||||
|
uint8_t buffer[buffer_max_size];
|
||||||
|
#endif
|
||||||
|
|
||||||
blisp_easy_report_progress(progress_callback, 0, segment_size);
|
blisp_easy_report_progress(progress_callback, 0, segment_size);
|
||||||
|
|
||||||
while (sent_data < segment_size) {
|
while (sent_data < segment_size) {
|
||||||
buffer_size = segment_size - sent_data;
|
buffer_size = segment_size - sent_data;
|
||||||
if (buffer_size > 4092) {
|
if (buffer_size > buffer_max_size) {
|
||||||
buffer_size = 4092;
|
buffer_size = buffer_max_size;
|
||||||
}
|
}
|
||||||
blisp_easy_transport_read(segment_transport, buffer,
|
blisp_easy_transport_read(segment_transport, buffer,
|
||||||
buffer_size); // TODO: Error Handling
|
buffer_size); // TODO: Error Handling
|
||||||
@@ -319,15 +329,25 @@ 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__
|
||||||
|
const uint16_t buffer_max_size = 372 * 1;
|
||||||
|
#else
|
||||||
|
const uint16_t buffer_max_size = 2052;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t sent_data = 0;
|
uint32_t sent_data = 0;
|
||||||
uint32_t buffer_size = 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);
|
blisp_easy_report_progress(progress_callback, 0, data_size);
|
||||||
|
|
||||||
while (sent_data < data_size) {
|
while (sent_data < data_size) {
|
||||||
buffer_size = data_size - sent_data;
|
buffer_size = data_size - sent_data;
|
||||||
if (buffer_size > 2052) {
|
if (buffer_size > buffer_max_size) {
|
||||||
buffer_size = 2052;
|
buffer_size = buffer_max_size;
|
||||||
}
|
}
|
||||||
blisp_easy_transport_read(data_transport, buffer,
|
blisp_easy_transport_read(data_transport, buffer,
|
||||||
buffer_size); // TODO: Error Handling
|
buffer_size); // TODO: Error Handling
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "../../data/bl60x_eflash_loader.h"
|
#include "../../data/bl60x_eflash_loader.h"
|
||||||
#include "blisp.h"
|
#include "blisp.h"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "../../data/bl70x_eflash_loader.h"
|
#include "../../data/bl70x_eflash_loader.h"
|
||||||
#include "blisp.h"
|
#include "blisp.h"
|
||||||
|
|||||||
@@ -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_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)
|
add_executable(blisp src/main.c src/cmd/write.c src/util.c src/common.c src/cmd/iot.c)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include <argtable3.h>
|
#include <argtable3.h>
|
||||||
#include <blisp.h>
|
#include <blisp.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ int8_t args_parse_exec(int argc, char** argv) {
|
|||||||
print_help();
|
print_help();
|
||||||
return 1;
|
return 1;
|
||||||
} else if (version->count) {
|
} 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");
|
printf("Copyright (C) 2023 Marek Kraus and PINE64 Community\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
// These are not thread safe, but it doesn't place the responsibility
|
// These are not thread safe, but it doesn't place the responsibility
|
||||||
// to free an allocated buffer on the caller.nn
|
// 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) {
|
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.
|
assert(max_size >= PATH_MAX); // n.b. 1024 on MacOS. 4K on most Linux.
|
||||||
|
|
||||||
|
|||||||
@@ -14,10 +14,7 @@ typedef SSIZE_T ssize_t;
|
|||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include <sys/syslimits.h>
|
#include <sys/syslimits.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#endif
|
#include <sys/types.h>
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
#include <linux/limits.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