テスト用のあれこれ共用フォルダ
修訂 | 2cef45ba7663a350062fc2118c9d43f54f82ec97 (tree) |
---|---|
時間 | 2018-05-02 07:33:56 |
作者 | takemasa <suikan@user...> |
Commiter | takemasa |
new/delete allocators are now overloaded internaly. These allocator uses pvPortMalloc() instead of malloc()
@@ -6,7 +6,7 @@ | ||
6 | 6 | <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> |
7 | 7 | <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> |
8 | 8 | <provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/> |
9 | - <provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-964660132747690961" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> | |
9 | + <provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-1464480601815891179" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> | |
10 | 10 | <language-scope id="org.eclipse.cdt.core.gcc"/> |
11 | 11 | <language-scope id="org.eclipse.cdt.core.g++"/> |
12 | 12 | </provider> |
@@ -18,7 +18,7 @@ | ||
18 | 18 | <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> |
19 | 19 | <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> |
20 | 20 | <provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/> |
21 | - <provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-964660132747690961" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> | |
21 | + <provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-1464480601815891179" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> | |
22 | 22 | <language-scope id="org.eclipse.cdt.core.gcc"/> |
23 | 23 | <language-scope id="org.eclipse.cdt.core.g++"/> |
24 | 24 | </provider> |
@@ -0,0 +1,37 @@ | ||
1 | +/** | |
2 | + * \file allocators.cpp | |
3 | + * | |
4 | + * \date 2018/05/02 | |
5 | + * \author takemasa | |
6 | + * \brief Alternative memory allocators. | |
7 | + * \details | |
8 | + * These definitions allows to used the FreeRTOS's heap instead of the system heap. | |
9 | + * | |
10 | + * The system heap by the standard library doesn't check the limit of the heap cerefly. | |
11 | + * As a result, it is not clear how to detect the over commiting memory. | |
12 | + * | |
13 | + * FreeRTOS hepa is considered safer than system heap. Then, the new and the delete | |
14 | + * operators are overloaded to use the pvPortMalloc(). | |
15 | + */ | |
16 | + | |
17 | +#include <cstddef> | |
18 | +#include <FreeRTOS.h> | |
19 | + | |
20 | +void* operator new(std::size_t size) | |
21 | +{ | |
22 | + return pvPortMalloc(size); | |
23 | +} | |
24 | + | |
25 | +void* operator new[](std::size_t size) { | |
26 | + return pvPortMalloc(size); | |
27 | +} | |
28 | + | |
29 | +void operator delete(void* ptr) { | |
30 | + vPortFree(ptr); | |
31 | +} | |
32 | + | |
33 | +void operator delete[](void* ptr) { | |
34 | + vPortFree(ptr); | |
35 | +} | |
36 | + | |
37 | + |
@@ -6,7 +6,7 @@ | ||
6 | 6 | <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> |
7 | 7 | <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> |
8 | 8 | <provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/> |
9 | - <provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-964660132747690961" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> | |
9 | + <provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-1464480601815891179" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> | |
10 | 10 | <language-scope id="org.eclipse.cdt.core.gcc"/> |
11 | 11 | <language-scope id="org.eclipse.cdt.core.g++"/> |
12 | 12 | </provider> |
@@ -18,7 +18,7 @@ | ||
18 | 18 | <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> |
19 | 19 | <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> |
20 | 20 | <provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/> |
21 | - <provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-964660132747690961" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> | |
21 | + <provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-1464480601815891179" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> | |
22 | 22 | <language-scope id="org.eclipse.cdt.core.gcc"/> |
23 | 23 | <language-scope id="org.eclipse.cdt.core.g++"/> |
24 | 24 | </provider> |