lpc32xxcdl-2.11-libnosys_gnu.patch 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. Fix compilation and eabi issues
  2. Since we are not linking with libc anymore, we need to define our own memset,
  3. strlen and memcpy. Also, as we are using a *libc compiler, we need to "handle"
  4. exceptions (mostly division by 0) by defining raise() and
  5. __aeabi_unwind_cpp_pr0.
  6. Signed-off-by: Alexandre Belloni <abelloni@adeneo-embedded.com>
  7. ---
  8. csps/lpc32xx/bsps/ea3250/source/libnosys_gnu.c | 41 +++++++++++++++++++++++
  9. csps/lpc32xx/bsps/fdi3250/source/libnosys_gnu.c | 41 +++++++++++++++++++++++
  10. csps/lpc32xx/bsps/phy3250/source/libnosys_gnu.c | 41 +++++++++++++++++++++++
  11. 3 files changed, 123 insertions(+), 0 deletions(-)
  12. diff --git a/csps/lpc32xx/bsps/ea3250/source/libnosys_gnu.c b/csps/lpc32xx/bsps/ea3250/source/libnosys_gnu.c
  13. index 385b0ab..f1f0a0a 100644
  14. --- a/csps/lpc32xx/bsps/ea3250/source/libnosys_gnu.c
  15. +++ b/csps/lpc32xx/bsps/ea3250/source/libnosys_gnu.c
  16. @@ -25,6 +25,7 @@
  17. #include <errno.h>
  18. #include <sys/times.h>
  19. #include <sys/stat.h>
  20. +#include <sys/types.h>
  21. /* errno definition */
  22. #undef errno
  23. @@ -125,4 +126,44 @@ int _write(int file, char *ptr, int len){
  24. return 0;
  25. }
  26. +void * memset(void * s,int c,size_t count)
  27. +{
  28. + char *xs = (char *) s;
  29. +
  30. + while (count--)
  31. + *xs++ = c;
  32. +
  33. + return s;
  34. +}
  35. +
  36. +
  37. +size_t strlen(const char * s)
  38. +{
  39. + const char *sc;
  40. +
  41. + for (sc = s; *sc != '\0'; ++sc)
  42. + /* nothing */;
  43. + return sc - s;
  44. +}
  45. +
  46. +void * memcpy(void * dest,const void *src,size_t count)
  47. +{
  48. + char *tmp = (char *) dest, *s = (char *) src;
  49. +
  50. + while (count--)
  51. + *tmp++ = *s++;
  52. +
  53. + return dest;
  54. +}
  55. +
  56. +
  57. +/* Dummy functions to avoid linker complaints */
  58. +void __aeabi_unwind_cpp_pr0(void)
  59. +{
  60. +};
  61. +
  62. +void raise(void)
  63. +{
  64. +};
  65. +
  66. #endif /*__GNUC__*/
  67. diff --git a/csps/lpc32xx/bsps/fdi3250/source/libnosys_gnu.c b/csps/lpc32xx/bsps/fdi3250/source/libnosys_gnu.c
  68. index 385b0ab..f1f0a0a 100644
  69. --- a/csps/lpc32xx/bsps/fdi3250/source/libnosys_gnu.c
  70. +++ b/csps/lpc32xx/bsps/fdi3250/source/libnosys_gnu.c
  71. @@ -25,6 +25,7 @@
  72. #include <errno.h>
  73. #include <sys/times.h>
  74. #include <sys/stat.h>
  75. +#include <sys/types.h>
  76. /* errno definition */
  77. #undef errno
  78. @@ -125,4 +126,44 @@ int _write(int file, char *ptr, int len){
  79. return 0;
  80. }
  81. +void * memset(void * s,int c,size_t count)
  82. +{
  83. + char *xs = (char *) s;
  84. +
  85. + while (count--)
  86. + *xs++ = c;
  87. +
  88. + return s;
  89. +}
  90. +
  91. +
  92. +size_t strlen(const char * s)
  93. +{
  94. + const char *sc;
  95. +
  96. + for (sc = s; *sc != '\0'; ++sc)
  97. + /* nothing */;
  98. + return sc - s;
  99. +}
  100. +
  101. +void * memcpy(void * dest,const void *src,size_t count)
  102. +{
  103. + char *tmp = (char *) dest, *s = (char *) src;
  104. +
  105. + while (count--)
  106. + *tmp++ = *s++;
  107. +
  108. + return dest;
  109. +}
  110. +
  111. +
  112. +/* Dummy functions to avoid linker complaints */
  113. +void __aeabi_unwind_cpp_pr0(void)
  114. +{
  115. +};
  116. +
  117. +void raise(void)
  118. +{
  119. +};
  120. +
  121. #endif /*__GNUC__*/
  122. diff --git a/csps/lpc32xx/bsps/phy3250/source/libnosys_gnu.c b/csps/lpc32xx/bsps/phy3250/source/libnosys_gnu.c
  123. index cfdb674..6b50c60 100644
  124. --- a/csps/lpc32xx/bsps/phy3250/source/libnosys_gnu.c
  125. +++ b/csps/lpc32xx/bsps/phy3250/source/libnosys_gnu.c
  126. @@ -25,6 +25,7 @@
  127. #include <errno.h>
  128. #include <sys/times.h>
  129. #include <sys/stat.h>
  130. +#include <sys/types.h>
  131. /* errno definition */
  132. #undef errno
  133. @@ -125,4 +126,44 @@ int _write(int file, char *ptr, int len){
  134. return 0;
  135. }
  136. +void * memset(void * s,int c,size_t count)
  137. +{
  138. + char *xs = (char *) s;
  139. +
  140. + while (count--)
  141. + *xs++ = c;
  142. +
  143. + return s;
  144. +}
  145. +
  146. +
  147. +size_t strlen(const char * s)
  148. +{
  149. + const char *sc;
  150. +
  151. + for (sc = s; *sc != '\0'; ++sc)
  152. + /* nothing */;
  153. + return sc - s;
  154. +}
  155. +
  156. +void * memcpy(void * dest,const void *src,size_t count)
  157. +{
  158. + char *tmp = (char *) dest, *s = (char *) src;
  159. +
  160. + while (count--)
  161. + *tmp++ = *s++;
  162. +
  163. + return dest;
  164. +}
  165. +
  166. +
  167. +/* Dummy functions to avoid linker complaints */
  168. +void __aeabi_unwind_cpp_pr0(void)
  169. +{
  170. +};
  171. +
  172. +void raise(void)
  173. +{
  174. +};
  175. +
  176. #endif /*__GNUC__*/
  177. --
  178. 1.7.7.3