diff --git a/examples/kernel/SConscript b/examples/kernel/SConscript index be7eb48bed..1e7a057e4c 100644 --- a/examples/kernel/SConscript +++ b/examples/kernel/SConscript @@ -31,7 +31,8 @@ heap_malloc.c heap_realloc.c memp_simple.c """) +CPPDEFINES = ['RT_USING_TC'] -group = DefineGroup('examples', src, depend = ['']) +group = DefineGroup('examples', src, depend = [''], CPPDEFINES = CPPDEFINES) Return('group') diff --git a/examples/kernel/semaphore_buffer_worker.c b/examples/kernel/semaphore_buffer_worker.c index 96afb43dde..af5722547a 100644 --- a/examples/kernel/semaphore_buffer_worker.c +++ b/examples/kernel/semaphore_buffer_worker.c @@ -135,7 +135,7 @@ static rt_bool_t rb_get(struct rb* rb, rt_uint8_t *ptr, rt_uint16_t length) static void thread_entry(void* parameter) { rt_bool_t result; - rt_uint8_t data_buffer[BUFFER_ITEM]; + rt_uint8_t data_buffer[BUFFER_ITEM + 1]; while (1) { @@ -145,6 +145,7 @@ static void thread_entry(void* parameter) result = rb_get(&working_rb, &data_buffer[0], BUFFER_ITEM); /* 释放信号量 */ rt_sem_release(sem); + data_buffer[BUFFER_ITEM] = '\0'; if (result == RT_TRUE) {