Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation fixes (errors / warnings) #552

Merged
merged 1 commit into from
Jan 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions include/stlink/tools/flash.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions src/gdbserver/semihosting.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand All @@ -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",
Expand Down Expand Up @@ -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 ) {
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/tools/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/tools/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down