Compare commits

...

4 Commits

Author SHA1 Message Date
Pavel Zakopaylo
7f2f48eff7
Merge 67bd1bd46814d56b3774b36fed6a300c2027ad71 into e45941c45e2418b2bb7e3dab49468a8f4d132439 2025-03-29 23:35:32 +00:00
Ben V. Brown
e45941c45e
Merge pull request #74 from ia/makefile
Makefile: add file with basic targets
2025-03-04 21:25:11 +11:00
Ivan Zorin
0d997dfb1e Makefile: add file with basic targets 2025-02-04 23:13:26 +03:00
Pavel Zakopaylo
67bd1bd468
Minor fix: blisp_device_flash_erase errors were ignored 2023-11-30 19:57:47 +11:00
2 changed files with 38 additions and 3 deletions

35
Makefile Normal file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env make -f
### global variables section
# static vars
BUILD_DIR:="build"
BUILD_BIN:="$(BUILD_DIR)/tools/blisp/blisp"
# dynamic vars
FILES_CMAKE:=$(shell find . -path ./$(BUILD_DIR) -prune -false -o -type f -name '*.cmake' -o -type f -name 'CMakeLists.txt')
FILES_SRC:=$(shell find . -path ./$(BUILD_DIR) -prune -false -o -type f -name '*.c' -o -type f -name '*.h')
### main targets section
# simplify build
build: $(FILES_CMAKE) $(FILES_SRC) Makefile
@echo "\n>>>> Generating build files in: $(BUILD_DIR) ...\n"
@cmake -S . -B $(BUILD_DIR) -DBLISP_BUILD_CLI=ON
@echo "\n>>>> Building...\n"
@cmake --build $(BUILD_DIR)
@echo "\n>>>> DONE: $(BUILD_BIN)\n"
# deleting output build directory with its content
clean:
-@rm -rf $(BUILD_DIR)/
# printf-like debug target
vars:
@echo "\n>>>> FILES_CMAKE:"
@echo "$(FILES_CMAKE)" | sed 's, ,\n,g'
@echo "\n>>>> FILES_SRC:"
@echo "$(FILES_SRC)" | sed 's, ,\n,g'
.PHONY: clean vars

View File

@ -360,13 +360,13 @@ blisp_return_t blisp_device_flash_erase(struct blisp_device* device,
*(uint32_t*)(payload + 4) = end_address;
blisp_return_t ret = blisp_send_command(device, 0x30, payload, 8, true);
if (ret < 0)
if (ret != BLISP_OK)
return ret;
do {
ret = blisp_receive_response(device, false);
} while (ret == BLISP_ERR_PENDING);
return 0;
return ret;
}
blisp_return_t blisp_device_flash_write(struct blisp_device* device,
@ -414,4 +414,4 @@ blisp_return_t blisp_device_reset(struct blisp_device* device) {
void blisp_device_close(struct blisp_device* device) {
struct sp_port* serial_port = device->serial_port;
sp_close(serial_port);
}
}