Compare commits

...

6 Commits

Author SHA1 Message Date
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
6 changed files with 106 additions and 10 deletions

66
.github/workflows/build.yml vendored Normal file
View 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

View File

@ -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)

View File

@ -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

View File

@ -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;

View File

@ -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

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 v0.0.2\n");
printf("blisp v0.0.3\n");
printf("Copyright (C) 2023 Marek Kraus and PINE64 Community\n");
return 1;
}