aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/kernel/include/chheap.h2
-rw-r--r--os/kernel/src/chheap.c4
-rw-r--r--readme.txt2
-rw-r--r--test/testdyn.c14
-rw-r--r--test/testheap.c4
5 files changed, 17 insertions, 9 deletions
diff --git a/os/kernel/include/chheap.h b/os/kernel/include/chheap.h
index eb642cd18..0db1cbc1d 100644
--- a/os/kernel/include/chheap.h
+++ b/os/kernel/include/chheap.h
@@ -76,7 +76,9 @@ struct memory_heap {
extern "C" {
#endif
void _heap_init(void);
+#if !CH_USE_MALLOC_HEAP
void chHeapInit(MemoryHeap *heapp, void *buf, size_t size);
+#endif
void *chHeapAlloc(MemoryHeap *heapp, size_t size);
void chHeapFree(void *p);
size_t chHeapStatus(MemoryHeap *heapp, size_t *sizep);
diff --git a/os/kernel/src/chheap.c b/os/kernel/src/chheap.c
index bcfca9b77..b90b21909 100644
--- a/os/kernel/src/chheap.c
+++ b/os/kernel/src/chheap.c
@@ -80,6 +80,8 @@ void _heap_init(void) {
* @brief Initializes a memory heap from a static memory area.
* @pre Both the heap buffer base and the heap size must be aligned to
* the @p stkalign_t type size.
+ * @pre In order to use this function the option @p CH_USE_MALLOC_HEAP
+ * must be disabled.
*
* @param[out] heapp pointer to the memory heap descriptor to be initialized
* @param[in] buf heap buffer base
@@ -271,7 +273,7 @@ static Mutex hmtx;
static Semaphore hsem;
#endif
-void heap_init(void) {
+void _heap_init(void) {
#if CH_USE_MUTEXES
chMtxInit(&hmtx);
diff --git a/readme.txt b/readme.txt
index 484a57dd8..5b225c3f5 100644
--- a/readme.txt
+++ b/readme.txt
@@ -72,6 +72,8 @@
*** 2.3.3 ***
- FIX: Race condition in output queues (bug 3303908)(backported to 2.2.4).
+- FIX: Fixed CH_USE_HEAP and CH_USE_MALLOC_HEAP conflict (bug 3303841)
+ (backported to 2.2.4)
- FIX: Fixed timeout problem in the lwIP interface layer (bug 3302420)
(backported to 2.2.4).
- NEW: Reorganization of the Cortex-Mx ports in order to reduced code and
diff --git a/test/testdyn.c b/test/testdyn.c
index 5657a8dc2..d015e2ac6 100644
--- a/test/testdyn.c
+++ b/test/testdyn.c
@@ -54,7 +54,7 @@
*/
#if CH_USE_DYNAMIC || defined(__DOXYGEN__)
-#if CH_USE_HEAP || defined(__DOXYGEN__)
+#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
static MemoryHeap heap1;
#endif
#if CH_USE_MEMPOOLS || defined(__DOXYGEN__)
@@ -78,7 +78,7 @@ static msg_t thread(void *p) {
return 0;
}
-#if CH_USE_HEAP || defined(__DOXYGEN__)
+#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
static void dyn1_setup(void) {
chHeapInit(&heap1, test.buffer, sizeof(union test_buffers));
@@ -124,7 +124,7 @@ ROMCONST struct testcase testdyn1 = {
NULL,
dyn1_execute
};
-#endif /* CH_USE_HEAP */
+#endif /* (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) */
#if CH_USE_MEMPOOLS || defined(__DOXYGEN__)
/**
@@ -182,7 +182,8 @@ ROMCONST struct testcase testdyn2 = {
};
#endif /* CH_USE_MEMPOOLS */
-#if (CH_USE_HEAP && CH_USE_REGISTRY) || defined(__DOXYGEN__)
+#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP && CH_USE_REGISTRY) || \
+ defined(__DOXYGEN__)
/**
* @page test_dynamic_003 Registry and References test
*
@@ -252,13 +253,14 @@ ROMCONST struct testcase testdyn3 = {
*/
ROMCONST struct testcase * ROMCONST patterndyn[] = {
#if CH_USE_DYNAMIC || defined(__DOXYGEN__)
-#if CH_USE_HEAP || defined(__DOXYGEN__)
+#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
&testdyn1,
#endif
#if CH_USE_MEMPOOLS || defined(__DOXYGEN__)
&testdyn2,
#endif
-#if (CH_USE_HEAP && CH_USE_REGISTRY) || defined(__DOXYGEN__)
+#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP && CH_USE_REGISTRY) || \
+ defined(__DOXYGEN__)
&testdyn3,
#endif
#endif
diff --git a/test/testheap.c b/test/testheap.c
index bfdcea1e6..6316b56c6 100644
--- a/test/testheap.c
+++ b/test/testheap.c
@@ -48,7 +48,7 @@
* @brief Heap header file
*/
-#if CH_USE_HEAP || defined(__DOXYGEN__)
+#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
#define SIZE 16
@@ -156,7 +156,7 @@ ROMCONST struct testcase testheap1 = {
* @brief Test sequence for heap.
*/
ROMCONST struct testcase * ROMCONST patternheap[] = {
-#if CH_USE_HEAP || defined(__DOXYGEN__)
+#if (CH_USE_HEAP && !CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__)
&testheap1,
#endif
NULL