WAGO-750-860.patch 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. commit b801b9275cb93f2cea1dce231f01780bed9834ca
  2. Author: FlorianPalm <f.palm@plt.rwth-aachen.de>
  3. Date: Wed Dec 10 10:21:44 2014 +0100
  4. changes for WAGO 750-860
  5. diff --git a/CMakeLists.txt b/CMakeLists.txt
  6. index 87489b3..76c4aa0 100644
  7. --- a/CMakeLists.txt
  8. +++ b/CMakeLists.txt
  9. @@ -41,16 +41,14 @@ set(lib_sources src/ua_types.c
  10. # compiler flags
  11. if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
  12. -add_definitions(-std=c99 -pedantic -pipe -Wall -Wextra -Werror -Wformat
  13. - -Wno-unused-parameter -Wno-unused-function -Wno-unused-label -Wpointer-arith -Wreturn-type -Wsign-compare -Wmultichar
  14. - -Winit-self -Wuninitialized -Wno-deprecated -Wformat-security -ffunction-sections -fdata-sections)
  15. +add_definitions(-std=c99 -fomit-frame-pointer -pipe -msoft-float -fno-builtin -DEMBED -fno-strict-aliasing)
  16. if(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
  17. add_definitions(-Wformat-nonliteral)
  18. - set (CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--gc-sections")
  19. - set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections")
  20. + set (CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,-elf2flt -msoft-float")
  21. + set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-elf2flt -msoft-float")
  22. endif()
  23. if(NOT WIN32)
  24. - add_definitions(-fstack-protector -fPIC -fvisibility=hidden)
  25. + # add_definitions(-fPIC)
  26. endif()
  27. endif()
  28. @@ -115,10 +113,10 @@ else()
  29. endif()
  30. add_library(open62541-objects OBJECT ${lib_sources}) # static version that exports all symbols
  31. -add_library(open62541 SHARED $<TARGET_OBJECTS:open62541-objects>)
  32. -target_compile_definitions(open62541 INTERFACE
  33. - $<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:open62541_EXPORTS> # the UA_EXPORT macro is different when building the lib or using the lib
  34. -)
  35. +add_library(open62541 $<TARGET_OBJECTS:open62541-objects>)
  36. +#target_compile_definitions(open62541 INTERFACE
  37. +# $<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:open62541_EXPORTS> # the UA_EXPORT macro is different when building the lib or using the lib
  38. +#)
  39. ## logging
  40. set(UA_LOGLEVEL 400 CACHE STRING "Level at which logs shall be reported")
  41. @@ -137,7 +135,7 @@ endif()
  42. configure_file("src/ua_config.h.in" "${PROJECT_BINARY_DIR}/src_generated/ua_config.h")
  43. # download queue.h if required
  44. -if(WIN32)
  45. +#if(WIN32)
  46. if(NOT EXISTS "${PROJECT_BINARY_DIR}/src_generated/queue.h")
  47. file(DOWNLOAD "http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/~checkout~/src/sys/sys/queue.h" "${PROJECT_BINARY_DIR}/src_generated/queue.h" STATUS result)
  48. list(GET result 0 download_ok)
  49. @@ -146,7 +144,7 @@ if(WIN32)
  50. message(FATAL_ERROR "queue.h could not be downloaded")
  51. endif()
  52. endif()
  53. -endif(WIN32)
  54. +#endif(WIN32)
  55. # generate code from xml definitions
  56. file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/src_generated")
  57. diff --git a/src/ua_util.c b/src/ua_util.c
  58. index 875e0b9..95dfe32 100644
  59. --- a/src/ua_util.c
  60. +++ b/src/ua_util.c
  61. @@ -2,7 +2,6 @@
  62. /* the extern inline in a *.c-file is required for other compilation units to
  63. see the inline function. */
  64. -extern INLINE void UA_memcpy(void *dst, void const *src, UA_Int32 size);
  65. #ifdef DEBUG
  66. extern INLINE void _UA_free(void *ptr, char *pname, char *f, UA_Int32 l);
  67. diff --git a/src/ua_util.h b/src/ua_util.h
  68. index 4426129..4e5ba65 100644
  69. --- a/src/ua_util.h
  70. +++ b/src/ua_util.h
  71. @@ -11,7 +11,7 @@
  72. #include <stddef.h> /* Needed for sys/queue.h */
  73. #ifndef WIN32
  74. -#include <sys/queue.h>
  75. +#include "queue.h"
  76. #include <alloca.h>
  77. #else
  78. #include "queue.h"
  79. @@ -50,36 +50,11 @@
  80. #endif
  81. /* Heap memory functions */
  82. -#ifdef DEBUG
  83. -#define UA_free(ptr) _UA_free(ptr, # ptr, __FILE__, __LINE__)
  84. -INLINE void _UA_free(void *ptr, char *pname, char *f, UA_Int32 l) {
  85. - DBG_VERBOSE(printf("UA_free;%p;;%s;;%s;%d\n", ptr, pname, f, l); fflush(stdout));
  86. - free(ptr); // checks if ptr != UA_NULL in the background
  87. -}
  88. -#else
  89. -#define UA_free(ptr) _UA_free(ptr)
  90. -INLINE void _UA_free(void *ptr) {
  91. - free(ptr); // checks if ptr != UA_NULL in the background
  92. -}
  93. -#endif
  94. +#define UA_free(ptr) free(ptr)
  95. -#ifdef DEBUG
  96. -#define UA_alloc(size) _UA_alloc(size, __FILE__, __LINE__)
  97. -INLINE void * _UA_alloc(UA_Int32 size, char *file, UA_Int32 line) {
  98. - DBG_VERBOSE(printf("UA_alloc - %d;%s;%d\n", size, file, line); fflush(stdout));
  99. - return malloc(size);
  100. -}
  101. -#else
  102. -#define UA_alloc(size) _UA_alloc(size)
  103. -INLINE void * _UA_alloc(UA_Int32 size) {
  104. - return malloc(size);
  105. -}
  106. -#endif
  107. +#define UA_alloc(size) malloc(size)
  108. -INLINE void UA_memcpy(void *dst, void const *src, UA_Int32 size) {
  109. - DBG_VERBOSE(printf("UA_memcpy - %p;%p;%d\n", dst, src, size));
  110. - memcpy(dst, src, size);
  111. -}
  112. +#define UA_memcpy memcpy
  113. #ifdef WIN32
  114. #define UA_alloca(size) _alloca(size)