1 | /********************************************************************* |
---|
2 | * SEGGER Microcontroller GmbH * |
---|
3 | * The Embedded Experts * |
---|
4 | ********************************************************************** |
---|
5 | * * |
---|
6 | * (c) 2014 - 2019 SEGGER Microcontroller GmbH * |
---|
7 | * * |
---|
8 | * www.segger.com Support: support@segger.com * |
---|
9 | * * |
---|
10 | ********************************************************************** |
---|
11 | * * |
---|
12 | * All rights reserved. * |
---|
13 | * * |
---|
14 | * Redistribution and use in source and binary forms, with or * |
---|
15 | * without modification, are permitted provided that the following * |
---|
16 | * conditions are met: * |
---|
17 | * * |
---|
18 | * - Redistributions of source code must retain the above copyright * |
---|
19 | * notice, this list of conditions and the following disclaimer. * |
---|
20 | * * |
---|
21 | * - Neither the name of SEGGER Microcontroller GmbH * |
---|
22 | * nor the names of its contributors may be used to endorse or * |
---|
23 | * promote products derived from this software without specific * |
---|
24 | * prior written permission. * |
---|
25 | * * |
---|
26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * |
---|
27 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * |
---|
28 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * |
---|
29 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
---|
30 | * DISCLAIMED. * |
---|
31 | * IN NO EVENT SHALL SEGGER Microcontroller GmbH BE LIABLE FOR * |
---|
32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * |
---|
33 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * |
---|
34 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * |
---|
35 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * |
---|
36 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
---|
37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * |
---|
38 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * |
---|
39 | * DAMAGE. * |
---|
40 | * * |
---|
41 | ********************************************************************** |
---|
42 | * * |
---|
43 | * RTT version: 5.12e * |
---|
44 | * * |
---|
45 | ********************************************************************** |
---|
46 | -------- END-OF-HEADER --------------------------------------------- |
---|
47 | File : SEGGER_RTT_Syscalls_IAR.c |
---|
48 | Purpose : Low-level functions for using printf() via RTT in IAR. |
---|
49 | To use RTT for printf output, include this file in your |
---|
50 | application and set the Library Configuration to Normal. |
---|
51 | ---------------------------------------------------------------------- |
---|
52 | */ |
---|
53 | #include <yfuns.h> |
---|
54 | #include "SEGGER_RTT.h" |
---|
55 | #pragma module_name = "?__write" |
---|
56 | |
---|
57 | /********************************************************************* |
---|
58 | * |
---|
59 | * Function prototypes |
---|
60 | * |
---|
61 | ********************************************************************** |
---|
62 | */ |
---|
63 | size_t __write(int handle, const unsigned char * buffer, size_t size); |
---|
64 | |
---|
65 | /********************************************************************* |
---|
66 | * |
---|
67 | * Global functions |
---|
68 | * |
---|
69 | ********************************************************************** |
---|
70 | */ |
---|
71 | /********************************************************************* |
---|
72 | * |
---|
73 | * __write() |
---|
74 | * |
---|
75 | * Function description |
---|
76 | * Low-level write function. |
---|
77 | * Standard library subroutines will use this system routine |
---|
78 | * for output to all files, including stdout. |
---|
79 | * Write data via RTT. |
---|
80 | */ |
---|
81 | size_t __write(int handle, const unsigned char * buffer, size_t size) { |
---|
82 | (void) handle; /* Not used, avoid warning */ |
---|
83 | SEGGER_RTT_Write(0, (const char*)buffer, size); |
---|
84 | return size; |
---|
85 | } |
---|
86 | |
---|
87 | /********************************************************************* |
---|
88 | * |
---|
89 | * __write_buffered() |
---|
90 | * |
---|
91 | * Function description |
---|
92 | * Low-level write function. |
---|
93 | * Standard library subroutines will use this system routine |
---|
94 | * for output to all files, including stdout. |
---|
95 | * Write data via RTT. |
---|
96 | */ |
---|
97 | size_t __write_buffered(int handle, const unsigned char * buffer, size_t size) { |
---|
98 | (void) handle; /* Not used, avoid warning */ |
---|
99 | SEGGER_RTT_Write(0, (const char*)buffer, size); |
---|
100 | return size; |
---|
101 | } |
---|
102 | /****** End Of File *************************************************/ |
---|