summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWang-Huachen <[email protected]>2020-11-30 12:48:23 +0800
committerWang-Huachen <[email protected]>2020-11-30 12:48:23 +0800
commitf7b553b193deb179e23843d759d20d83da4b85d3 (patch)
treeff949a536a962896aec25ff73e0abd874c84a6af /src
parent9756c77f0447f9ce4f00a37600298a1f1fd90cda (diff)
parentaf95348bf1dd06ed2147cf9caee8a78513c31a72 (diff)
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
Diffstat (limited to 'src')
-rw-r--r--src/Kconfig14
-rw-r--r--src/SConscript7
-rw-r--r--src/clock.c11
-rw-r--r--src/memheap.c4
-rw-r--r--src/object.c14
5 files changed, 22 insertions, 28 deletions
diff --git a/src/Kconfig b/src/Kconfig
index 63a7a67887..803c827e51 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -270,6 +270,18 @@ menu "Memory Management"
config RT_USING_MEMHEAP_AS_HEAP
bool "Use all of memheap objects as heap"
endif
+
+ config RT_USING_USERHEAP
+ bool "Use user heap"
+ help
+ If this option is selected, please implement these functions:
+ rt_malloc(), rt_malloc_sethook()
+ rt_free(), rt_free_sethook()
+ rt_calloc(), rt_realloc()
+ rt_system_heap_init()
+
+ And if FinSH is used at the same time, please implement list_mem()
+
endchoice
if RT_USING_SMALL_MEM
@@ -294,7 +306,7 @@ menu "Memory Management"
default y if RT_USING_SMALL_MEM
default y if RT_USING_SLAB
default y if RT_USING_MEMHEAP_AS_HEAP
-
+ default y if RT_USING_USERHEAP
endmenu
menu "Kernel Device Object"
diff --git a/src/SConscript b/src/SConscript
index 82c3b8aaf1..c3a7775d75 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -23,12 +23,17 @@ if GetDepend('RT_USING_MEMHEAP') == False:
if GetDepend('RT_USING_MEMHEAP_AS_HEAP'):
SrcRemove(src, ['mem.c'])
+if GetDepend('RT_USING_USERHEAP'):
+ SrcRemove(src, ['mem.c', 'slab.c'])
+
if GetDepend('RT_USING_DEVICE') == False:
SrcRemove(src, ['device.c'])
if GetDepend('RT_USING_SMP') == False:
SrcRemove(src, ['cpu.c'])
-group = DefineGroup('Kernel', src, depend = [''], CPPPATH = CPPPATH)
+CPPDEFINES = ['__RTTHREAD__']
+
+group = DefineGroup('Kernel', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
Return('group')
diff --git a/src/clock.c b/src/clock.c
index a91cd829b6..9fd276cf6f 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -25,17 +25,6 @@ static rt_tick_t rt_tick = 0;
#endif
/**
- * This function will initialize system tick and set it to zero.
- * @ingroup SystemInit
- *
- * @deprecated since 1.1.0, this function does not need to be invoked
- * in the system initialization.
- */
-void rt_system_tick_init(void)
-{
-}
-
-/**
* @addtogroup Clock
*/
diff --git a/src/memheap.c b/src/memheap.c
index aef56e1a74..0ff6925696 100644
--- a/src/memheap.c
+++ b/src/memheap.c
@@ -126,8 +126,8 @@ rt_err_t rt_memheap_detach(struct rt_memheap *heap)
RT_ASSERT(heap);
RT_ASSERT(rt_object_get_type(&heap->parent) == RT_Object_Class_MemHeap);
RT_ASSERT(rt_object_is_systemobject(&heap->parent));
-
- rt_object_detach(&(heap->lock.parent.parent));
+
+ rt_sem_detach(&heap->lock);
rt_object_detach(&(heap->parent));
/* Return a successful completion. */
diff --git a/src/object.c b/src/object.c
index 6866d805ca..56263618b3 100644
--- a/src/object.c
+++ b/src/object.c
@@ -192,18 +192,6 @@ void rt_object_put_sethook(void (*hook)(struct rt_object *object))
#endif
/**
- * @ingroup SystemInit
- *
- * This function will initialize system object management.
- *
- * @deprecated since 0.3.0, this function does not need to be invoked
- * in the system initialization.
- */
-void rt_system_object_init(void)
-{
-}
-
-/**
* @addtogroup KernelObject
*/
@@ -485,7 +473,7 @@ void rt_object_delete(rt_object_t object)
RT_OBJECT_HOOK_CALL(rt_object_detach_hook, (object));
/* reset object type */
- object->type = 0;
+ object->type = RT_Object_Class_Null;
/* lock interrupt */
temp = rt_hw_interrupt_disable();