84 lines
2.4 KiB
C
84 lines
2.4 KiB
C
/*
|
|
*-----------------------------------------------------------------------------
|
|
* The confidential and proprietary information contained in this file may
|
|
* only be used by a person authorised under and to the extent permitted
|
|
* by a subsisting licensing agreement from Arm Limited or its affiliates.
|
|
*
|
|
* (C) COPYRIGHT 2010-2013 Arm Limited or its affiliates.
|
|
* ALL RIGHTS RESERVED
|
|
*
|
|
* This entire notice must be reproduced on all copies of this file
|
|
* and copies of this file may only be made by a person if such person is
|
|
* permitted to do so under the terms of a subsisting license agreement
|
|
* from Arm Limited or its affiliates.
|
|
*
|
|
* SVN Information
|
|
*
|
|
* Checked In : $Date: 2017-10-10 15:55:38 +0100 (Tue, 10 Oct 2017) $
|
|
*
|
|
* Revision : $Revision: 371321 $
|
|
*
|
|
* Release Information : Cortex-M System Design Kit-r1p1-00rel0
|
|
*-----------------------------------------------------------------------------
|
|
*/
|
|
|
|
|
|
#if defined ( __CC_ARM )
|
|
/******************************************************************************/
|
|
/* Retarget functions for ARM DS-5 Professional / Keil MDK */
|
|
/******************************************************************************/
|
|
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
#include <rt_misc.h>
|
|
#include "CMSDK_CM0.h"
|
|
#pragma import(__use_no_semihosting_swi)
|
|
|
|
//extern unsigned char UartGetc(void);
|
|
extern unsigned char UartPutc(CMSDK_UART_TypeDef *CMSDK_UART ,unsigned char my_ch);
|
|
struct __FILE { int handle; /* Add whatever you need here */ };
|
|
FILE __stdout;
|
|
FILE __stdin;
|
|
|
|
|
|
int fputc(int ch, FILE *f) {
|
|
return (UartPutc(CMSDK_UART1 ,ch));
|
|
}
|
|
|
|
|
|
int ferror(FILE *f) {
|
|
/* Your implementation of ferror */
|
|
return EOF;
|
|
}
|
|
|
|
void _ttywrch(int ch) {
|
|
UartPutc (CMSDK_UART1 ,ch);
|
|
}
|
|
|
|
|
|
void _sys_exit(int return_code) {
|
|
label: goto label; /* endless loop */
|
|
}
|
|
|
|
#else
|
|
|
|
/******************************************************************************/
|
|
/* Retarget functions for GNU Tools for ARM Embedded Processors */
|
|
/******************************************************************************/
|
|
#include <stdio.h>
|
|
#include <sys/stat.h>
|
|
|
|
extern unsigned char UartPutc(unsigned char my_ch);
|
|
|
|
__attribute__ ((used)) int _write (int fd, char *ptr, int len)
|
|
{
|
|
size_t i;
|
|
for (i=0; i<len;i++) {
|
|
UartPutc(ptr[i]); // call character output function
|
|
}
|
|
return len;
|
|
}
|
|
|
|
|
|
#endif
|