File tree Expand file tree Collapse file tree 2 files changed +29
-15
lines changed Expand file tree Collapse file tree 2 files changed +29
-15
lines changed Original file line number Diff line number Diff line change 11/*
2- * File: mem_std.c
3- * Brief: Replace memory management functions of arm standard c library
2+ * File : mem_std.c
3+ * Brief : implement standard memory routins.
44 *
5+ * This file is part of Device File System in RT-Thread RTOS
6+ * COPYRIGHT (C) 2014, RT-Thread Development Team
7+ *
8+ * The license and distribution terms for this file may be
9+ * found in the file LICENSE in this distribution or at
10+ * http://www.rt-thread.org/license/LICENSE.
11+ *
12+ * Change Logs:
13+ * 2014-08-03 bernard Add file header.
514 */
615
716#include "rtthread.h"
817
918/* avoid the heap and heap-using library functions supplied by arm */
1019#pragma import(__use_no_heap)
1120
12- void * malloc (int n )
21+ void * malloc (int n )
1322{
1423 return rt_malloc (n );
1524}
1625
17- void * realloc (void * rmem , rt_size_t newsize )
26+ void * realloc (void * rmem , rt_size_t newsize )
1827{
1928 return rt_realloc (rmem , newsize );
2029}
2130
31+ void * calloc (rt_size_t nelem , rt_size_t elsize )
32+ {
33+ return rt_calloc (nelem , elsize );
34+ }
35+
2236void free (void * rmem )
2337{
2438 rt_free (rmem );
Original file line number Diff line number Diff line change 1313 * Date Author Notes
1414 * 2012-11-23 Yihui The first version
1515 * 2013-11-24 aozima fixed _sys_read()/_sys_write() issues.
16+ * 2014-08-03 bernard If using msh, use system() implementation
17+ * in msh.
1618 */
1719
1820#include <string.h>
@@ -194,9 +196,13 @@ char *_sys_command_string(char *cmd, int len)
194196 return cmd ;
195197}
196198
199+ /* This function writes a character to the console. */
197200void _ttywrch (int ch )
198201{
199- /* TODO */
202+ char c ;
203+
204+ c = (char )ch ;
205+ rt_kprintf (& c );
200206}
201207
202208void _sys_exit (int return_code )
@@ -231,18 +237,12 @@ int remove(const char *filename)
231237#endif
232238}
233239
234- /* rename() is defined in dfs_posix.c instead */
235- #if 0
236- int rename (const char * old , const char * new )
237- {
238- return -1 ;
239- }
240- #endif
241-
240+ #if defined(RT_USING_FINSH ) && defined(FINSH_USING_MSH ) && defined(RT_USING_MODULE ) && defined(RT_USING_DFS )
241+ /* use system implementation in the msh */
242+ #else
242243int system (const char * string )
243244{
244245 RT_ASSERT (0 );
245246 for (;;);
246247}
247-
248-
248+ #endif
You can’t perform that action at this time.
0 commit comments