Skip to content

Commit a9767e4

Browse files
authored
Adding new.cpp as in F1 core.
This is to avoid libstdc++ being pulled in when new() is used. Already included in the F1 in 2016. Discussed on this thread: http://www.stm32duino.com/viewtopic.php?f=39&t=2460&p=33163
1 parent 33411b6 commit a9767e4

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

STM32F4/cores/maple/new.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Copyright (c) 2014 Arduino. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
#include <stdlib.h>
20+
21+
void *operator new(size_t size) {
22+
return malloc(size);
23+
}
24+
25+
void *operator new[](size_t size) {
26+
return malloc(size);
27+
}
28+
29+
void operator delete(void * ptr) {
30+
free(ptr);
31+
}
32+
33+
void operator delete[](void * ptr) {
34+
free(ptr);
35+
}

0 commit comments

Comments
 (0)