These are the examples provided for [[/users/frank26080115/libraries/LPC1700CMSIS_Lib/]] Note, the entire "program" is not compilable!
Retarget.c
00001 /******************************************************************************/ 00002 /* RETARGET.C: 'Retarget' layer for target-dependent low level functions */ 00003 /******************************************************************************/ 00004 /* This file is part of the uVision/ARM development tools. */ 00005 /* Copyright (c) 2005-2007 Keil Software. All rights reserved. */ 00006 /* This software may only be used under the terms of a valid, current, */ 00007 /* end user licence from KEIL for a compatible version of KEIL software */ 00008 /* development tools. Nothing else gives you the right to use this software. */ 00009 /******************************************************************************/ 00010 00011 #include <stdio.h> 00012 #include <rt_misc.h> 00013 00014 #pragma import(__use_no_semihosting_swi) 00015 00016 // implementation depends on the microcontroller hardware 00017 extern unsigned char sendchar(unsigned char ch); /* in serial.c */ 00018 extern unsigned char getkey(void); 00019 00020 00021 struct __FILE { int handle; /* Add whatever you need here */ }; 00022 FILE __stdout; 00023 FILE __stdin; 00024 00025 int fputc(int ch, FILE *f) { 00026 return (sendchar(ch)); 00027 } 00028 00029 // simplified fgetc version that only redirects STDIN 00030 #if 1 00031 int fgetc(FILE * fp) 00032 { 00033 // redirect STDIN 00034 return(getkey()); 00035 } 00036 #else // echo a char 00037 int fgetc(FILE * fp) 00038 { 00039 return(sendchar(getkey())); 00040 } 00041 #endif 00042 00043 00044 int ferror(FILE *f) { 00045 /* Your implementation of ferror */ 00046 return EOF; 00047 } 00048 00049 00050 void _ttywrch(int ch) { 00051 sendchar(ch); 00052 } 00053 00054 00055 void _sys_exit(int return_code) { 00056 label: goto label; /* endless loop */ 00057 }
Generated on Tue Jul 12 2022 17:28:09 by 1.7.2