Skip to content

Commit f7cfcc7

Browse files
wycwyhwyqLin-Chengqiu
authored andcommitted
[src] fix mutex bug
add RT_THREAD_CTRL_SET_PRIORITY add RT_THREAD_CTRL_SET_PRIORITY doxygen: cleanup and re-org files This patch contains two small changes, mainly to prepare for the next step of organizing the modules framework. The first change: move the files related to doxygen examples to `documentation/0.doxygen/example/` The second change: delete `documentation/0.doxygen/mainpage.h`, which is the mainpage of the old page. Now the new mainpage is `documentation/INDEX.md`, so the duplicate can be deleted. Signed-off-by: Chen Wang <[email protected]> [bsp/hpm5300evk]: 修复readme中的描述问题 (RT-Thread#10187) 1.bsp中描述路径boards不存在,只有board,并且路径中会包含openocd,把openocd路径去掉 2. 运行openocd发现cmsis-dap.cfg异常,使用ft2232.cfg可以正常烧入,修改readme 3. 添加download.bat脚本,方便下载 libcpu: aarch64: Fix NORMAL_NOCACHE_MEM attr (RT-Thread#10180) Signed-off-by: Cliff Chen <[email protected]> Signed-off-by: mouch6131 <[email protected]> Co-authored-by: Cliff Chen <[email protected]> Fixed an error by running scons --tartget=cmake under LINUX, RT-Thread#10113 (RT-Thread#10164) Fixed an error by running scons --tartget=cmake under LINUX, and associated issue RT-Thread#10113
1 parent 16f5856 commit f7cfcc7

File tree

19 files changed

+48
-57
lines changed

19 files changed

+48
-57
lines changed

bsp/hpmicro/hpm5300evk/README_zh.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@
7171

7272
- 通过如下命令完成下载:
7373
```console
74-
%OPENOCD_HPMICRO%\openocd.exe -f boards\debug_scripts\probes\cmsis_dap.cfg -f boards\debug_scripts\soc\hpm5300.cfg -f boards\debug_scripts\boards\hpm5300evk.cfg -c "init; halt; flash write_image erase rtthread.elf; reset; shutdown"
74+
%OPENOCD_HPMICRO%\openocd.exe -f board\debug_scripts\probes\ft2232.cfg -f board\debug_scripts\soc\hpm5300.cfg -f board\debug_scripts\boards\hpm5300evk.cfg -c "init; halt; flash write_image erase rtthread.elf; reset; shutdown"
7575
```
7676

7777
- 通过如下命令实现调试:
7878

7979
- 通过 `OpenOCD` 来连接开发板:
8080
```console
81-
%OPENOCD_HPMICRO%\openocd.exe -f boards\debug_scripts\probes\ft2232.cfg -f boards\debug_scripts\soc\hpm5300.cfg -f boards\debug_scripts\boards\hpm5300evk.cfg
81+
%OPENOCD_HPMICRO%\openocd.exe -f board\debug_scripts\probes\ft2232.cfg -f board\debug_scripts\soc\hpm5300.cfg -f board\debug_scripts\boards\hpm5300evk.cfg
8282
```
8383
- 通过 `GDB` 实现调试:
8484
```console

bsp/hpmicro/hpm5300evk/download.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
%OPENOCD_HPMICRO%\openocd.exe -f board\debug_scripts\probes\ft2232.cfg -f board\debug_scripts\soc\hpm5300.cfg -f board\debug_scripts\boards\hpm5300evk.cfg -c "init; halt; flash write_image erase rtthread.elf; reset; shutdown"

components/lwp/lwp_syscall.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,7 @@ sysret_t sys_setpriority(int which, id_t who, int prio)
16341634
for (list = lwp->t_grp.next; list != &lwp->t_grp; list = list->next)
16351635
{
16361636
thread = rt_list_entry(list, struct rt_thread, sibling);
1637-
rt_thread_control(thread, RT_THREAD_CTRL_CHANGE_PRIORITY, &prio);
1637+
rt_thread_control(thread, RT_THREAD_CTRL_RESET_PRIORITY, &prio);
16381638
}
16391639
lwp_pid_lock_release();
16401640
return 0;
@@ -8789,7 +8789,7 @@ sysret_t sys_sched_setparam(pid_t tid, void *param)
87898789

87908790
if (thread)
87918791
{
8792-
ret = rt_thread_control(thread, RT_THREAD_CTRL_CHANGE_PRIORITY, (void *)&sched_param->sched_priority);
8792+
ret = rt_thread_control(thread, RT_THREAD_CTRL_RESET_PRIORITY, (void *)&sched_param->sched_priority);
87938793
}
87948794

87958795
lwp_tid_dec_ref(thread);
@@ -8959,7 +8959,7 @@ sysret_t sys_sched_setscheduler(int tid, int policy, void *param)
89598959
}
89608960

89618961
thread = lwp_tid_get_thread_and_inc_ref(tid);
8962-
ret = rt_thread_control(thread, RT_THREAD_CTRL_CHANGE_PRIORITY, (void *)&sched_param->sched_priority);
8962+
ret = rt_thread_control(thread, RT_THREAD_CTRL_RESET_PRIORITY, (void *)&sched_param->sched_priority);
89638963
lwp_tid_dec_ref(thread);
89648964

89658965
kmem_put(sched_param);

documentation/0.doxygen/mainpage.h

Lines changed: 0 additions & 49 deletions
This file was deleted.

include/rtdef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ enum
643643
#define RT_THREAD_CTRL_CHANGE_PRIORITY 0x02 /**< Change thread priority. */
644644
#define RT_THREAD_CTRL_INFO 0x03 /**< Get thread information. */
645645
#define RT_THREAD_CTRL_BIND_CPU 0x04 /**< Set thread bind cpu. */
646+
#define RT_THREAD_CTRL_RESET_PRIORITY 0x05 /**< Reset thread priority. */
646647

647648
/**
648649
* CPU usage statistics data

include/rtsched.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ rt_err_t rt_sched_thread_close(struct rt_thread *thread);
129129
rt_err_t rt_sched_thread_ready(struct rt_thread *thread);
130130
rt_err_t rt_sched_thread_suspend(struct rt_thread *thread, rt_sched_lock_level_t level);
131131
rt_err_t rt_sched_thread_change_priority(struct rt_thread *thread, rt_uint8_t priority);
132+
rt_err_t rt_sched_thread_reset_priority(struct rt_thread *thread, rt_uint8_t priority);
132133
rt_err_t rt_sched_thread_bind_cpu(struct rt_thread *thread, int cpu);
133134
rt_uint8_t rt_sched_thread_is_suspended(struct rt_thread *thread);
134135
rt_err_t rt_sched_thread_timer_stop(struct rt_thread *thread);

libcpu/aarch64/common/mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ void rt_hw_mmu_setup(rt_aspace_t aspace, struct mem_desc *mdesc, int desc_nr)
474474
attr = MMU_MAP_K_RWCB;
475475
break;
476476
case NORMAL_NOCACHE_MEM:
477-
attr = MMU_MAP_K_RWCB;
477+
attr = MMU_MAP_K_RW;
478478
break;
479479
case DEVICE_MEM:
480480
attr = MMU_MAP_K_DEVICE;

src/scheduler_comm.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ rt_err_t rt_sched_tick_increase(rt_tick_t tick)
180180
/**
181181
* @brief Update priority of the target thread
182182
*/
183-
rt_err_t rt_sched_thread_change_priority(struct rt_thread *thread, rt_uint8_t priority)
183+
static rt_err_t _rt_sched_update_priority(struct rt_thread *thread, rt_uint8_t priority, rt_bool_t update_init_prio)
184184
{
185185
RT_ASSERT(priority < RT_THREAD_PRIORITY_MAX);
186186
RT_SCHED_DEBUG_IS_LOCKED;
@@ -192,6 +192,10 @@ rt_err_t rt_sched_thread_change_priority(struct rt_thread *thread, rt_uint8_t pr
192192
rt_sched_remove_thread(thread);
193193

194194
/* change thread priority */
195+
if (update_init_prio)
196+
{
197+
RT_SCHED_PRIV(thread).init_priority = priority;
198+
}
195199
RT_SCHED_PRIV(thread).current_priority = priority;
196200

197201
/* recalculate priority attribute */
@@ -209,6 +213,10 @@ rt_err_t rt_sched_thread_change_priority(struct rt_thread *thread, rt_uint8_t pr
209213
}
210214
else
211215
{
216+
if (update_init_prio)
217+
{
218+
RT_SCHED_PRIV(thread).init_priority = priority;
219+
}
212220
RT_SCHED_PRIV(thread).current_priority = priority;
213221

214222
/* recalculate priority attribute */
@@ -224,6 +232,22 @@ rt_err_t rt_sched_thread_change_priority(struct rt_thread *thread, rt_uint8_t pr
224232
return RT_EOK;
225233
}
226234

235+
/**
236+
* @brief Update priority of the target thread
237+
*/
238+
rt_err_t rt_sched_thread_change_priority(struct rt_thread *thread, rt_uint8_t priority)
239+
{
240+
return _rt_sched_update_priority(thread, priority, RT_FALSE);
241+
}
242+
243+
/**
244+
* @brief Reset priority of the target thread
245+
*/
246+
rt_err_t rt_sched_thread_reset_priority(struct rt_thread *thread, rt_uint8_t priority)
247+
{
248+
return _rt_sched_update_priority(thread, priority, RT_TRUE);
249+
}
250+
227251
#ifdef RT_USING_OVERFLOW_CHECK
228252
void rt_scheduler_stack_check(struct rt_thread *thread)
229253
{

src/thread.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,8 @@ RTM_EXPORT(rt_thread_mdelay);
779779
*
780780
* RT_THREAD_CTRL_BIND_CPU for bind the thread to a CPU.
781781
*
782+
* RT_THREAD_CTRL_RESET_PRIORITY for reset priority level of thread.
783+
*
782784
* @param arg is the argument of control command.
783785
*
784786
* @return Return the operation status. If the return value is RT_EOK, the function is successfully executed.
@@ -802,6 +804,16 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg)
802804
return error;
803805
}
804806

807+
case RT_THREAD_CTRL_RESET_PRIORITY:
808+
{
809+
rt_err_t error;
810+
rt_sched_lock_level_t slvl;
811+
rt_sched_lock(&slvl);
812+
error = rt_sched_thread_reset_priority(thread, *(rt_uint8_t *)arg);
813+
rt_sched_unlock(slvl);
814+
return error;
815+
}
816+
805817
case RT_THREAD_CTRL_STARTUP:
806818
{
807819
return rt_thread_startup(thread);

tools/cmake.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ def GenerateCFiles(env, project, project_name):
6464

6565
CFLAGS = env['CFLAGS'].replace('\\', "/").replace('\"', "\\\"")
6666
if 'CXXFLAGS' in dir(rtconfig):
67-
CXXFLAGS = env['CXXFLAGS'].replace('\\', "/").replace('\"', "\\\"")
67+
cflag_str=''.join(env['CXXFLAGS'])
68+
CXXFLAGS = cflag_str.replace('\\', "/").replace('\"', "\\\"")
6869
else:
6970
CXXFLAGS = CFLAGS
7071
AFLAGS = env['ASFLAGS'].replace('\\', "/").replace('\"', "\\\"")

0 commit comments

Comments
 (0)