[BUG] - The CCS_ARM_CR4 port jumps to address 0x3C starting tasks
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 30/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- c
調査の方向性
Start with the stack initialisation in portable/CCS/ARM_Cortex-R4/port.c around line 103, where the R14 slot is filled with 0x0, then read portRESTORE_CONTEXT in portable/CCS/ARM_Cortex-R4/portASM.asm near line 130 to see how LR is used. Done means the restore path reaches the task entry address on a CR4 target instead of jumping to 0x3C; the proposed pxOriginalTOS - 0x40 patch is untested and needs hardware verification.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
The task stack initialization function fills R14 backup with 0x0 and the context restoration routine jumps to R14+0x3C=0x3C. The context restoration routine should jump to the task address given during the task creation instead.
In ARM CORTEX R4, R14 is also the Link Register (LR) when in User Mode (source).
Target
- Development board: Whichever (based on TI's TMS570LS31xx)
- Instruction Set Architecture: ARMv7-R
- IDE and version: Code Composer Studio 12
- Toolchain and version: ti-cgt-arm_20.2.7.LTS
Host
- Host OS: Ubuntu
- Version: 24.04
To Reproduce
- Build any FreeRTOS project using the CCS_ARM_CR4 port
- Load on any CR4 target
- Add a breakpoint at 0x3C
- Run the program: it should hit the breakpoint.
Alternatively, set the breakpoint in the portRESTORE_CONTEXT routine and step until reaching the instruction "SUBS PC, LR, #4" (last instruction in the routine). The PC is just about to be loaded with 0x3C (the contents of LR/R14).
Suggested solution
I fixed it locally with the patch:
diff --git a/portable/CCS/ARM_Cortex-R4/port.c b/portable/CCS/ARM_Cortex-R4/port.c
index 64e96bbe7..43481c5ad 100644
--- a/portable/CCS/ARM_Cortex-R4/port.c
+++ b/portable/CCS/ARM_Cortex-R4/port.c
@@ -100,7 +100,7 @@ StackType_t *pxOriginalTOS;
*pxTopOfStack = ( StackType_t ) pxCode + portINSTRUCTION_SIZE;
pxTopOfStack--;
- *pxTopOfStack = ( StackType_t ) 0x00000000; /* R14 */
+ *pxTopOfStack = ( StackType_t ) pxOriginalTOS - 0x40; /* R14, LR */
pxTopOfStack--;
*pxTopOfStack = ( StackType_t ) pxOriginalTOS; /* Stack used when task starts goes in R13. */
pxTopOfStack--;
which fills R14 with the right address to jump (the task function address).
- 主要言語
- C
- スター
- 4.6k
- フォーク
- 1.6k
- 平均マージ
- 2日 22時間
- マージ済み PR(30日)
- 4
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
FreeRTOS/FreeRTOS-Kernel のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
FreeRTOS/FreeRTOS-Kernel#1542 ·
メンテナーはふだん 3 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
FreeRTOS/FreeRTOS-Kernel#1520 ·
メンテナーはふだん 3 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
FreeRTOS/FreeRTOS-Kernel#1494 · コメント 3 件 ·
メンテナーはふだん 3 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
FreeRTOS/FreeRTOS-Kernel#1554 ·
メンテナーはふだん 3 日以内に返信
-
[BUG] event_wait_timed can't return false対応中かも @TedLyngmo が 39 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 38/100
FreeRTOS/FreeRTOS-Kernel#1546 ·
メンテナーはふだん 3 日以内に返信
FreeRTOS/FreeRTOS-Kernel の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 63/100
FreeRTOS/FreeRTOS-Plus-TCP#1395 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
qoretechnologies/qore#8222 ·
メンテナーはふだん 1 日以内に返信
-
c easy first-contributor first-contributors good first issue help wanted up-for-grabs
難易度 1/5 1〜3時間 初心者へのやさしさ 96/100
fork-commit-merge/fork-commit-merge#8696 ·
メンテナーはふだん 1 日以内に返信