File: main.c

package info (click to toggle)
stlink 1.5.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 928 kB
  • sloc: ansic: 8,725; asm: 188; sh: 47; makefile: 43
file content (29 lines) | stat: -rw-r--r-- 517 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>
#include <stdlib.h>
#include <stlink.h>

static stlink_t *stlink_open_first(void)
{
    stlink_t* sl = NULL;
    sl = stlink_v1_open(0, 1);
    if (sl == NULL)
        sl = stlink_open_usb(0, 1, NULL);

    return sl;
}


int main()
{
    stlink_t* sl = NULL;
    sl = stlink_open_first();

    if (sl == NULL) {
        fprintf(stderr, "Failed to open stlink device ;(\n");
        exit(1);
    }

    fprintf(stderr, "STlink device opened, that's cool!\n");
    stlink_close(sl);
    return 0;
}