diff --git a/include/stlink/tools/flash.h b/include/stlink/tools/flash.h index bb7bd739e..6a7b05484 100644 --- a/include/stlink/tools/flash.h +++ b/include/stlink/tools/flash.h @@ -22,9 +22,7 @@ struct flash_opts enum flash_format format; }; - -#define FLASH_OPTS_INITIALIZER {0, } - +#define FLASH_OPTS_INITIALIZER {0, NULL, {}, NULL, 0, 0, 0, 0, 0 } int flash_get_opts(struct flash_opts* o, int ac, char** av); diff --git a/src/common.c b/src/common.c index f104a1629..ccbbbe248 100644 --- a/src/common.c +++ b/src/common.c @@ -2048,7 +2048,7 @@ int stlink_parse_ihex(const char* path, uint8_t erased_pattern, uint8_t * * mem, if(e > end) end = e; } else { - for(size_t i = 0; i < reclen; ++i) { + for(uint8_t i = 0; i < reclen; ++i) { uint8_t b = stlink_parse_hex(line + 9 + i*2); uint32_t addr = lba + offset + i; if(addr >= *begin && addr <= end) { diff --git a/src/gdbserver/semihosting.c b/src/gdbserver/semihosting.c index 4ea6ccf5c..4be8090f5 100644 --- a/src/gdbserver/semihosting.c +++ b/src/gdbserver/semihosting.c @@ -247,7 +247,7 @@ int do_semihosting (stlink_t *sl, uint32_t r0, uint32_t r1, uint32_t *ret) { uint32_t args[3]; uint32_t buffer_address; int fd; - size_t buffer_len; + uint32_t buffer_len; void *buffer; if (mem_read(sl, r1, args, sizeof (args)) != 0 ) { @@ -259,7 +259,7 @@ int do_semihosting (stlink_t *sl, uint32_t r0, uint32_t r1, uint32_t *ret) { fd = (int)args[0]; buffer_address = args[1]; - buffer_len = (size_t)args[2]; + buffer_len = args[2]; if (buffer_len > MAX_BUFFER_SIZE) { DLOG("Semihosting SYS_WRITE error: buffer size is too big %d\n", @@ -305,7 +305,7 @@ int do_semihosting (stlink_t *sl, uint32_t r0, uint32_t r1, uint32_t *ret) { uint32_t args[3]; uint32_t buffer_address; int fd; - size_t buffer_len; + uint32_t buffer_len; void *buffer; if (mem_read(sl, r1, args, sizeof (args)) != 0 ) { @@ -317,7 +317,7 @@ int do_semihosting (stlink_t *sl, uint32_t r0, uint32_t r1, uint32_t *ret) { fd = (int)args[0]; buffer_address = args[1]; - buffer_len = (size_t)args[2]; + buffer_len = args[2]; if (buffer_len > MAX_BUFFER_SIZE) { DLOG("Semihosting SYS_READ error: buffer size is too big %d\n", diff --git a/src/tools/flash.c b/src/tools/flash.c index 1b6c7a7da..f2c186e95 100644 --- a/src/tools/flash.c +++ b/src/tools/flash.c @@ -135,7 +135,7 @@ int main(int ac, char** av) if ((o.addr >= sl->flash_base) && (o.addr < sl->flash_base + sl->flash_size)) { if(o.format == FLASH_FORMAT_IHEX) - err = stlink_mwrite_flash(sl, mem, size, o.addr); + err = stlink_mwrite_flash(sl, mem, (uint32_t)size, o.addr); else err = stlink_fwrite_flash(sl, o.filename, o.addr); if (err == -1) @@ -147,7 +147,7 @@ int main(int ac, char** av) else if ((o.addr >= sl->sram_base) && (o.addr < sl->sram_base + sl->sram_size)) { if(o.format == FLASH_FORMAT_IHEX) - err = stlink_mwrite_sram(sl, mem, size, o.addr); + err = stlink_mwrite_sram(sl, mem, (uint32_t)size, o.addr); else err = stlink_fwrite_sram(sl, o.filename, o.addr); if (err == -1) diff --git a/src/tools/gui/CMakeLists.txt b/src/tools/gui/CMakeLists.txt index e217af03a..53d1d862d 100644 --- a/src/tools/gui/CMakeLists.txt +++ b/src/tools/gui/CMakeLists.txt @@ -10,13 +10,13 @@ include_directories(SYSTEM ${gtk_INCLUDE_DIRS}) add_executable(stlink-gui-local ${GUI_SOURCES}) set_target_properties(stlink-gui-local PROPERTIES COMPILE_FLAGS -DSTLINK_UI_DIR=\\"${CMAKE_CURRENT_SOURCE_DIR}/gui\\") -target_link_libraries(stlink-gui-local stlink ${gtk_LDFLAGS}) +target_link_libraries(stlink-gui-local ${STLINK_LIB_STATIC} ${gtk_LDFLAGS}) add_executable(stlink-gui ${GUI_SOURCES}) set_target_properties(stlink-gui PROPERTIES COMPILE_FLAGS -DSTLINK_UI_DIR=\\"${CMAKE_INSTALL_PREFIX}/${INSTALLED_UI_DIR}\\") -target_link_libraries(stlink-gui stlink ${gtk_LDFLAGS}) +target_link_libraries(stlink-gui ${STLINK_LIB_STATIC} ${gtk_LDFLAGS}) install(TARGETS stlink-gui RUNTIME DESTINATION bin) diff --git a/tests/flash.c b/tests/flash.c index 27fd437f6..fd55fdfc1 100644 --- a/tests/flash.c +++ b/tests/flash.c @@ -59,7 +59,7 @@ static bool execute_test(const struct Test * test) { return ret; } -struct Test tests[] = { +static struct Test tests[] = { { "", -1, FLASH_OPTS_INITIALIZER }, { "--debug --reset read /dev/sg0 test.bin 0x80000000 0x1000", 0, { .cmd = FLASH_CMD_READ, .devname = "/dev/sg0", .serial = {}, .filename = "test.bin",