projects
/
fw
/
stlink
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
a1e4a6d
)
st-term magic byte via commandline argument
author
Rene Hopf
<renehopf@mac.com>
Wed, 11 Dec 2013 19:31:37 +0000
(20:31 +0100)
committer
Rene Hopf
<renehopf@mac.com>
Wed, 11 Dec 2013 19:31:37 +0000
(20:31 +0100)
.gitignore
patch
|
blob
|
history
src/st-term.c
patch
|
blob
|
history
diff --git
a/.gitignore
b/.gitignore
index d7df95e8160b57f7cc2e29b9c3e574ff8aaf7f52..09025703733b2850b0ba91acde3d6789864ee737 100644
(file)
--- a/
.gitignore
+++ b/
.gitignore
@@
-21,6
+21,7
@@
compile
st-flash
st-util
st-term
st-flash
st-util
st-term
+st-info
test_usb
test_sg
*.deps*
test_usb
test_sg
*.deps*
diff --git
a/src/st-term.c
b/src/st-term.c
index a6a97fc1c4e6988fc2970c0c651c3262c3e91c3b..4f2f9f77cf6722f450502db38b4ca4785ea62f9b 100644
(file)
--- a/
src/st-term.c
+++ b/
src/st-term.c
@@
-39,7
+39,7
@@
struct stlinky* stlinky_detect(stlink_t* sl)
if (STLINKY_MAGIC == READ_UINT32_LE(sl->q_buf))
{
if (multiple > 0)
if (STLINKY_MAGIC == READ_UINT32_LE(sl->q_buf))
{
if (multiple > 0)
-
printf("WARNING: another ");
+ printf("WARNING: another ");
printf("stlinky detected at 0x%x\n", sram_base + off);
st->off = sram_base + off;
stlink_read_mem32(sl, st->off + 4, 4);
printf("stlinky detected at 0x%x\n", sram_base + off);
st->off = sram_base + off;
stlink_read_mem32(sl, st->off + 4, 4);
@@
-148,10
+148,8
@@
void cleanup(int dummy)
int main(int ac, char** av) {
stlink_t* sl;
int main(int ac, char** av) {
stlink_t* sl;
-
- /* unused */
- ac = ac;
- av = av;
+ struct stlinky *st;
+
sl = stlink_open_usb(10, 1);
if (sl != NULL) {
printf("ST-Linky proof-of-concept terminal :: Created by Necromant for lulz\n");
sl = stlink_open_usb(10, 1);
if (sl != NULL) {
printf("ST-Linky proof-of-concept terminal :: Created by Necromant for lulz\n");
@@
-174,7
+172,19
@@
int main(int ac, char** av) {
/* TODO: Make timeout adjustable via command line */
sleep(1);
/* TODO: Make timeout adjustable via command line */
sleep(1);
- struct stlinky *st = stlinky_detect(sl);
+ if(ac == 1){
+ st = stlinky_detect(sl);
+ }else if(ac == 2){
+ st = malloc(sizeof(struct stlinky));
+ st->sl = sl;
+ st->off = (int)strtol(av[1], NULL, 16);
+ printf("using stlinky at 0x%x\n", st->off);
+ stlink_read_mem32(sl, st->off + 4, 4);
+ st->bufsize = (size_t) *(unsigned char*) sl->q_buf;
+ printf("stlinky buffer size 0x%zu \n", st->bufsize);
+ }else{
+ goto bailout;
+ }
if (st == NULL)
{
printf("stlinky magic not found in sram :(\n");
if (st == NULL)
{
printf("stlinky magic not found in sram :(\n");