kopia lustrzana https://github.com/stlink-org/stlink
Merge branch 'develop' into testing
commit
fd8d8e6139
|
@ -78,9 +78,6 @@ include(GNUInstallDirs) # Define GNU standard installation directories
|
|||
cmake_host_system_information(RESULT OS_NAME QUERY OS_NAME)
|
||||
message(STATUS "Checking for OS_NAME: ${OS_NAME}")
|
||||
|
||||
message(STATUS "set(CMAKE_INSTALL_SHAREDIR /usr/local/share)")
|
||||
set(CMAKE_INSTALL_SHAREDIR /usr/local/share/)
|
||||
|
||||
|
||||
## Set C build flags
|
||||
if (NOT MSVC)
|
||||
|
@ -385,8 +382,8 @@ endif()
|
|||
if (WIN32)
|
||||
set(CMAKE_CHIPS_DIR ${CMAKE_INSTALL_PREFIX}/config/chips)
|
||||
else ()
|
||||
set(CMAKE_CHIPS_DIR ${CMAKE_INSTALL_SHAREDIR}/${PROJECT_NAME}/chips)
|
||||
endif()
|
||||
set(CMAKE_CHIPS_DIR ${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/chips)
|
||||
endif ()
|
||||
add_definitions( -DSTLINK_CHIPS_DIR="${CMAKE_CHIPS_DIR}" )
|
||||
file(GLOB CHIP_FILES ${CMAKE_SOURCE_DIR}/config/chips/*.chip)
|
||||
install(FILES ${CHIP_FILES} DESTINATION ${CMAKE_CHIPS_DIR})
|
||||
|
|
|
@ -74,7 +74,7 @@ We recommend to install `stlink-tools` from the package repository of the used d
|
|||
|
||||
- Debian Linux: [(Link)](https://github.com/stlink-org/stlink/releases)
|
||||
- Ubuntu Linux: [(Link)](https://github.com/stlink-org/stlink/releases)
|
||||
- Arch Linux: [(Link)](https://www.archlinux.org/packages/community/x86_64/stlink)
|
||||
- Arch Linux: [(Link)](https://archlinux.org/packages/extra/x86_64/stlink/)
|
||||
- Alpine Linux: [(Link)](https://pkgs.alpinelinux.org/packages?name=stlink)
|
||||
- Fedora: [(Link)](https://src.fedoraproject.org/rpms/stlink)
|
||||
- FreeBSD: Users can install from [freshports](https://www.freshports.org/devel/stlink)
|
||||
|
|
|
@ -30,6 +30,11 @@ stm32f0.o: stm32f0.s
|
|||
stm32vl.o: stm32f0.s
|
||||
$(CC) stm32f0.s $(CFLAGS_ARMV7_M) -o stm32vl.o
|
||||
|
||||
# separate rule for STM32Lx.
|
||||
# Built for ARMv6-M target to be compatible with both Cortex M0 and Cortex M3.
|
||||
stm32lx.o: stm32lx.s
|
||||
$(CC) stm32lx.s $(CFLAGS_ARMV6_M) -o stm32lx.o
|
||||
|
||||
# generic rule for all other ARMv7-M
|
||||
%.o: %.s
|
||||
$(CC) $< $(CFLAGS_ARMV7_M) -o $@
|
||||
|
|
|
@ -17,8 +17,8 @@ loop:
|
|||
str r4, [r1]
|
||||
|
||||
# increment address
|
||||
add r0, r0, #4
|
||||
add r1, r1, #4
|
||||
adds r0, r0, #4
|
||||
adds r1, r1, #4
|
||||
|
||||
# loop if count > 0
|
||||
subs r2, r2, #4
|
||||
|
|
|
@ -150,7 +150,7 @@ int32_t parse_options(int32_t argc, char** argv, st_state_t *st) {
|
|||
int32_t c;
|
||||
int32_t q;
|
||||
|
||||
while ((c = getopt_long(argc, argv, "hv::p:mn", long_options, &option_index)) != -1)
|
||||
while ((c = getopt_long(argc, argv, "hv::p:mnu", long_options, &option_index)) != -1)
|
||||
switch (c) {
|
||||
case 0:
|
||||
break;
|
||||
|
|
|
@ -16,19 +16,19 @@ if (NOT WIN32 AND NOT CMAKE_CROSSCOMPILING)
|
|||
|
||||
# Install desktop application entry
|
||||
install(FILES stlink-gui.desktop
|
||||
DESTINATION ${CMAKE_INSTALL_SHAREDIR}/applications)
|
||||
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/applications)
|
||||
|
||||
# Install icons
|
||||
install(FILES icons/stlink-gui.svg
|
||||
DESTINATION ${CMAKE_INSTALL_SHAREDIR}/icons/hicolor/scalable/apps)
|
||||
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/scalable/apps)
|
||||
|
||||
set(GUI_SOURCES gui.c gui.h)
|
||||
|
||||
## stlink-gui
|
||||
add_executable(stlink-gui ${GUI_SOURCES})
|
||||
install(FILES stlink-gui.ui DESTINATION ${CMAKE_INSTALL_SHAREDIR}/${PROJECT_NAME})
|
||||
install(FILES stlink-gui.ui DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME})
|
||||
set_target_properties(stlink-gui PROPERTIES
|
||||
COMPILE_DEFINITIONS STLINK_UI_DIR="${CMAKE_INSTALL_SHAREDIR}/${PROJECT_NAME}")
|
||||
COMPILE_DEFINITIONS STLINK_UI_DIR="${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}")
|
||||
target_link_libraries(stlink-gui ${STLINK_LIB_SHARED} ${SSP_LIB} ${GTK3_LDFLAGS})
|
||||
install(TARGETS stlink-gui DESTINATION ${CMAKE_BINDIR})
|
||||
endif()
|
||||
|
|
|
@ -69,12 +69,12 @@ static const uint8_t loader_code_stm32f0[] = {
|
|||
0x14, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
// flashloaders/stm32lx.s
|
||||
// flashloaders/stm32lx.s -- compiled for armv6-m for compatibility with both
|
||||
// armv6-m cores (STM32L0) and armv7-m cores (STM32L1)
|
||||
static const uint8_t loader_code_stm32lx[] = {
|
||||
0x04, 0x68, 0x0c, 0x60,
|
||||
0x00, 0xf1, 0x04, 0x00,
|
||||
0x01, 0xf1, 0x04, 0x01,
|
||||
0x04, 0x3a, 0xf7, 0xdc,
|
||||
0x04, 0x30, 0x04, 0x31,
|
||||
0x04, 0x3a, 0xf9, 0xdc,
|
||||
0x00, 0xbe, 0x00, 0x00
|
||||
};
|
||||
|
||||
|
@ -429,12 +429,11 @@ int32_t stlink_flash_loader_run(stlink_t *sl, flash_loader_t* fl, stm32_addr_t t
|
|||
#define L1_WRITE_BLOCK_SIZE 0x80
|
||||
#define L0_WRITE_BLOCK_SIZE 0x40
|
||||
|
||||
int32_t stm32l1_write_half_pages(stlink_t *sl, stm32_addr_t addr, uint8_t *base, uint32_t len, uint32_t pagesize) {
|
||||
int32_t stm32l1_write_half_pages(stlink_t *sl, flash_loader_t *fl, stm32_addr_t addr, uint8_t *base, uint32_t len, uint32_t pagesize) {
|
||||
uint32_t count, off;
|
||||
uint32_t num_half_pages = len / pagesize;
|
||||
uint32_t val;
|
||||
uint32_t flash_regs_base = get_stm32l0_flash_base(sl);
|
||||
flash_loader_t fl;
|
||||
bool use_loader = true;
|
||||
int32_t ret = 0;
|
||||
|
||||
|
@ -449,7 +448,7 @@ int32_t stm32l1_write_half_pages(stlink_t *sl, stm32_addr_t addr, uint8_t *base,
|
|||
|
||||
for (count = 0; count < num_half_pages; count++) {
|
||||
if (use_loader) {
|
||||
ret = stlink_flash_loader_run(sl, &fl, addr + count * pagesize, base + count * pagesize, pagesize);
|
||||
ret = stlink_flash_loader_run(sl, fl, addr + count * pagesize, base + count * pagesize, pagesize);
|
||||
if (ret && count == 0) {
|
||||
/* It seems that stm32lx devices have a problem when it is blank */
|
||||
WLOG("Failed to use flash loader, fallback to soft write\n");
|
||||
|
@ -771,7 +770,7 @@ int32_t stlink_flashloader_write(stlink_t *sl, flash_loader_t *fl, stm32_addr_t
|
|||
off = 0;
|
||||
|
||||
if (len > pagesize) {
|
||||
if (stm32l1_write_half_pages(sl, addr, base, len, pagesize)) {
|
||||
if (stm32l1_write_half_pages(sl, fl, addr, base, len, pagesize)) {
|
||||
return (-1);
|
||||
} else {
|
||||
off = (size_t)(len / pagesize) * pagesize;
|
||||
|
|
|
@ -18,7 +18,7 @@ int32_t stlink_flash_loader_run(stlink_t *sl, flash_loader_t* fl, stm32_addr_t t
|
|||
|
||||
/* === Functions from old header file flashloader.h === */
|
||||
|
||||
int32_t stm32l1_write_half_pages(stlink_t *sl, stm32_addr_t addr, uint8_t *base, uint32_t len, uint32_t pagesize);
|
||||
int32_t stm32l1_write_half_pages(stlink_t *sl, flash_loader_t *fl, stm32_addr_t addr, uint8_t *base, uint32_t len, uint32_t pagesize);
|
||||
// static void set_flash_cr_pg(stlink_t *sl, uint32_t bank);
|
||||
// static void set_dma_state(stlink_t *sl, flash_loader_t *fl, int32_t bckpRstr);
|
||||
int32_t stlink_flashloader_start(stlink_t *sl, flash_loader_t *fl);
|
||||
|
|
Ładowanie…
Reference in New Issue