Refactoring for cmake build settings

- Moved additional header files to /src
- Simplified header-paths
- Added missing license title for getopt
- Added comments and sections to CMakeLists
- Improved file structure (partially)
- Co-build st-util with st-info & st-flash
- GUI: Renamed .ui file to match executable
- Added install targets for executables
- Added missing "uninstall" cmd to Makefile
pull/947/head
nightwalker-87 2020-04-25 22:34:18 +02:00
rodzic ade7118910
commit f827006231
35 zmienionych plików z 185 dodań i 155 usunięć

Wyświetl plik

@ -95,36 +95,51 @@ else ()
endif ()
###
# Main build process
###
## Define include directories to avoid absolute paths for header defines
include_directories(${LIBUSB_INCLUDE_DIR})
# ====
include_directories(include) ### TODO: Clean this up...
include_directories(${PROJECT_BINARY_DIR}/include/stlink)
include_directories(include/stlink)
include_directories(include/stlink/tools)
# ====
include_directories(src)
set(STLINK_HEADERS
include/stlink.h
include/stlink/usb.h
include/stlink/sg.h
include/stlink/chipid.h
include/stlink/flash_loader.h
)
include/stlink.h
include/stlink/backend.h
include/stlink/chipid.h
include/stlink/commands.h
include/stlink/flash_loader.h
include/stlink/reg.h
src/logging.h
src/md5.h
src/sg.h
src/usb.h
)
set(STLINK_SOURCE
src/chipid.c
src/common.c
src/flash_loader.c
src/logging.c
src/md5.c
src/sg.c
src/usb.c
)
src/common.c
src/chipid.c
src/flash_loader.c
src/logging.c
src/md5.c
src/sg.c
src/usb.c
)
if (WIN32 OR MINGW OR MSYS)
include_directories(src/mingw)
set(STLINK_SOURCE "${STLINK_SOURCE};src/mmap.c;src/mingw/mingw.c")
set(STLINK_HEADERS "${STLINK_HEADERS};src/mingw/mingw.h")
set(STLINK_HEADERS "${STLINK_HEADERS};src/mmap.h;src/mingw/mingw.h")
endif ()
include_directories(${LIBUSB_INCLUDE_DIR})
include_directories(include)
include_directories(${PROJECT_BINARY_DIR}/include)
include_directories(src/mingw)
if (MSVC)
include_directories(src/win32)
include_directories(src/getopt)
@ -132,11 +147,12 @@ if (MSVC)
add_definitions(-DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS /wd4710)
endif ()
# Include test execution for test-targets for target Debug
## Include test execution for test-targets for target Debug
if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
include(CTest)
endif ()
###
# Shared library
###
@ -148,14 +164,15 @@ else (WIN32)
endif ()
add_library(
${STLINK_LIB_SHARED} SHARED
${STLINK_HEADERS} # header files for ide projects generated by cmake
${STLINK_SOURCE}
)
${STLINK_LIB_SHARED} SHARED
${STLINK_HEADERS} # header files for ide projects generated by cmake
${STLINK_SOURCE}
)
target_link_libraries(
${STLINK_LIB_SHARED}
${LIBUSB_LIBRARY}
)
${STLINK_LIB_SHARED}
${LIBUSB_LIBRARY}
)
set(STLINK_SHARED_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
@ -163,7 +180,8 @@ message(STATUS "STLINK_LIB_SHARED: ${STLINK_LIB_SHARED}")
message(STATUS "PROJECT_VERSION_MAJOR: ${PROJECT_VERSION_MAJOR}")
message(STATUS "VERSION: ${STLINK_SHARED_VERSION}")
set_target_properties(${STLINK_LIB_SHARED} PROPERTIES
set_target_properties(
${STLINK_LIB_SHARED} PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
VERSION ${STLINK_SHARED_VERSION}
)
@ -182,7 +200,7 @@ else ()
target_link_libraries(${STLINK_LIB_SHARED} ${LIBUSB_LIBRARY} ${SSP_LIB})
endif ()
install(TARGETS ${STLINK_LIB_SHARED} DESTINATION ${STLINK_LIBRARY_PATH}) ### TODO: Check path
install(TARGETS ${STLINK_LIB_SHARED} DESTINATION ${STLINK_LIBRARY_PATH})
###
@ -197,6 +215,11 @@ add_library(
${STLINK_SOURCE}
)
set_target_properties(
${STLINK_LIB_STATIC} PROPERTIES
OUTPUT_NAME ${PROJECT_NAME}
)
# Link static library with Apple macOS libraries
if (APPLE)
find_library(ObjC objc)
@ -205,32 +228,40 @@ if (APPLE)
target_link_libraries(${STLINK_LIB_STATIC} ${CoreFoundation} ${IOKit} ${ObjC} ${SSP_LIB})
endif ()
if (WIN32 OR MINGW OR MSYS) ### TODO: MinGW OR MSYS on Linux
if (WIN32 OR MINGW OR MSYS)
target_link_libraries(${STLINK_LIB_STATIC} ${LIBUSB_LIBRARY} wsock32 ws2_32 ${SSP_LIB})
else ()
target_link_libraries(${STLINK_LIB_STATIC} ${LIBUSB_LIBRARY} ${SSP_LIB})
endif ()
set_target_properties(${STLINK_LIB_STATIC} PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
if (STLINK_STATIC_LIB)
install(TARGETS ${STLINK_LIB_STATIC} ARCHIVE DESTINATION ${STLINK_LIBRARY_PATH}) ### TODO: Check path
install(TARGETS ${STLINK_LIB_STATIC} ARCHIVE DESTINATION ${STLINK_LIBRARY_PATH})
endif ()
###
# Tools
# Build toolset executables
###
set(ST-UTIL_SOURCES src/st-util/gdb-remote.c src/st-util/gdb-server.c src/st-util/semihosting.c)
if (MSVC)
# Add getopt to sources
set(ST-UTIL_SOURCES "${ST-UTIL_SOURCES};src/getopt/getopt.c")
endif ()
add_executable(st-flash src/tools/flash.c src/tools/flash_opts.c)
add_executable(st-info src/tools/info.c)
add_executable(st-util ${ST-UTIL_SOURCES})
if (WIN32 OR APPLE)
target_link_libraries(st-flash ${STLINK_LIB_STATIC} ${SSP_LIB})
target_link_libraries(st-info ${STLINK_LIB_STATIC} ${SSP_LIB})
target_link_libraries(st-util ${STLINK_LIB_STATIC} ${SSP_LIB})
else ()
target_link_libraries(st-flash ${STLINK_LIB_SHARED} ${SSP_LIB})
target_link_libraries(st-info ${STLINK_LIB_SHARED} ${SSP_LIB})
target_link_libraries(st-util ${STLINK_LIB_SHARED} ${SSP_LIB})
endif ()
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
@ -243,27 +274,24 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
endif ()
endif ()
add_subdirectory(src/gdbserver)
add_subdirectory(src/stlink-gui)
install(TARGETS st-flash DESTINATION bin)
install(TARGETS st-info DESTINATION bin)
install(TARGETS st-util DESTINATION bin)
###
# Others
# Additional build tasks
###
add_subdirectory(include) ### TODO: Check path
add_subdirectory(doc/man)
add_subdirectory(tests)
# ====
add_subdirectory(include) # contains subordinate CMakeLists for version config and old header includes
### TODO: Clean this up ...
# ====
add_subdirectory(src/stlink-gui) # contains subordinate CMakeLists to build GUI
add_subdirectory(tests) # contains subordinate CMakeLists to build test executables
add_subdirectory(doc/man) # contains subordinate CMakeLists to generate manpages
add_subdirectory(cmake/packaging) # contains subordinate CMakeLists to build packages
###
# Package build
###
add_subdirectory(cmake/packaging)
include(cmake/packaging/cpack_config.cmake)
###
# Uninstall target

Wyświetl plik

@ -13,6 +13,7 @@ help:
@echo " debug: Run a debug build"
@echo " release: Run a release build"
@echo " install: Install release build"
@echo " uninstall: Uninstall release build"
@echo " package: Package release build"
@echo " lint: Lint check all source-code"
@echo " test: Build and run tests"
@ -35,6 +36,10 @@ install: build/Release
@echo "[INSTALL] Release"
@$(MAKE) -C build/Release install
uninstall: build/Release
@echo "[UNINSTALL] Release"
@$(MAKE) -C build/Release uninstall
package: build/Release
@echo "[PACKAGE] Release"
@$(MAKE) -C build/Release package

Wyświetl plik

@ -2,3 +2,5 @@ add_subdirectory(debian)
add_subdirectory(fedora)
add_subdirectory(opensuse)
add_subdirectory(windows)
include(cpack_config.cmake)

Wyświetl plik

@ -1,3 +1,7 @@
###
# Generate manpages
###
set(MANPAGES st-util st-flash st-info)
# Only generate manpages with pandoc in Debug builds

Wyświetl plik

@ -2,6 +2,7 @@ configure_file(
"${PROJECT_SOURCE_DIR}/include/stlink/version.h.in"
"${CMAKE_BINARY_DIR}/include/stlink/version.h"
)
file(GLOB STLINK_HEADERS "stlink/*.h" "${CMAKE_BINARY_DIR}/include/stlink/*.h")
install(FILES ${CMAKE_SOURCE_DIR}/include/stlink.h DESTINATION ${STLINK_INCLUDE_PATH})
install(FILES ${CMAKE_SOURCE_DIR}/include/stm32.h DESTINATION ${STLINK_INCLUDE_PATH})

Wyświetl plik

@ -137,7 +137,7 @@ typedef struct flash_loader {
typedef struct _stlink stlink_t;
#include "stlink/backend.h"
#include <backend.h>
struct _stlink {
struct _stlink_backend *backend;
@ -245,14 +245,14 @@ typedef struct flash_loader {
int stlink_write_option_bytes(stlink_t *sl, stm32_addr_t addr, uint8_t* base, uint32_t len);
int stlink_fwrite_option_bytes(stlink_t *sl, const char* path, stm32_addr_t addr);
#include "stlink/sg.h"
#include "stlink/usb.h"
#include "stlink/reg.h"
#include "stlink/commands.h"
#include "stlink/chipid.h"
#include "stlink/flash_loader.h"
#include "stlink/version.h"
#include "../src/logging.h"
#include <sg.h>
#include <usb.h>
#include <reg.h>
#include <commands.h>
#include <chipid.h>
#include <flash_loader.h>
#include <version.h>
#include <logging.h>
#ifdef __cplusplus
}

Wyświetl plik

@ -10,7 +10,7 @@
#include <stdint.h>
#include <stddef.h>
#include "stlink.h"
#include <stlink.h>
#ifdef __cplusplus
extern "C" {

Wyświetl plik

@ -2,6 +2,7 @@
#define STLINK_TOOLS_FLASH_H_
#include <stdint.h>
#include <stlink.h>
#define DEBUG_LOG_LEVEL 100

Wyświetl plik

@ -1,5 +1,5 @@
#include "stlink.h"
#include "stlink/chipid.h"
#include <stlink.h>
#include <chipid.h>
static const struct stlink_chipid_params devices[] = {
{
@ -580,7 +580,6 @@ static const struct stlink_chipid_params devices[] = {
.bootrom_size = 0x7000, // 28K (table 2)
.option_base = STM32_G4_OPTION_BYTES_BASE,
.option_size = 4,
},
{
// STM32G471/473/474/483/484 (from RM0440)
@ -621,8 +620,6 @@ static const struct stlink_chipid_params devices[] = {
.bootrom_base = 0x0,
.bootrom_size = 0x0
},
};
const struct stlink_chipid_params *stlink_chipid_get_params(uint32_t chipid)

Wyświetl plik

@ -11,7 +11,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include "stlink.h"
#include <stlink.h>
#include "mmap.h"
#include "logging.h"
#include "md5.h"

Wyświetl plik

@ -1,9 +1,9 @@
#include "stlink.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stlink.h>
#define FLASH_REGS_BANK2_OFS 0x40
#define FLASH_BANK2_START_ADDR 0x08080000
@ -384,16 +384,16 @@ int stlink_flash_loader_run(stlink_t *sl, flash_loader_t* fl, stm32_addr_t targe
/* run loader */
stlink_run(sl);
// This piece of code used to try to spin for .1 second by waiting
// This piece of code used to try to spin for .1 second by waiting
// doing 10000 rounds of 10 microseconds. But because this usually runs
// on Unix-like OSes, the 10 microseconds get rounded up to the "tick"
// on Unix-like OSes, the 10 microseconds get rounded up to the "tick"
// (actually almost two ticks) of the system. 1 milisecond. Thus, the
// ten thousand attempts, when "something goes wrong" that requires
// the error message "flash loader run error" would wait for something
// like 20 seconds before coming up with the error.
// by increasing the sleep-per-round to the same order-of-magnitude as
// ten thousand attempts, when "something goes wrong" that requires
// the error message "flash loader run error" would wait for something
// like 20 seconds before coming up with the error.
// by increasing the sleep-per-round to the same order-of-magnitude as
// the tick-rounding that the OS uses, the wait until the error message is
// reduced to the same order of magnitude as what was intended. -- REW.
// reduced to the same order of magnitude as what was intended. -- REW.
#define WAIT_ROUNDS 100
/* wait until done (reaches breakpoint) */
for (i = 0; i < WAIT_ROUNDS; i++) {

Wyświetl plik

@ -1,23 +0,0 @@
set(STUTIL_SOURCE
gdb-remote.c
gdb-remote.h
gdb-server.c
gdb-server.h
semihosting.c
semihosting.h
)
if (MSVC)
# We need a getopt from somewhere...
set(STUTIL_SOURCE "${STUTIL_SOURCE};../getopt/getopt.c")
endif ()
add_executable(st-util ${STUTIL_SOURCE})
if (WIN32 OR APPLE)
target_link_libraries(st-util ${STLINK_LIB_STATIC} ${SSP_LIB})
else ()
target_link_libraries(st-util ${STLINK_LIB_SHARED} ${SSP_LIB})
endif ()
install(TARGETS st-util RUNTIME DESTINATION bin)

Wyświetl plik

@ -1,3 +1,5 @@
BSD 3-Clause License
Copyright (c) 2012, Kim Gräsman
All rights reserved.

Wyświetl plik

@ -1,8 +1,8 @@
#include "getopt.h"
#include <stddef.h>
#include <string.h>
#include "getopt.h"
#if !defined(_MSC_VER)
const int no_argument = 0;
const int required_argument = 1;
@ -19,8 +19,8 @@ static char* optcursor = NULL;
/* Implemented based on [1] and [2] for optional arguments.
optopt is handled FreeBSD-style, per [3].
Other GNU and FreeBSD extensions are purely accidental.
Other GNU and FreeBSD extensions are purely accidental.
[1] http://pubs.opengroup.org/onlinepubs/000095399/functions/getopt.html
[2] http://www.kernel.org/doc/man-pages/online/pages/man3/getopt.3.html
[3] http://www.freebsd.org/cgi/man.cgi?query=getopt&sektion=3&manpath=FreeBSD+9.0-RELEASE
@ -37,22 +37,22 @@ int getopt(int argc, char* const argv[], const char* optstring) {
if (optind >= argc)
goto no_more_optchars;
/* If, when getopt() is called argv[optind] is a null pointer, getopt()
/* If, when getopt() is called argv[optind] is a null pointer, getopt()
shall return -1 without changing optind. */
if (argv[optind] == NULL)
goto no_more_optchars;
/* If, when getopt() is called *argv[optind] is not the character '-',
/* If, when getopt() is called *argv[optind] is not the character '-',
getopt() shall return -1 without changing optind. */
if (*argv[optind] != '-')
goto no_more_optchars;
/* If, when getopt() is called argv[optind] points to the string "-",
/* If, when getopt() is called argv[optind] points to the string "-",
getopt() shall return -1 without changing optind. */
if (strcmp(argv[optind], "-") == 0)
goto no_more_optchars;
/* If, when getopt() is called argv[optind] points to the string "--",
/* If, when getopt() is called argv[optind] points to the string "--",
getopt() shall return -1 after incrementing optind. */
if (strcmp(argv[optind], "--") == 0) {
++optind;
@ -64,12 +64,12 @@ int getopt(int argc, char* const argv[], const char* optstring) {
optchar = *optcursor;
/* FreeBSD: The variable optopt saves the last known option character
/* FreeBSD: The variable optopt saves the last known option character
returned by getopt(). */
optopt = optchar;
/* The getopt() function shall return the next option character (if one is
found) from argv that matches a character in optstring, if there is
/* The getopt() function shall return the next option character (if one is
found) from argv that matches a character in optstring, if there is
one that matches. */
optdecl = strchr(optstring, optchar);
if (optdecl) {
@ -79,15 +79,15 @@ int getopt(int argc, char* const argv[], const char* optstring) {
optarg = ++optcursor;
if (*optarg == '\0') {
/* GNU extension: Two colons mean an option takes an
optional arg; if there is text in the current argv-element
(i.e., in the same word as the option name itself, for example,
optional arg; if there is text in the current argv-element
(i.e., in the same word as the option name itself, for example,
"-oarg"), then it is returned in optarg, otherwise optarg is set
to zero. */
if (optdecl[2] != ':') {
/* If the option was the last character in the string pointed to by
an element of argv, then optarg shall contain the next element
of argv, and optind shall be incremented by 2. If the resulting
value of optind is greater than argc, this indicates a missing
value of optind is greater than argc, this indicates a missing
option-argument, and getopt() shall return an error indication.
Otherwise, optarg shall point to the string following the
@ -97,7 +97,7 @@ int getopt(int argc, char* const argv[], const char* optstring) {
if (++optind < argc) {
optarg = argv[optind];
} else {
/* If it detects a missing option-argument, it shall return the
/* If it detects a missing option-argument, it shall return the
colon character ( ':' ) if the first character of optstring
was a colon, or a question-mark character ( '?' ) otherwise.
*/
@ -112,7 +112,7 @@ int getopt(int argc, char* const argv[], const char* optstring) {
optcursor = NULL;
}
} else {
/* If getopt() encounters an option character that is not contained in
/* If getopt() encounters an option character that is not contained in
optstring, it shall return the question-mark ( '?' ) character. */
optchar = '?';
}
@ -131,7 +131,7 @@ no_more_optchars:
[1] http://www.kernel.org/doc/man-pages/online/pages/man3/getopt.3.html
*/
int getopt_long(int argc, char* const argv[], const char* optstring,
int getopt_long(int argc, char* const argv[], const char* optstring,
const struct option* longopts, int* longindex) {
const struct option* o = longopts;
const struct option* match = NULL;
@ -165,7 +165,7 @@ int getopt_long(int argc, char* const argv[], const char* optstring,
if (longindex)
*longindex = (match - longopts);
/* If flag is NULL, then getopt_long() shall return val.
/* If flag is NULL, then getopt_long() shall return val.
Otherwise, getopt_long() returns 0, and flag shall point to a variable
which shall be set to val if the option is found, but left unchanged if
the option is not found. */
@ -190,7 +190,7 @@ int getopt_long(int argc, char* const argv[], const char* optstring,
retval = ':';
}
} else if (strchr(argv[optind], '=')) {
/* An argument was provided to a non-argument option.
/* An argument was provided to a non-argument option.
I haven't seen this specified explicitly, but both GNU and BSD-based
implementations show this behavior.
*/

Wyświetl plik

@ -1,5 +1,5 @@
#ifndef STLINKUSB_H
#define STLINKUSB_H
#ifndef LIBUSB_SETTINGS_H
#define LIBUSB_SETTINGS_H
#include <libusb.h>

Wyświetl plik

@ -15,9 +15,10 @@
// IMPORTS
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "md5.h"
#include <memory.h>
#include "md5.h"
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// INTERNAL FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Wyświetl plik

@ -82,7 +82,7 @@
#include <stdlib.h>
#include <sys/types.h>
#include "stlink.h"
#include <stlink.h>
#include "logging.h"
#define STLINK_OK 0x80

Wyświetl plik

@ -1,5 +1,5 @@
/*
* File: stlink/sg.h
* File: sg.h
* Author: karl
*
* Created on October 1, 2011, 11:29 PM
@ -8,8 +8,8 @@
#ifndef STLINK_SG_H
#define STLINK_SG_H
#include "stlinkusb.h"
#include "stlink.h"
#include "libusb_settings.h"
#include <stlink.h>
#ifdef __cplusplus
extern "C" {
@ -70,4 +70,3 @@ stlink_t* stlink_v1_open(const int verbose, int reset);
#endif
#endif /* STLINK_SG_H */

Wyświetl plik

@ -8,6 +8,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#if defined(__MINGW32__) || defined(_MSC_VER)
#include <mingw.h>
#else
@ -15,6 +16,8 @@
#include <sys/poll.h>
#endif
#include "gdb-remote.h"
static const char hex[] = "0123456789abcdef";
int gdb_send_packet(int fd, char* data) {
@ -169,4 +172,3 @@ int gdb_check_for_interrupt(int fd) {
return 0;
}

Wyświetl plik

@ -14,6 +14,7 @@
#include <stdbool.h>
#define __attribute__(x)
#endif
#if defined(_WIN32)
#include <mingw.h>
#else
@ -24,8 +25,7 @@
#endif
#include <stlink.h>
#include "../logging.h"
#include <logging.h>
#include "gdb-remote.h"
#include "gdb-server.h"
#include "semihosting.h"

Wyświetl plik

@ -5,10 +5,9 @@
#include <stdlib.h>
#include <errno.h>
#include "semihosting.h"
#include <stlink.h>
#include "../logging.h"
#include <logging.h>
#include "semihosting.h"
static int mem_read_u8(stlink_t *sl, uint32_t addr, uint8_t *data)
{

Wyświetl plik

@ -1,35 +1,41 @@
###
# Build GUI
###
## GUI-Building requires the presence of a GTK3 toolset
if (NOT GTK3_FOUND)
message(STATUS "GTK3 not found!")
return() # no GTK3 present => no GUI build
return() # no GTK3 present => no GUI build
else (GTK3_FOUND)
message(STATUS "Found GTK3: -I${GTK3_INCLUDE_DIRS}, ${GTK3_LIBRARIES}")
endif ()
set(GUI_SOURCES gui.c gui.h)
set(INSTALLED_UI_DIR share/stlink) ### TODO: Check Path
include_directories(SYSTEM ${GTK3_INCLUDE_DIRS})
# stlink-gui-local
set(GUI_SOURCES gui.c gui.h)
## stlink-gui-local
add_executable(stlink-gui-local ${GUI_SOURCES})
set_target_properties(
stlink-gui-local PROPERTIES
COMPILE_DEFINITIONS STLINK_UI_DIR="${CMAKE_CURRENT_SOURCE_DIR}" ### TODO: Check Path
COMPILE_DEFINITIONS STLINK_UI_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
# Note: ${CMAKE_CURRENT_SOURCE_DIR} is src/stlink-gui
)
target_link_libraries(stlink-gui-local ${STLINK_LIB_STATIC} ${GTK3_LDFLAGS} ${SSP_LIB})
# stlink-gui
## stlink-gui
add_executable(stlink-gui ${GUI_SOURCES})
set_target_properties(
stlink-gui PROPERTIES
COMPILE_DEFINITIONS STLINK_UI_DIR="${CMAKE_INSTALL_PREFIX}/${INSTALLED_UI_DIR}" ### TODO: Check Path
COMPILE_DEFINITIONS STLINK_UI_DIR="${CMAKE_INSTALL_PREFIX}/bin"
# Note: ${CMAKE_INSTALL_PREFIX} defaults to /usr/local
)
target_link_libraries(stlink-gui ${STLINK_LIB_STATIC} ${GTK3_LDFLAGS} ${SSP_LIB})
install(TARGETS stlink-gui RUNTIME DESTINATION bin) ### TODO: Check Path
install(FILES gui.ui DESTINATION ${INSTALLED_UI_DIR}) ### TODO: Check Path
install(TARGETS stlink-gui DESTINATION bin)
install(FILES stlink-gui.ui DESTINATION bin)
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(FILES stlink-gui.desktop DESTINATION share/applications) # Install desktop entry
install(FILES stlink-gui.desktop DESTINATION share/applications) # Install desktop application entry
install(FILES icons/stlink-gui.svg DESTINATION share/icons/hicolor/scalable/apps) # Install icon
endif ()

Wyświetl plik

@ -779,10 +779,10 @@ static void stlink_gui_build_ui (STlinkGUI *gui) {
GtkBuilder *builder;
GtkListStore *devmem_store;
GtkListStore *filemem_store;
gchar *ui_file = STLINK_UI_DIR "/gui.ui";
gchar *ui_file = STLINK_UI_DIR "/stlink-gui.ui";
if (!g_file_test (ui_file, G_FILE_TEST_EXISTS))
ui_file = "gui.ui";
ui_file = "stlink-gui.ui";
builder = gtk_builder_new ();
if (!gtk_builder_add_from_file (builder, ui_file, NULL)) {
g_printerr ("Failed to load UI file: %s\n", ui_file);

Wyświetl plik

@ -2,7 +2,6 @@
// TODO - this should be done as just a simple flag to the st-util command line...
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@ -10,7 +9,7 @@
#include <sys/types.h>
#include <stlink.h>
#include <stlink/tools/flash.h>
#include <flash.h>
static stlink_t *connected_stlink = NULL;

Wyświetl plik

@ -1,9 +1,9 @@
#include <stlink/tools/flash.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <flash.h>
static bool starts_with(const char * str, const char * prefix) {
size_t n = strlen(prefix);
if (strlen(str) < n) return false;

Wyświetl plik

@ -7,11 +7,13 @@
#include <sys/time.h>
#endif
#include <sys/types.h>
#include <mingw.h>
#include <errno.h>
#include <unistd.h>
#include "stlink.h"
#if defined(__MINGW32__) || defined(_MSC_VER)
#include <mingw.h>
#endif
#include <stlink.h>
enum SCSI_Generic_Direction {SG_DXFER_TO_DEV=0, SG_DXFER_FROM_DEV=0x80};

Wyświetl plik

@ -1,5 +1,5 @@
/*
* File: stlink/usb.h
* File: usb.h
* Author: karl
*
* Created on October 1, 2011, 11:29 PM
@ -10,9 +10,9 @@
#include <stdbool.h>
#include "stlink.h"
#include "stlinkusb.h"
#include "../src/logging.h"
#include <stlink.h>
#include "libusb_settings.h"
#include "logging.h"
#ifdef __cplusplus
extern "C" {

Wyświetl plik

@ -1,3 +1,7 @@
###
# Build test executables
###
set(TESTEXEC usb sg)
foreach (test ${TESTEXEC})

Wyświetl plik

@ -3,7 +3,7 @@
#include <string.h>
#include <stlink.h>
#include <stlink/tools/flash.h>
#include <flash.h>
#if defined(_MSC_VER)
#include <malloc.h>

Wyświetl plik

@ -7,6 +7,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stlink.h>
#if defined(_MSC_VER)

Wyświetl plik

@ -1,4 +1,5 @@
#include <stdio.h>
#include <stlink.h>
int main(int ac, char** av) {
@ -35,7 +36,6 @@ int main(int ac, char** av) {
printf("cpuid:impl_id = %0#x, variant = %#x\n", cpuid.implementer_id, cpuid.variant);
printf("cpuid:part = %#x, rev = %#x\n", cpuid.part, cpuid.revision);
}
printf("-- read_sram\n");
static const uint32_t sram_base = STM32_SRAM_BASE;