-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Book: section on logging checksum and RCS "ident" strings on upload; …
…trouble-shooting TRACESWO, plus minor edits. BMDebug: "info svd" command for peripheral and register documentation. BMFlash: add log-file option for successful downloads. Clean-up/refactor code of the utilities.
- Loading branch information
1 parent
66be2d5
commit 08a1854
Showing
30 changed files
with
5,623 additions
and
3,653 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* Common functions for bmdebug, bmflash and bmtrace. | ||
* | ||
* Copyright 2021 CompuPhase | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#include <assert.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#if defined WIN32 || defined _WIN32 | ||
#include <direct.h> | ||
#if defined __MINGW32__ || defined __MINGW64__ || defined _MSC_VER | ||
#include "strlcpy.h" | ||
#endif | ||
#elif defined __linux__ | ||
#include <bsd/string.h> | ||
#include <sys/stat.h> | ||
#include <sys/types.h> | ||
#endif | ||
#include "bmcommon.h" | ||
#include "bmp-scan.h" | ||
#include "specialfolder.h" | ||
|
||
#if !defined sizearray | ||
# define sizearray(e) (sizeof(e) / sizeof((e)[0])) | ||
#endif | ||
|
||
const char **get_probelist(int *probe, int *netprobe) | ||
{ | ||
int usbprobes = get_bmp_count(); | ||
assert(netprobe != NULL); | ||
*netprobe = (usbprobes > 0) ? usbprobes : 1; | ||
|
||
const char **probelist = malloc((*netprobe+1)*sizeof(char*)); | ||
if (probelist != NULL) { | ||
if (usbprobes == 0) { | ||
probelist[0] = strdup("-"); | ||
} else { | ||
char portname[64]; | ||
int idx; | ||
for (idx = 0; idx < usbprobes; idx++) { | ||
find_bmp(idx, BMP_IF_GDB, portname, sizearray(portname)); | ||
probelist[idx] = strdup(portname); | ||
} | ||
} | ||
probelist[*netprobe] = strdup("TCP/IP"); | ||
} | ||
|
||
assert(probe != NULL); | ||
if (*probe == 99) | ||
*probe = *netprobe; | ||
else if (*probe > usbprobes) | ||
*probe = 0; | ||
|
||
return probelist; | ||
} | ||
|
||
void clear_probelist(const char **probelist, int netprobe) | ||
{ | ||
if (probelist != NULL) { | ||
int idx; | ||
for (idx = 0; idx < netprobe + 1; idx++) | ||
free((void*)probelist[idx]); | ||
free((void*)probelist); | ||
} | ||
} | ||
|
||
int get_configfile(char *filename, size_t maxsize, const char *basename) | ||
{ | ||
assert(filename != NULL); | ||
assert(maxsize > 0); | ||
*filename = '\0'; | ||
if (!folder_AppConfig(filename, maxsize)) | ||
return 0; | ||
|
||
strlcat(filename, DIR_SEPARATOR "BlackMagic", maxsize); | ||
#if defined _WIN32 | ||
mkdir(filename); | ||
#else | ||
mkdir(filename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); | ||
#endif | ||
strlcat(filename, DIR_SEPARATOR, maxsize); | ||
strlcat(filename, basename, maxsize); | ||
return 1; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Common functions for bmdebug, bmflash and bmtrace. | ||
* | ||
* Copyright 2021 CompuPhase | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#ifndef _BMCOMMON_H | ||
#define _BMCOMMON_H | ||
|
||
const char **get_probelist(int *probe, int *netprobe); | ||
void clear_probelist(const char **probelist, int netprobe); | ||
|
||
int get_configfile(char *filename, size_t maxsize, const char *basename); | ||
|
||
#endif /* _BMCOMMON_H */ |
Oops, something went wrong.