Skip to content

Commit 4522ca6

Browse files
committed
Fix __malloc_lock/unlock prototype change in newlib
Signed-off-by: Frederic Pillon <[email protected]>
1 parent 8e66896 commit 4522ca6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

portable/MemMang/heap_useNewlib.c

+5
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,13 @@ char * sbrk(int incr) {
109109
//! Synonym for sbrk.
110110
char * _sbrk(int incr) { return sbrk(incr); };
111111

112+
#if (__NEWLIB__ >= 3)
113+
void __malloc_lock(struct _reent *ptr __attribute__((__unused__))) { vTaskSuspendAll(); };
114+
void __malloc_unlock(struct _reent *ptr __attribute__((__unused__))) { (void)xTaskResumeAll(); };
115+
#else
112116
void __malloc_lock() { vTaskSuspendAll(); };
113117
void __malloc_unlock() { (void)xTaskResumeAll(); };
118+
#endif
114119

115120
// newlib also requires implementing locks for the application's environment memory space,
116121
// accessed by newlib's setenv() and getenv() functions.

0 commit comments

Comments
 (0)