Selaa lähdekoodia

!194 [lwIP] fix ESHUTDOWN definition issue
Merge pull request !194 from bernard/bernard_rt-smart

bernard 4 vuotta sitten
vanhempi
commit
80158989ce

+ 1 - 1
components/libc/Kconfig

@@ -7,7 +7,7 @@ config RT_USING_LIBC
 if RT_USING_LIBC && RT_USING_LWP
 if RT_USING_LIBC && RT_USING_LWP
     choice
     choice
         prompt "Select c standard library"
         prompt "Select c standard library"
-        default RT_USING_NEWLIB
+        default RT_USING_MUSL
         help
         help
             Select c standard library
             Select c standard library
 
 

+ 47 - 9
components/libc/compilers/musl/libc.c

@@ -15,15 +15,14 @@
 
 
 #include "libc.h"
 #include "libc.h"
 
 
-#ifdef RT_USING_PTHREADS
-#include <pthread.h>
-#endif
-
 int _EXFUN(putenv,(char *__string));
 int _EXFUN(putenv,(char *__string));
+extern char **__environ;
 
 
 int libc_system_init(void)
 int libc_system_init(void)
 {
 {
-#if defined(RT_USING_DFS) & defined(RT_USING_DFS_DEVFS) & defined(RT_USING_CONSOLE)
+#if defined(RT_USING_DFS) & defined(RT_USING_DFS_DEVFS)
+
+#if defined(RT_USING_CONSOLE)
     rt_device_t dev_console;
     rt_device_t dev_console;
 
 
     dev_console = rt_console_get_device();
     dev_console = rt_console_get_device();
@@ -35,16 +34,55 @@ int libc_system_init(void)
         libc_stdio_set_console(dev_console->parent.name, O_WRONLY);
         libc_stdio_set_console(dev_console->parent.name, O_WRONLY);
     #endif
     #endif
     }
     }
+#endif
 
 
     /* set PATH and HOME */
     /* set PATH and HOME */
     putenv("PATH=/bin");
     putenv("PATH=/bin");
     putenv("HOME=/home");
     putenv("HOME=/home");
 #endif
 #endif
 
 
-#if defined RT_USING_PTHREADS && !defined RT_USING_COMPONENTS_INIT
-    pthread_system_init();
-#endif
-
     return 0;
     return 0;
 }
 }
 INIT_COMPONENT_EXPORT(libc_system_init);
 INIT_COMPONENT_EXPORT(libc_system_init);
+
+int env_set(int argc, char** argv)
+{
+    switch (argc)
+    {
+    case 1:
+        {
+            int index;
+
+            /* show all of environment variables */
+            for(index = 0; __environ[index]!=NULL; index++)
+            {
+                printf("%2d.%s\n", index, __environ[index]);
+            }
+        }
+        break;
+    case 2:
+        {
+            char *c = strchr(argv[1], '=');
+            if (c)
+            {
+                /* use setenv to add/update environment variable */
+                *c = '\0';
+                setenv(argv[1], c + 1, 1);
+            }
+            else
+            {
+                const char *value = getenv(argv[1]);
+                if (value)
+                {
+                    printf("%s=%s\n", argv[1], value);
+                }
+            }
+        }
+        break;
+    default:
+        break;
+    }
+
+    return 0;
+}
+MSH_CMD_EXPORT_ALIAS(env_set, set, set or show environment variable);

+ 0 - 14
components/net/lwip-2.1.2/src/arch/include/arch/cc.h

@@ -45,20 +45,6 @@
 #define S32_F "ld"
 #define S32_F "ld"
 #define X32_F "lx"
 #define X32_F "lx"
 
 
-#ifdef RT_USING_LIBC
-#if defined(__CC_ARM) || defined(__CLANG_ARM) || defined(__IAR_SYSTEMS_ICC__)
-#include <sys/errno.h>
-#else
-#include <errno.h>
-/* some errno not defined in newlib */
-#define ENSRNOTFOUND 163  /* Domain name not found */
-/* WARNING: ESHUTDOWN also not defined in newlib. We chose
-			180 here because the number "108" which is used
-			in arch.h has been assigned to another error code. */
-#define ESHUTDOWN 180
-#endif /* __CC_ARM/__IAR_SYSTEMS_ICC__ */
-#endif /* RT_USING_LIBC */
-
 #if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) || defined(RT_LIBC_USING_TIME) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION))
 #if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) || defined(RT_LIBC_USING_TIME) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION))
 #include <sys/time.h>
 #include <sys/time.h>
 #define LWIP_TIMEVAL_PRIVATE	   0
 #define LWIP_TIMEVAL_PRIVATE	   0

+ 2 - 0
libcpu/arm/cortex-a/cache.c

@@ -123,6 +123,7 @@ rt_base_t rt_hw_cpu_dcache_status(void)
     return 0;
     return 0;
 }
 }
 
 
+#ifdef RT_USING_LWP
 #define ICACHE (1<<0)
 #define ICACHE (1<<0)
 #define DCACHE (1<<1)
 #define DCACHE (1<<1)
 #define BCACHE (ICACHE|DCACHE)
 #define BCACHE (ICACHE|DCACHE)
@@ -143,3 +144,4 @@ int sys_cacheflush(void *addr, int size, int cache)
     }
     }
     return -1;
     return -1;
 }
 }
+#endif

+ 1 - 1
src/Kconfig

@@ -343,7 +343,7 @@ endmenu
 
 
 config RT_VER_NUM
 config RT_VER_NUM
     hex
     hex
-    default 0x40003
+    default 0x50000
     help
     help
         RT-Thread version number
         RT-Thread version number