blob: 2bbba94c588ddb0091ba44a7ba54c41a012a0a6c [file] [log] [blame]
Miguel Young de la Sotad36c3e42022-03-28 12:56:09 -04001From 821187d8c24e1675dd2f00d482afff9ac4aad017 Mon Sep 17 00:00:00 2001
2From: Miguel Young de la Sota <mcyoung@google.com>
3Date: Mon, 28 Mar 2022 10:38:31 -0400
4Subject: [PATCH 3/3] Replace string.h with references to OT memory.h
5
6---
7 include/ot_memory.h | 19 +++++++++++++++++++
8 portable/GCC/MicroBlaze/port.c | 2 +-
9 portable/GCC/MicroBlazeV8/port.c | 2 +-
10 portable/GCC/MicroBlazeV9/port.c | 2 +-
11 portable/GCC/NiosII/port.c | 2 +-
12 portable/GCC/RISC-V/port.c | 2 +-
13 portable/GCC/RX100/port.c | 2 +-
14 portable/GCC/RX200/port.c | 2 +-
15 portable/GCC/RX600/port.c | 2 +-
16 portable/GCC/RX600v2/port.c | 2 +-
17 portable/GCC/RX700v3_DPFPU/port.c | 2 +-
18 portable/GCC/TriCore_1782/port.c | 2 +-
19 portable/IAR/RISC-V/port.c | 2 +-
20 portable/IAR/RX100/port.c | 2 +-
21 portable/IAR/RX600/port.c | 2 +-
22 portable/IAR/RX700v3_DPFPU/port.c | 2 +-
23 portable/IAR/RXv2/port.c | 2 +-
24 portable/MPLAB/PIC32MZ/port.c | 2 +-
25 portable/Renesas/RX100/port.c | 2 +-
26 portable/Renesas/RX200/port.c | 2 +-
27 portable/Renesas/RX600/port.c | 2 +-
28 portable/Renesas/RX600v2/port.c | 2 +-
29 portable/Renesas/RX700v3_DPFPU/port.c | 2 +-
30 portable/Renesas/SH2A_FPU/port.c | 2 +-
31 portable/SDCC/Cygnal/port.c | 2 +-
32 .../ThirdParty/GCC/ARC_EM_HS/freertos_tls.c | 2 +-
33 portable/ThirdParty/GCC/Posix/port.c | 2 +-
34 portable/ThirdParty/XCC/Xtensa/portclib.c | 2 +-
35 queue.c | 2 +-
36 stream_buffer.c | 2 +-
37 tasks.c | 2 +-
38 31 files changed, 49 insertions(+), 30 deletions(-)
39 create mode 100644 include/ot_memory.h
40
41diff --git a/include/ot_memory.h b/include/ot_memory.h
42new file mode 100644
43index 000000000..799c713e5
44--- /dev/null
45+++ b/include/ot_memory.h
46@@ -0,0 +1,19 @@
47+// Copyright lowRISC contributors.
48+// Licensed under the Apache License, Version 2.0, see LICENSE for details.
49+// SPDX-License-Identifier: Apache-2.0
50+
51+#include <stddef.h>
52+
53+// Redeclarations of the three special memory functions from memory.h
54+
55+#ifdef __cplusplus
56+extern "C" {
57+#endif // __cplusplus
58+
59+void *memcpy(void *dest, const void *src, size_t len);
60+void *memset(void *dest, int value, size_t len);
61+int memcmp(const void *lhs, const void *rhs, size_t len);
62+
63+#ifdef __cplusplus
64+} // extern "C"
65+#endif // __cplusplus
66diff --git a/portable/GCC/MicroBlaze/port.c b/portable/GCC/MicroBlaze/port.c
67index 48d661b8d..9b06ad48d 100644
68--- a/portable/GCC/MicroBlaze/port.c
69+++ b/portable/GCC/MicroBlaze/port.c
70@@ -36,7 +36,7 @@
71 #include "task.h"
72
73 /* Standard includes. */
74-#include <string.h>
75+#include "ot_memory.h"
76
77 /* Hardware includes. */
78 #include <xintc.h>
79diff --git a/portable/GCC/MicroBlazeV8/port.c b/portable/GCC/MicroBlazeV8/port.c
80index 381702fb0..ae2fc8ea7 100644
81--- a/portable/GCC/MicroBlazeV8/port.c
82+++ b/portable/GCC/MicroBlazeV8/port.c
83@@ -36,7 +36,7 @@
84 #include "task.h"
85
86 /* Standard includes. */
87-#include <string.h>
88+#include "ot_memory.h"
89
90 /* Hardware includes. */
91 #include <xintc_i.h>
92diff --git a/portable/GCC/MicroBlazeV9/port.c b/portable/GCC/MicroBlazeV9/port.c
93index 8e70db9a2..6e202c064 100644
94--- a/portable/GCC/MicroBlazeV9/port.c
95+++ b/portable/GCC/MicroBlazeV9/port.c
96@@ -36,7 +36,7 @@
97 #include "task.h"
98
99 /* Standard includes. */
100-#include <string.h>
101+#include "ot_memory.h"
102
103 /* Hardware includes. */
104 #include <xintc_i.h>
105diff --git a/portable/GCC/NiosII/port.c b/portable/GCC/NiosII/port.c
106index 7dc6f81f1..999e72bc6 100644
107--- a/portable/GCC/NiosII/port.c
108+++ b/portable/GCC/NiosII/port.c
109@@ -31,7 +31,7 @@
110 *----------------------------------------------------------*/
111
112 /* Standard Includes. */
113-#include <string.h>
114+#include "ot_memory.h"
115 #include <errno.h>
116
117 /* Altera includes. */
118diff --git a/portable/GCC/RISC-V/port.c b/portable/GCC/RISC-V/port.c
119index cde63fdb1..a9e5a9704 100644
120--- a/portable/GCC/RISC-V/port.c
121+++ b/portable/GCC/RISC-V/port.c
122@@ -36,7 +36,7 @@
123 #include "portmacro.h"
124
125 /* Standard includes. */
126-#include "string.h"
127+#include "ot_memory.h"
128
129 #ifdef configCLINT_BASE_ADDRESS
130 #warning The configCLINT_BASE_ADDRESS constant has been deprecated. configMTIME_BASE_ADDRESS and configMTIMECMP_BASE_ADDRESS are currently being derived from the (possibly 0) configCLINT_BASE_ADDRESS setting. Please update to define configMTIME_BASE_ADDRESS and configMTIMECMP_BASE_ADDRESS dirctly in place of configCLINT_BASE_ADDRESS. See https://www.FreeRTOS.org/Using-FreeRTOS-on-RISC-V.html
131diff --git a/portable/GCC/RX100/port.c b/portable/GCC/RX100/port.c
132index a45b64661..66de1f1fc 100644
133--- a/portable/GCC/RX100/port.c
134+++ b/portable/GCC/RX100/port.c
135@@ -38,7 +38,7 @@
136 #include "task.h"
137
138 /* Library includes. */
139-#include "string.h"
140+#include "ot_memory.h"
141
142 /* Hardware specifics. */
143 #if ( configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1 )
144diff --git a/portable/GCC/RX200/port.c b/portable/GCC/RX200/port.c
145index 97077743e..77cf4db7d 100644
146--- a/portable/GCC/RX200/port.c
147+++ b/portable/GCC/RX200/port.c
148@@ -35,7 +35,7 @@
149 #include "task.h"
150
151 /* Library includes. */
152-#include "string.h"
153+#include "ot_memory.h"
154
155 /* Hardware specifics. */
156 #if ( configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1 )
157diff --git a/portable/GCC/RX600/port.c b/portable/GCC/RX600/port.c
158index afe1a7142..4a6c0e2f2 100644
159--- a/portable/GCC/RX600/port.c
160+++ b/portable/GCC/RX600/port.c
161@@ -35,7 +35,7 @@
162 #include "task.h"
163
164 /* Library includes. */
165-#include "string.h"
166+#include "ot_memory.h"
167
168 /* Hardware specifics. */
169 #if ( configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1 )
170diff --git a/portable/GCC/RX600v2/port.c b/portable/GCC/RX600v2/port.c
171index 5527cf9a8..70a3055bb 100644
172--- a/portable/GCC/RX600v2/port.c
173+++ b/portable/GCC/RX600v2/port.c
174@@ -35,7 +35,7 @@
175 #include "task.h"
176
177 /* Library includes. */
178-#include "string.h"
179+#include "ot_memory.h"
180
181 /* Hardware specifics. */
182 #if ( configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1 )
183diff --git a/portable/GCC/RX700v3_DPFPU/port.c b/portable/GCC/RX700v3_DPFPU/port.c
184index 4575c455c..fc359c9f8 100644
185--- a/portable/GCC/RX700v3_DPFPU/port.c
186+++ b/portable/GCC/RX700v3_DPFPU/port.c
187@@ -37,7 +37,7 @@
188 #include "task.h"
189
190 /* Library includes. */
191-#include "string.h"
192+#include "ot_memory.h"
193
194 /* Hardware specifics. */
195 #if ( configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1 )
196diff --git a/portable/GCC/TriCore_1782/port.c b/portable/GCC/TriCore_1782/port.c
197index 329624251..c9bec08d2 100644
198--- a/portable/GCC/TriCore_1782/port.c
199+++ b/portable/GCC/TriCore_1782/port.c
200@@ -28,7 +28,7 @@
201
202 /* Standard includes. */
203 // #include <stdlib.h>
204-#include <string.h>
205+#include "ot_memory.h"
206
207 /* TriCore specific includes. */
208 #include <tc1782.h>
209diff --git a/portable/IAR/RISC-V/port.c b/portable/IAR/RISC-V/port.c
210index f8a49ace9..37c427e4a 100644
211--- a/portable/IAR/RISC-V/port.c
212+++ b/portable/IAR/RISC-V/port.c
213@@ -36,7 +36,7 @@
214 #include "portmacro.h"
215
216 /* Standard includes. */
217-#include "string.h"
218+#include "ot_memory.h"
219
220 #ifdef configCLINT_BASE_ADDRESS
221 #warning The configCLINT_BASE_ADDRESS constant has been deprecated. configMTIME_BASE_ADDRESS and configMTIMECMP_BASE_ADDRESS are currently being derived from the (possibly 0) configCLINT_BASE_ADDRESS setting. Please update to define configMTIME_BASE_ADDRESS and configMTIMECMP_BASE_ADDRESS dirctly in place of configCLINT_BASE_ADDRESS. See https://www.FreeRTOS.org/Using-FreeRTOS-on-RISC-V.html
222diff --git a/portable/IAR/RX100/port.c b/portable/IAR/RX100/port.c
223index 1a5fb3749..6727140cd 100644
224--- a/portable/IAR/RX100/port.c
225+++ b/portable/IAR/RX100/port.c
226@@ -38,7 +38,7 @@
227 #include "task.h"
228
229 /* Library includes. */
230-#include "string.h"
231+#include "ot_memory.h"
232
233 /* Hardware specifics. */
234 #include "machine.h"
235diff --git a/portable/IAR/RX600/port.c b/portable/IAR/RX600/port.c
236index 8f524dd85..694c38376 100644
237--- a/portable/IAR/RX600/port.c
238+++ b/portable/IAR/RX600/port.c
239@@ -35,7 +35,7 @@
240 #include "task.h"
241
242 /* Library includes. */
243-#include "string.h"
244+#include "ot_memory.h"
245
246 /* Hardware specifics. */
247 #include <iorx62n.h>
248diff --git a/portable/IAR/RX700v3_DPFPU/port.c b/portable/IAR/RX700v3_DPFPU/port.c
249index 961147cec..c4dd5bec5 100644
250--- a/portable/IAR/RX700v3_DPFPU/port.c
251+++ b/portable/IAR/RX700v3_DPFPU/port.c
252@@ -37,7 +37,7 @@
253 #include "task.h"
254
255 /* Library includes. */
256-#include "string.h"
257+#include "ot_memory.h"
258
259 /* Hardware specifics. */
260 #if ( configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1 )
261diff --git a/portable/IAR/RXv2/port.c b/portable/IAR/RXv2/port.c
262index aa9e79774..fc32dfef7 100644
263--- a/portable/IAR/RXv2/port.c
264+++ b/portable/IAR/RXv2/port.c
265@@ -35,7 +35,7 @@
266 #include "task.h"
267
268 /* Library includes. */
269-#include "string.h"
270+#include "ot_memory.h"
271
272 /* Hardware specifics. */
273 #include <machine.h>
274diff --git a/portable/MPLAB/PIC32MZ/port.c b/portable/MPLAB/PIC32MZ/port.c
275index e533f9020..893dbf964 100644
276--- a/portable/MPLAB/PIC32MZ/port.c
277+++ b/portable/MPLAB/PIC32MZ/port.c
278@@ -34,7 +34,7 @@
279 #include <xc.h>
280
281 /* Standard headers. */
282-#include <string.h>
283+#include "ot_memory.h"
284
285 /* Scheduler include files. */
286 #include "FreeRTOS.h"
287diff --git a/portable/Renesas/RX100/port.c b/portable/Renesas/RX100/port.c
288index 12db4c011..5f40b0969 100644
289--- a/portable/Renesas/RX100/port.c
290+++ b/portable/Renesas/RX100/port.c
291@@ -38,7 +38,7 @@
292 #include "task.h"
293
294 /* Library includes. */
295-#include "string.h"
296+#include "ot_memory.h"
297
298 /* Hardware specifics. */
299 #include "iodefine.h"
300diff --git a/portable/Renesas/RX200/port.c b/portable/Renesas/RX200/port.c
301index 2ee9d5943..1582032d7 100644
302--- a/portable/Renesas/RX200/port.c
303+++ b/portable/Renesas/RX200/port.c
304@@ -35,7 +35,7 @@
305 #include "task.h"
306
307 /* Library includes. */
308-#include "string.h"
309+#include "ot_memory.h"
310
311 /* Hardware specifics. */
312 #include "iodefine.h"
313diff --git a/portable/Renesas/RX600/port.c b/portable/Renesas/RX600/port.c
314index d3315c569..1de736888 100644
315--- a/portable/Renesas/RX600/port.c
316+++ b/portable/Renesas/RX600/port.c
317@@ -35,7 +35,7 @@
318 #include "task.h"
319
320 /* Library includes. */
321-#include "string.h"
322+#include "ot_memory.h"
323
324 /* Hardware specifics. */
325 #include "iodefine.h"
326diff --git a/portable/Renesas/RX600v2/port.c b/portable/Renesas/RX600v2/port.c
327index 7ee91bfa8..b207c5fe1 100644
328--- a/portable/Renesas/RX600v2/port.c
329+++ b/portable/Renesas/RX600v2/port.c
330@@ -35,7 +35,7 @@
331 #include "task.h"
332
333 /* Library includes. */
334-#include "string.h"
335+#include "ot_memory.h"
336
337 /* Hardware specifics. */
338 #if defined( configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H ) && ( configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1 )
339diff --git a/portable/Renesas/RX700v3_DPFPU/port.c b/portable/Renesas/RX700v3_DPFPU/port.c
340index 26cb9f020..b91942352 100644
341--- a/portable/Renesas/RX700v3_DPFPU/port.c
342+++ b/portable/Renesas/RX700v3_DPFPU/port.c
343@@ -37,7 +37,7 @@
344 #include "task.h"
345
346 /* Library includes. */
347-#include "string.h"
348+#include "ot_memory.h"
349
350 /* Hardware specifics. */
351 #if ( configINCLUDE_PLATFORM_H_INSTEAD_OF_IODEFINE_H == 1 )
352diff --git a/portable/Renesas/SH2A_FPU/port.c b/portable/Renesas/SH2A_FPU/port.c
353index ca7c56b3d..0e9d4c655 100644
354--- a/portable/Renesas/SH2A_FPU/port.c
355+++ b/portable/Renesas/SH2A_FPU/port.c
356@@ -35,7 +35,7 @@
357 #include "task.h"
358
359 /* Library includes. */
360-#include "string.h"
361+#include "ot_memory.h"
362
363 /*-----------------------------------------------------------*/
364
365diff --git a/portable/SDCC/Cygnal/port.c b/portable/SDCC/Cygnal/port.c
366index e0a9d9488..2811b6b9a 100644
367--- a/portable/SDCC/Cygnal/port.c
368+++ b/portable/SDCC/Cygnal/port.c
369@@ -31,7 +31,7 @@
370 *----------------------------------------------------------*/
371
372 /* Standard includes. */
373-#include <string.h>
374+#include "ot_memory.h"
375
376 /* Scheduler includes. */
377 #include "FreeRTOS.h"
378diff --git a/portable/ThirdParty/GCC/ARC_EM_HS/freertos_tls.c b/portable/ThirdParty/GCC/ARC_EM_HS/freertos_tls.c
379index 7d74f319e..1b4f60295 100644
380--- a/portable/ThirdParty/GCC/ARC_EM_HS/freertos_tls.c
381+++ b/portable/ThirdParty/GCC/ARC_EM_HS/freertos_tls.c
382@@ -30,7 +30,7 @@
383
384 #include <stdint.h>
385 #include <stdlib.h>
386- #include <string.h>
387+ #include "ot_memory.h"
388
389 #include "FreeRTOS.h"
390
391diff --git a/portable/ThirdParty/GCC/Posix/port.c b/portable/ThirdParty/GCC/Posix/port.c
392index e80f7518f..b3834ff4b 100644
393--- a/portable/ThirdParty/GCC/Posix/port.c
394+++ b/portable/ThirdParty/GCC/Posix/port.c
395@@ -55,7 +55,7 @@
396 #include <signal.h>
397 #include <stdio.h>
398 #include <stdlib.h>
399-#include <string.h>
400+#include "ot_memory.h"
401 #include <sys/time.h>
402 #include <sys/times.h>
403 #include <time.h>
404diff --git a/portable/ThirdParty/XCC/Xtensa/portclib.c b/portable/ThirdParty/XCC/Xtensa/portclib.c
405index b0616657c..720a9ecbe 100644
406--- a/portable/ThirdParty/XCC/Xtensa/portclib.c
407+++ b/portable/ThirdParty/XCC/Xtensa/portclib.c
408@@ -137,7 +137,7 @@ _reclaim_reent(void * ptr)
409 #include <malloc.h>
410 #include <stdio.h>
411 // #include <stdlib.h>
412-#include <string.h>
413+#include "ot_memory.h"
414
415 #include "semphr.h"
416
417diff --git a/queue.c b/queue.c
418index 12f81d394..30e905ac8 100644
419--- a/queue.c
420+++ b/queue.c
421@@ -27,7 +27,7 @@
422 */
423
424 // #include <stdlib.h>
425-#include <string.h>
426+#include "ot_memory.h"
427
428 /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
429 * all the API functions to use the MPU wrappers. That should only be done when
430diff --git a/stream_buffer.c b/stream_buffer.c
431index 8a7a2e0d0..813e60a99 100644
432--- a/stream_buffer.c
433+++ b/stream_buffer.c
434@@ -28,7 +28,7 @@
435
436 /* Standard includes. */
437 #include <stdint.h>
438-#include <string.h>
439+#include "ot_memory.h"
440
441 /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
442 * all the API functions to use the MPU wrappers. That should only be done when
443diff --git a/tasks.c b/tasks.c
444index 405425c60..48e9dc37e 100644
445--- a/tasks.c
446+++ b/tasks.c
447@@ -28,7 +28,7 @@
448
449 /* Standard includes. */
450 // #include <stdlib.h>
451-#include <string.h>
452+#include "ot_memory.h"
453
454 /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
455 * all the API functions to use the MPU wrappers. That should only be done when
456--
4572.35.1.1021.g381101b075-goog
458