RTT_Syscalls_IAR.c 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*********************************************************************
  2. * SEGGER MICROCONTROLLER GmbH & Co. KG *
  3. * Solutions for real time microcontroller applications *
  4. **********************************************************************
  5. * *
  6. * (c) 2014 - 2015 SEGGER Microcontroller GmbH & Co. KG *
  7. * *
  8. * www.segger.com Support: support@segger.com *
  9. * *
  10. **********************************************************************
  11. * *
  12. * All rights reserved. *
  13. * *
  14. * * This software may in its unmodified form be freely redistributed *
  15. * in source form. *
  16. * * The source code may be modified, provided the source code *
  17. * retains the above copyright notice, this list of conditions and *
  18. * the following disclaimer. *
  19. * * Modified versions of this software in source or linkable form *
  20. * may not be distributed without prior consent of SEGGER. *
  21. * * This software may only be used for communication with SEGGER *
  22. * J-Link debug probes. *
  23. * *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
  25. * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
  26. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
  27. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
  28. * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
  29. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
  30. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
  31. * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
  32. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
  33. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
  34. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
  35. * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
  36. * DAMAGE. *
  37. * *
  38. **********************************************************************
  39. -------- END-OF-HEADER ---------------------------------------------
  40. File : SEGGER_RTT_Syscalls_IAR.c
  41. Purpose : Low-level functions for using printf() via RTT in IAR.
  42. To use RTT for printf output, include this file in your
  43. application and set the Library Configuration to Normal.
  44. ----------------------------------------------------------------------
  45. */
  46. #if defined(NRF_LOG_USES_RTT) && NRF_LOG_USES_RTT == 1
  47. #include <yfuns.h>
  48. #include "SEGGER_RTT.h"
  49. #pragma module_name = "?__write"
  50. /*********************************************************************
  51. *
  52. * Function prototypes
  53. *
  54. **********************************************************************
  55. */
  56. size_t __write(int handle, const unsigned char * buffer, size_t size);
  57. /*********************************************************************
  58. *
  59. * Global functions
  60. *
  61. **********************************************************************
  62. */
  63. /*********************************************************************
  64. *
  65. * __write()
  66. *
  67. * Function description
  68. * Low-level write function.
  69. * Standard library subroutines will use this system routine
  70. * for output to all files, including stdout.
  71. * Write data via RTT.
  72. */
  73. size_t __write(int handle, const unsigned char * buffer, size_t size) {
  74. (void) handle; /* Not used, avoid warning */
  75. SEGGER_RTT_Write(0, (const char*)buffer, size);
  76. return size;
  77. }
  78. /*********************************************************************
  79. *
  80. * __write_buffered()
  81. *
  82. * Function description
  83. * Low-level write function.
  84. * Standard library subroutines will use this system routine
  85. * for output to all files, including stdout.
  86. * Write data via RTT.
  87. */
  88. size_t __write_buffered(int handle, const unsigned char * buffer, size_t size) {
  89. (void) handle; /* Not used, avoid warning */
  90. SEGGER_RTT_Write(0, (const char*)buffer, size);
  91. return size;
  92. }
  93. #endif /*NRF_LOG_USES_RTT==1*/
  94. /****** End Of File *************************************************/