]> git.gag.com Git - fw/openocd/blob - contrib/libdcc/example.c
jtag: drivers: stlink: handle all versions with single config
[fw/openocd] / contrib / libdcc / example.c
1 /***************************************************************************
2  *   Copyright (C) 2008 by Spencer Oliver                                  *
3  *   spen@spen-soft.co.uk                                                  *
4  *   Copyright (C) 2008 by Frederik Kriewtz                                *
5  *   frederik@kriewitz.eu                                                  *
6  *                                                                         *
7  *   This program is free software; you can redistribute it and/or modify  *
8  *   it under the terms of the GNU General Public License as published by  *
9  *   the Free Software Foundation; either version 2 of the License, or     *
10  *   (at your option) any later version.                                   *
11  *                                                                         *
12  *   This program is distributed in the hope that it will be useful,       *
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
15  *   GNU General Public License for more details.                          *
16  *                                                                         *
17  *   You should have received a copy of the GNU General Public License     *
18  *   along with this program; if not, write to the                         *
19  *   Free Software Foundation, Inc.,                                       *
20  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.           *
21  ***************************************************************************/
22
23 #include "dcc_stdio.h"
24
25 /* enable openocd debugmsg at the gdb prompt:
26  * monitor target_request debugmsgs enable
27  *
28  * create a trace point:
29  * monitor trace point 1
30  *
31  * to show how often the trace point was hit:
32  * monitor trace point
33 */
34
35 int main(void)
36 {
37         dbg_write_str("hello world");
38
39         dbg_write_char('t');
40         dbg_write_char('e');
41         dbg_write_char('s');
42         dbg_write_char('t');
43         dbg_write_char('\n');
44
45         unsigned long test_u32 = 0x01234567;
46         dbg_write_u32(&test_u32, 1);
47
48         static const unsigned short test_u16[] = {0x0123, 0x4567, 0x89AB, 0xCDEF, 0x0123, 0x4567, 0x89AB, 0xCDEF};
49         dbg_write_u16(test_u16, 8);
50
51         static const unsigned char test_u8[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0XDD, 0xEE, 0xFF};
52         dbg_write_u8(test_u8, 16);
53
54         while(1)
55         {
56                 dbg_trace_point(0);
57         }
58 }