-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[rt-link] fix the compiling issue under 64bit arch #11018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,7 +48,7 @@ | |
| #define RT_LINK_THREAD_NAME "rtlink" | ||
| #define RT_LINK_THREAD_TICK 20 | ||
| #define RT_LINK_THREAD_PRIORITY 25 | ||
| #define RT_LINK_THREAD_STACK_SIZE 1024 /* 32 bytes aligned */ | ||
| #define RT_LINK_THREAD_STACK_SIZE (4 * 1024) /* 32 bytes aligned */ | ||
|
|
||
| #define RT_LINK_FRAME_SENT 1 | ||
| #define RT_LINK_FRAME_NOSEND 0 | ||
|
|
@@ -905,8 +905,8 @@ static void rt_link_frame_recv_timeout(void) | |
|
|
||
| static void rt_link_send_timeout(void) | ||
| { | ||
| LOG_D("send count(%d)", (rt_uint32_t)rt_link_scb->sendtimer.parameter); | ||
| if ((rt_uint32_t)rt_link_scb->sendtimer.parameter >= 5) | ||
| LOG_D("send count(%d)", (rt_ubase_t)rt_link_scb->sendtimer.parameter); | ||
| if ((rt_ubase_t)rt_link_scb->sendtimer.parameter >= 5) | ||
| { | ||
| rt_timer_stop(&rt_link_scb->sendtimer); | ||
| LOG_W("Send timeout, please check the link status!"); | ||
|
|
@@ -929,7 +929,7 @@ static void rt_link_send_timeout(void) | |
|
|
||
| static void rt_link_long_recv_timeout(void) | ||
| { | ||
| if ((rt_uint32_t)rt_link_scb->longframetimer.parameter >= 5) | ||
| if ((rt_ubase_t)rt_link_scb->longframetimer.parameter >= 5) | ||
| { | ||
| LOG_W("long package receive timeout"); | ||
| rt_link_scb->longframetimer.parameter = 0x00; | ||
|
|
@@ -996,7 +996,7 @@ void rt_link_thread(void *parameter) | |
|
|
||
| static void rt_link_sendtimer_callback(void *parameter) | ||
| { | ||
| rt_uint32_t count = (rt_uint32_t)rt_link_scb->sendtimer.parameter + 1; | ||
| rt_ubase_t count = (rt_ubase_t)rt_link_scb->sendtimer.parameter + 1; | ||
| rt_link_scb->sendtimer.parameter = (void *)count; | ||
| rt_event_send(&rt_link_scb->event, RT_LINK_SEND_TIMEOUT_EVENT); | ||
| } | ||
|
|
@@ -1008,7 +1008,7 @@ static void rt_link_recvtimer_callback(void *parameter) | |
|
|
||
| static void rt_link_receive_long_frame_callback(void *parameter) | ||
| { | ||
| rt_uint32_t count = (rt_uint32_t)rt_link_scb->longframetimer.parameter + 1; | ||
| rt_ubase_t count = (rt_ubase_t)rt_link_scb->longframetimer.parameter + 1; | ||
| rt_link_scb->longframetimer.parameter = (void *)count; | ||
| rt_event_send(&rt_link_scb->event, RT_LINK_RECV_TIMEOUT_LONG_EVENT); | ||
| } | ||
|
|
@@ -1174,8 +1174,8 @@ MSH_CMD_EXPORT(rtlink_status, Display RTLINK status); | |
| * */ | ||
| rt_err_t rt_link_deinit(void) | ||
| { | ||
| rt_enter_critical(); | ||
| rt_link_hw_deinit(); | ||
| rt_enter_critical(); | ||
|
Comment on lines
1177
to
+1178
|
||
| if (rt_link_scb) | ||
| { | ||
| rt_timer_detach(&rt_link_scb->longframetimer); | ||
|
|
@@ -1235,6 +1235,13 @@ int rt_link_init(void) | |
| rt_slist_init(&rt_link_scb->tx_data_slist); | ||
| rt_link_scb->tx_seq = RT_LINK_INIT_FRAME_SEQENCE; | ||
|
|
||
| if (RT_EOK != rt_link_hw_init()) | ||
| { | ||
| LOG_E("rtlink hw init failed."); | ||
| result = -RT_ERROR; | ||
| goto __exit; | ||
| } | ||
|
|
||
| /* create rtlink core work thread */ | ||
| thread = rt_thread_create(RT_LINK_THREAD_NAME, | ||
| rt_link_thread, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Maintainability/可维护性] Stack size increase needs justification / 栈大小增加需要说明理由
English: The stack size is increased from 1024 to 4096 bytes (4x increase). While this may be necessary for 64-bit architectures due to larger pointer sizes and stack frame alignment requirements, the change lacks documentation explaining:
Consider adding a comment explaining the rationale, or using conditional compilation to set different stack sizes for 32-bit vs 64-bit architectures:
中文:栈大小从 1024 字节增加到 4096 字节(增加了 4 倍)。虽然这对于 64 位架构可能是必要的(由于更大的指针大小和栈帧对齐要求),但此更改缺少文档说明:
建议添加注释说明理由,或使用条件编译为 32 位和 64 位架构设置不同的栈大小(见示例代码)。