Prechádzať zdrojové kódy

Clean freeRTOS, change its name and clean eCos

Jose Cabral 6 rokov pred
rodič
commit
fc59acccb9

+ 1 - 1
arch/CMakeLists.txt

@@ -5,6 +5,6 @@ ua_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) #to have access to ua_networ
 add_subdirectory(posix)
 add_subdirectory(win32)
 add_subdirectory(arduino)
-add_subdirectory(freertos)
+add_subdirectory(freertosLWIP)
 add_subdirectory(vxworks)
 add_subdirectory(eCos)

+ 3 - 0
arch/eCos/CMakeLists.txt

@@ -21,6 +21,9 @@ if (${_index} GREATER -1 OR "${UA_ARCHITECTURE}" STREQUAL "eCos")
         SET(UA_ECOS_INCLUDES "" CACHE STRING "Folders to include from the eCos OS")
 
         ua_include_directories(${UA_ECOS_INCLUDES}/include)
+        
+        set(UA_ECOS_HOSTNAME "eCos-host" CACHE STRING "Define a custom hostname/ip for the endpoint.")
+        ua_architecture_add_definitions(-DUA_ECOS_HOSTNAME="${UA_ECOS_HOSTNAME}")
     endif()
 
 endif()

+ 0 - 2
arch/eCos/ua_architecture.h

@@ -10,8 +10,6 @@
 
 #define UA_THREAD_LOCAL
 
-#define UA_ECOS_HOSTNAME "172.20.12.151"
-
 #include <pkgconf/system.h>
 #include <cyg/kernel/kapi.h>
 #include <cyg/io/io.h>

+ 0 - 26
arch/freertos/CMakeLists.txt

@@ -1,26 +0,0 @@
-SET(SOURCE_GROUP ${SOURCE_GROUP}\\freertos)
-
-ua_add_architecture("freertos")
-
-list (FIND UA_AMALGAMATION_ARCHITECUTRES "freertos" _index)
-if (${_index} GREATER -1 OR "${UA_ARCHITECTURE}" STREQUAL "freertos")
-
-    ua_add_architecture_file(${CMAKE_CURRENT_SOURCE_DIR}/ua_clock.c)
-    ua_add_architecture_file(${CMAKE_CURRENT_SOURCE_DIR}/ua_architecture_functions.c)
-
-    if("${UA_ARCHITECTURE}" STREQUAL "freertos")
-
-        ua_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-
-        SET(UA_FREERTOS_INCLUDES "" CACHE STRING "Folders to include from the freeRTOS OS")
-        ua_include_directories(${UA_FREERTOS_INCLUDES})
-
-        ua_architecture_remove_definitions(-Wconversion )
-        ua_architecture_add_definitions(-DUA_FREERTOS -mcpu=cortex-m3 -mthumb -g -Wall -O0 -specs=nano.specs
-                    -ffunction-sections -fdata-sections  -fno-exceptions -fstack-usage -Wno-unused-variable -Wno-format -Wno-format-security -Wno-format-nonliteral)
-        ua_architecture_append_to_library(c m stdc++ supc++)
-
-        set(UA_FREERTOS_HOSTNAME "freertos-host" CACHE STRING "Define a custom hostname/ip for the endpoint.")
-        ua_architecture_add_definitions(-DUA_FREERTOS_HOSTNAME="${UA_FREERTOS_HOSTNAME}")
-    endif()
-endif()

+ 26 - 0
arch/freertosLWIP/CMakeLists.txt

@@ -0,0 +1,26 @@
+SET(SOURCE_GROUP ${SOURCE_GROUP}\\freertosLWIP)
+
+ua_add_architecture("freertosLWIP")
+
+list (FIND UA_AMALGAMATION_ARCHITECUTRES "freertosLWIP" _index)
+if (${_index} GREATER -1 OR "${UA_ARCHITECTURE}" STREQUAL "freertosLWIP")
+
+    ua_add_architecture_file(${CMAKE_CURRENT_SOURCE_DIR}/ua_clock.c)
+    ua_add_architecture_file(${CMAKE_CURRENT_SOURCE_DIR}/ua_architecture_functions.c)
+
+    if("${UA_ARCHITECTURE}" STREQUAL "freertosLWIP")
+
+        ua_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+        SET(UA_FREERTOS_INCLUDES "" CACHE STRING "Folders to include from the freeRTOS OS")
+        ua_include_directories(${UA_FREERTOS_INCLUDES})
+
+        ua_architecture_remove_definitions(-Wconversion )
+        ua_architecture_add_definitions(-mthumb -mcpu=cortex-m3) #CPU dependant
+        ua_architecture_add_definitions(-ffunction-sections -fdata-sections -fstack-usage -Wall -specs=nano.specs
+                     -fno-exceptions -Wno-unused-variable -Wno-format -Wno-format-security -Wno-format-nonliteral)
+
+        set(UA_FREERTOS_HOSTNAME "freertosLWIP-host" CACHE STRING "Define a custom hostname/ip for the endpoint.")
+        ua_architecture_add_definitions(-DUA_FREERTOS_HOSTNAME="${UA_FREERTOS_HOSTNAME}")
+    endif()
+endif()

+ 4 - 11
arch/freertos/ua_architecture.h

@@ -6,16 +6,11 @@
  *    Copyright 2018 (c) Jose Cabral, fortiss GmbH
  */
 
-#ifdef UA_ARCHITECTURE_FREERTOS
+#ifdef UA_ARCHITECTURE_FREERTOSLWIP
 
 #ifndef PLUGINS_ARCH_FREERTOS_UA_ARCHITECTURE_H_
 #define PLUGINS_ARCH_FREERTOS_UA_ARCHITECTURE_H_
 
-
-//------------------------------------------------------------------
-// NOT WORKING YET!!!!!!!!!!!!!!!!!!!!!
-//------------------------------------------------------------------
-
 #define AI_PASSIVE 0x01
 
 #define UA_THREAD_LOCAL
@@ -24,13 +19,11 @@
 #include <string.h>
 
 #define LWIP_TIMEVAL_PRIVATE 0
-//#define LWIP_COMPAT_MUTEX 0
 #define LWIP_POSIX_SOCKETS_IO_NAMES 0
 #ifdef LWIP_COMPAT_SOCKETS
 #undef LWIP_COMPAT_SOCKETS
 #endif
 #define LWIP_COMPAT_SOCKETS 0
-//#define __USE_W32_SOCKETS 1 //needed to avoid redefining of select in sys/select.h
 
 #include <lwip/tcpip.h>
 #include <lwip/netdb.h>
@@ -44,8 +37,8 @@
 
 #include <unistd.h> // read, write, close
 
-#define UA_fd_set(fd, fds) FD_SET((unsigned int)fd, fds)
-#define UA_fd_isset(fd, fds) FD_ISSET((unsigned int)fd, fds)
+#define UA_fd_set(fd, fds) FD_SET(fd, fds)
+#define UA_fd_isset(fd, fds) FD_ISSET(fd, fds)
 
 #define UA_access access
 
@@ -98,4 +91,4 @@ int gethostname_freertos(char* name, size_t len);
 
 #endif /* PLUGINS_ARCH_FREERTOS_UA_ARCHITECTURE_H_ */
 
-#endif /* UA_ARCHITECTURE_FREERTOS */
+#endif /* UA_ARCHITECTURE_FREERTOSLWIP */

+ 2 - 2
arch/freertos/ua_architecture_functions.c

@@ -4,7 +4,7 @@
  *    Copyright 2018 (c) Jose Cabral, fortiss GmbH
  */
 
-#ifdef UA_ARCHITECTURE_FREERTOS
+#ifdef UA_ARCHITECTURE_FREERTOSLWIP
 
 #include "ua_types.h"
 
@@ -45,4 +45,4 @@ void UA_deinitialize_architecture_network(void){
   return;
 }
 
-#endif /* UA_ARCHITECTURE_FREERTOS */
+#endif /* UA_ARCHITECTURE_FREERTOSLWIP */

+ 2 - 2
arch/freertos/ua_clock.c

@@ -6,7 +6,7 @@
  *    Copyright 2017 (c) Thomas Stalder
  */
 
-#ifdef UA_ARCHITECTURE_FREERTOS
+#ifdef UA_ARCHITECTURE_FREERTOSLWIP
 
 #include "ua_types.h"
 #include <time.h>
@@ -42,4 +42,4 @@ UA_DateTime UA_DateTime_nowMonotonic(void) {
     return (ts.tv_sec * UA_DATETIME_SEC) + (ts.tv_nsec / 100);
 }
 
-#endif /* UA_ARCHITECTURE_FREERTOS */
+#endif /* UA_ARCHITECTURE_FREERTOSLWIP */