kopia lustrzana https://github.com/stlink-org/stlink
Merge branch 'master' of github.com:texane/stlink
commit
88c6162e45
|
@ -7,7 +7,6 @@ Open source version of the STMicroelectronics Stlink Tools
|
|||
[![Downloads](https://img.shields.io/github/downloads/texane/stlink/total.svg)](https://github.com/texane/stlink/releases)
|
||||
[![Linux Status](https://img.shields.io/travis/texane/stlink/master.svg?label=linux)](https://travis-ci.org/texane/stlink)
|
||||
[![Build Status](https://jenkins.ncrmnt.org/buildStatus/icon?job=GithubCI/stlink)](https://jenkins.ncrmnt.org/job/GithubCI/job/stlink/)
|
||||
[![Build status](https://ci.appveyor.com/api/projects/status/wrcie05d4jmut0te?svg=true)](https://ci.appveyor.com/project/xor-gate/stlink)
|
||||
|
||||
## HOWTO
|
||||
|
||||
|
@ -25,8 +24,9 @@ Two different transport layers are used:
|
|||
|
||||
## Installation
|
||||
|
||||
Currently there are no binaries for Windows available (see issue [#166](https://github.com/texane/stlink/issues/166)).
|
||||
It is known to compile and work with MinGW(64)/Cygwin environment. Building with Visual Studio is not supported because the project uses POSIX APIs and probably will never change.
|
||||
Windows users can [download v1.3.0](https://github.com/texane/stlink/releases/tag/1.3.0) from the releases page.
|
||||
|
||||
Mac OS X users can install from [homebrew](http://brewformulas.org/Stlink) or [download v1.3.0](https://github.com/texane/stlink/releases/tag/1.3.0) from the releases page.
|
||||
|
||||
For Debian Linux based distributions there is no package available
|
||||
in the standard repositories so you need to install [from source](doc/compiling.md) yourself.
|
||||
|
@ -37,8 +37,6 @@ Alpine Linux users can install from the [repository](https://pkgs.alpinelinux.or
|
|||
|
||||
FreeBSD users can install from [freshports](https://www.freshports.org/devel/stlink)
|
||||
|
||||
Mac OS X users can install from [homebrew](http://brewformulas.org/Stlink)
|
||||
|
||||
OpenBSD users need to install [from source](doc/compiling.md).
|
||||
|
||||
## Installation from source (advanced users)
|
||||
|
|
|
@ -55,7 +55,8 @@ enum stlink_stm32_chipids {
|
|||
STLINK_CHIPID_STM32_F0_CAN = 0x448,
|
||||
STLINK_CHIPID_STM32_F7 = 0x449,
|
||||
STLINK_CHIPID_STM32_F7XXXX = 0x451,
|
||||
STLINK_CHIPID_STM32_F410 = 0x458
|
||||
STLINK_CHIPID_STM32_F410 = 0x458,
|
||||
STLINK_CHIPID_STM32_F413 = 0x463
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
12
src/chipid.c
12
src/chipid.c
|
@ -298,6 +298,18 @@ static const struct stlink_chipid_params devices[] = {
|
|||
.bootrom_base = 0x1FFF0000, // "System memory" starting address from Table 4
|
||||
.bootrom_size = 0x7800 // "System memory" byte size in hex from Table 4
|
||||
},
|
||||
{
|
||||
// RM0430 DocID029473 Rev 2 document was used to find these parameters
|
||||
// Figure 2, Table 4, Table 5, Section 35.2
|
||||
.chip_id = STLINK_CHIPID_STM32_F413,
|
||||
.description = "F4 device",
|
||||
.flash_type = STLINK_FLASH_TYPE_F4,
|
||||
.flash_size_reg = 0x1FFF7A22, // "Flash size data register" Section 35.2
|
||||
.flash_pagesize = 0x4000, // Table 5. Flash module organization (variable sector sizes, but 0x4000 is smallest)
|
||||
.sram_size = 0x50000, // "SRAM" byte size in hex from Figure 2 (Table 4 only says 0x40000)
|
||||
.bootrom_base = 0x1FFF0000, // "System memory" starting address from Table 4
|
||||
.bootrom_size = 0x7800 // "System memory" byte size in hex from Table 4
|
||||
},
|
||||
{
|
||||
.chip_id = STLINK_CHIPID_STM32_F09X,
|
||||
.description = "F09X device",
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -219,6 +219,7 @@ int stlink_flash_loader_write_to_sram(stlink_t *sl, stm32_addr_t* addr, size_t*
|
|||
sl->chip_id == STLINK_CHIPID_STM32_F410 ||
|
||||
sl->chip_id == STLINK_CHIPID_STM32_F411RE ||
|
||||
sl->chip_id == STLINK_CHIPID_STM32_F412 ||
|
||||
sl->chip_id == STLINK_CHIPID_STM32_F413 ||
|
||||
sl->chip_id == STLINK_CHIPID_STM32_F446
|
||||
) {
|
||||
if( sl->version.stlink_v == 1 ) {
|
||||
|
|
|
@ -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",
|
||||
|
@ -457,6 +457,12 @@ int do_semihosting (stlink_t *sl, uint32_t r0, uint32_t r1, uint32_t *ret) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case SYS_READC:
|
||||
{
|
||||
uint8_t c = getchar();
|
||||
*ret = c;
|
||||
break;
|
||||
}
|
||||
case SYS_WRITE0:
|
||||
{
|
||||
uint8_t buf[WRITE0_BUFFER_SIZE];
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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",
|
||||
|
|
Ładowanie…
Reference in New Issue