Statistics
| Branch: | Tag: | Revision:

mongoose / examples / nRF51 / http / rtt / Syscalls / RTT_Syscalls_GCC.c @ eaef5bd1

History | View | Annotate | Download (2.4 KB)

1
/* clang-format off */
2
/*********************************************************************
3
*               SEGGER MICROCONTROLLER GmbH & Co KG                  *
4
*       Solutions for real time microcontroller applications         *
5
**********************************************************************
6
*                                                                    *
7
*       (c) 2014  SEGGER Microcontroller GmbH & Co KG                *
8
*                                                                    *
9
*       www.segger.com     Support: support@segger.com               *
10
*                                                                    *
11
**********************************************************************
12

13
----------------------------------------------------------------------
14
File    : RTT_Syscalls.c
15
Purpose : Low-level functions for using printf() via RTT in GCC
16
--------  END-OF-HEADER  ---------------------------------------------
17
*/
18
#include <stdlib.h>
19
#include "SEGGER_RTT.h"
20

    
21
/*********************************************************************
22
 *
23
 *       Function prototypes
24
 *
25
 **********************************************************************
26
 */
27
int _write(int file, char *ptr, int len);
28
int _write_r(struct _reent *r, int file, char *ptr, int len);
29

    
30
/*********************************************************************
31
 *
32
 *       Global functions
33
 *
34
 **********************************************************************
35
 */
36

    
37
/*********************************************************************
38
 *
39
 *       _write()
40
 *
41
 * Function description
42
 *   Low-level write function.
43
 *   libc subroutines will use this system routine for output to all files,
44
 *   including stdout.
45
 *   Write data via RTT.
46
 */
47
int _write(int file, char *ptr, int len) {
48
  (void) file;  /* Not used, avoid warning */
49
  SEGGER_RTT_Write(0, ptr, len);
50
  return len;
51
}
52

    
53
/*********************************************************************
54
 *
55
 *       _write_r()
56
 *
57
 * Function description
58
 *   Low-level reentrant write function.
59
 *   libc subroutines will use this system routine for output to all files,
60
 *   including stdout.
61
 *   Write data via RTT.
62
 */
63
int _write_r(struct _reent *r, int file, char *ptr, int len) {
64
  (void) file;  /* Not used, avoid warning */
65
  (void) r;  /* Not used, avoid warning */
66
  SEGGER_RTT_Write(0, ptr, len);
67
  return len;
68
}