Skip to content

arch/tricore: Optimize the trap/interrupt vectors.s codestyle and small improvment - #21951

Merged
GUIDINGLI merged 2 commits into
apache:masterfrom
zhangyu981027:tricore-trap
Nov 22, 2026
Merged

GUIDINGLI merged 2 commits into
apache:masterfrom
zhangyu981027:tricore-trap

Conversation

@zhangyu981027

@zhangyu981027 zhangyu981027 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Unify the TriCore trap and interrupt vector implementation across GCC and TASKING.

  • Move trap declarations into a shared header for use by other C files,
    and clean up comments and formatting.
  • Let users register the FCU CSA storage location instead of defining a
    fixed array in the trap implementation.
  • Record trap information without relying on the memory layout of the
    trap structure.
  • Simplify trap-flow handling in the common trap entry with switch-case.
  • One symbol for all cores

Impact

TriCore TC3xx and TC4xx trap and interrupt handling only.

Testing

  • Build: TC3xx TASKING: pass.
  • Build: TC4xx TASKING: pass.
  • Board test: TC4xx GCC, null-pointer write through hello: correct
    Internal Protection Error trap and null-address information.
tricore_trap_alert: PANIC!!! Internal Protection Error Trap:
tricore_trap_alert:     class 1 TID: 6
tricore_trap_alert:     Memory Protection Null Address
tricore_dump_trapctrl: DSTR:00080000      DEADD:00000000

@zhangyu981027 zhangyu981027 changed the title arch/tricore: remove iLLD dependency from irq.h arch/tricore: Optimize the trap/interrupt vectors.s codestyle and small improvment Nov 17, 2026
@github-actions github-actions Bot added Arch: tricore Issues related to the TriCore architecture from Infineon Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. Board: tricore labels Nov 17, 2026

@ssekar15 ssekar15 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we all agreed, I would request to retain your changes until the Native or iLLD PR gets merged, otherwise it creates unnecessary conflict problem and last PR especially breaks the compilation on master.

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

@zhangyu981027

Copy link
Copy Markdown
Contributor Author

As we all agreed, I would request to retain your changes the Native or iLLD PR gets merged, otherwise it creates unnecessary conflict problem and last PR especially breaks the compilation on master.

My understanding is that we should submit our work on a module-by-module basis. Since you have already merged the 'trap' and 'irq' modules, I will build upon that; if there are any further changes to these modules on your end, please submit them.

Given our limited time, we cannot wait for everything to be merged. As I see it, our respective changes are in different areas, so there shouldn't be many conflicts.

@ssekar15

Copy link
Copy Markdown
Contributor

As we all agreed, I would request to retain your changes the Native or iLLD PR gets merged, otherwise it creates unnecessary conflict problem and last PR especially breaks the compilation on master.

My understanding is that we should submit our work on a module-by-module basis. Since you have already merged the 'trap' and 'irq' modules, I will build upon that; if there are any further changes to these modules on your end, please submit them.

Given our limited time, we cannot wait for everything to be merged. As I see it, our respective changes are in different areas, so there shouldn't be many conflicts.

As long as the changes never conflicts we can move on, but changes are directly creates unnecessary conflicts on my PR and taking further delay.

cf4705a commit on this PR is duplicate effort of #21940, I reported the current upstream is broken (build failure) and created PR added you as review. Instead of review, the changes duplicated in this PR without any information of build failure or fixes on PR description.

GUIDINGLI
GUIDINGLI previously approved these changes Nov 17, 2026
@xiaoxiang781216

Copy link
Copy Markdown
Contributor

As we all agreed, I would request to retain your changes until the Native or iLLD PR gets merged, otherwise it creates unnecessary conflict problem and last PR especially breaks the compilation on master.

@ssekar15 could you move the patch which pass the review out of the huge pr? so, we can move fast.

@xiaoxiang781216

Copy link
Copy Markdown
Contributor

As we all agreed, I would request to retain your changes the Native or iLLD PR gets merged, otherwise it creates unnecessary conflict problem and last PR especially breaks the compilation on master.

My understanding is that we should submit our work on a module-by-module basis. Since you have already merged the 'trap' and 'irq' modules, I will build upon that; if there are any further changes to these modules on your end, please submit them.
Given our limited time, we cannot wait for everything to be merged. As I see it, our respective changes are in different areas, so there shouldn't be many conflicts.

As long as the changes never conflicts we can move on, but changes are directly creates unnecessary conflicts on my PR and taking further delay.

cf4705a commit on this PR is duplicate effort of #21940, I reported the current upstream is broken (build failure) and created PR added you as review. Instead of review, the changes duplicated in this PR without any information of build failure or fixes on PR description.

@zhangyu-duck please fix the conflict, cf4705a is merged.

@zhangyu981027

Copy link
Copy Markdown
Contributor Author

As we all agreed, I would request to retain your changes the Native or iLLD PR gets merged, otherwise it creates unnecessary conflict problem and last PR especially breaks the compilation on master.

My understanding is that we should submit our work on a module-by-module basis. Since you have already merged the 'trap' and 'irq' modules, I will build upon that; if there are any further changes to these modules on your end, please submit them.
Given our limited time, we cannot wait for everything to be merged. As I see it, our respective changes are in different areas, so there shouldn't be many conflicts.

As long as the changes never conflicts we can move on, but changes are directly creates unnecessary conflicts on my PR and taking further delay.
cf4705a commit on this PR is duplicate effort of #21940, I reported the current upstream is broken (build failure) and created PR added you as review. Instead of review, the changes duplicated in this PR without any information of build failure or fixes on PR description.

@zhangyu-duck please fix the conflict, cf4705a is merged.

done and rebase

@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@ssekar15 please review the patch again.

@ssekar15 ssekar15 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NACK. This kind of rework is creating serious of huge conflict and problem with current Nuttx support. Have you tested with current upstream base HEAD or all your test results are based on downstream tree?

AS:  common/tasking/tricore_vectors.asm
astc E301: ["common/tasking/tricore_vectors.asm" 32] unknown C preprocessor directive used
astc E301: ["common/tasking/tricore_vectors.asm" 33] unknown C preprocessor directive used
astc E139: ["common/tasking/tricore_vectors.asm" 117] cannot emit expression in object file, replaced with integral value '0'
make[1]: *** [Makefile:135: tricore_vectors.o] Error 1

tcpu = up_cpu_index() is 0 without ARCH_HAVE_MULTICPU (AMP): every core reports CPU0. Before, the entry read CORE_ID. Most of these changes are aligned with your downstream BMP instead of current NuttX.

Unnecessary changes :
Renames .intvec -> .inttable, tricore_int_vector -> tricore_inttab, tricore_trap_vectors_cpuN -> tricore_traptab; all four linker scripts touched, collides with #21546.

Implements the single trap table we deferred is in my TODO list as part of review comments from my PR which conflict the work.

@zhangyu981027

Copy link
Copy Markdown
Contributor Author

NACK. This kind of rework is creating serious of huge conflict and problem with current Nuttx support. Have you tested with current upstream base HEAD or all your test results are based on downstream tree?

AS:  common/tasking/tricore_vectors.asm
astc E301: ["common/tasking/tricore_vectors.asm" 32] unknown C preprocessor directive used
astc E301: ["common/tasking/tricore_vectors.asm" 33] unknown C preprocessor directive used
astc E139: ["common/tasking/tricore_vectors.asm" 117] cannot emit expression in object file, replaced with integral value '0'
make[1]: *** [Makefile:135: tricore_vectors.o] Error 1

tcpu = up_cpu_index() is 0 without ARCH_HAVE_MULTICPU (AMP): every core reports CPU0. Before, the entry read CORE_ID. Most of these changes are aligned with your downstream BMP instead of current NuttX.

Unnecessary changes : Renames .intvec -> .inttable, tricore_int_vector -> tricore_inttab, tricore_trap_vectors_cpuN -> tricore_traptab; all four linker scripts touched, collides with #21546.

Implements the single trap table we deferred is in my TODO list as part of review comments from my PR which conflict the work.

This objection is invalid. Reason 1: I have already addressed the multi-core issue—I will submit the relevant code later—but the current approach is certainly better than hardcoding it to 0.
2. Renaming intvec to inttable ensures consistency with traptable, which is an improvement.
3. Regarding the C preprocessor, I’ve already proposed merging this change, but you disagreed. As clearly stated in the PR description, I am making a concession here—I’ll wait for your preprocessor implementation.
4.

@zhangyu981027

Copy link
Copy Markdown
Contributor Author

NACK. This kind of rework is creating serious of huge conflict and problem with current Nuttx support. Have you tested with current upstream base HEAD or all your test results are based on downstream tree?

AS:  common/tasking/tricore_vectors.asm
astc E301: ["common/tasking/tricore_vectors.asm" 32] unknown C preprocessor directive used
astc E301: ["common/tasking/tricore_vectors.asm" 33] unknown C preprocessor directive used
astc E139: ["common/tasking/tricore_vectors.asm" 117] cannot emit expression in object file, replaced with integral value '0'
make[1]: *** [Makefile:135: tricore_vectors.o] Error 1

tcpu = up_cpu_index() is 0 without ARCH_HAVE_MULTICPU (AMP): every core reports CPU0. Before, the entry read CORE_ID. Most of these changes are aligned with your downstream BMP instead of current NuttX.

Unnecessary changes : Renames .intvec -> .inttable, tricore_int_vector -> tricore_inttab, tricore_trap_vectors_cpuN -> tricore_traptab; all four linker scripts touched, collides with #21546.

Implements the single trap table we deferred is in my TODO list as part of review comments from my PR which conflict the work.

#21510 what about merge this, but you disagree!

@ssekar15

Copy link
Copy Markdown
Contributor

tcpu = up_cpu_index() is 0 without ARCH_HAVE_MULTICPU (AMP): every core reports CPU0. Before, the entry read CORE_ID. Most of these changes are aligned with your downstream BMP instead of current NuttX.
Unnecessary changes : Renames .intvec -> .inttable, tricore_int_vector -> tricore_inttab, tricore_trap_vectors_cpuN -> tricore_traptab; all four linker scripts touched, collides with #21546.
Implements the single trap table we deferred is in my TODO list as part of review comments from my PR which conflict the work.

This objection is invalid. Reason 1: I have already addressed the multi-core issue—I will submit the relevant code later

exactly the problem is this PR doesn't mentioned anything about it dependency or build failure with current master.

  1. Renaming intvec to inttable ensures consistency with traptable, which is an improvement.

Never against the improvement, as I have been struggling with the basic cleanup PR series to be merge the improvement shall be later which directly conflicting. you proposed to speed up the review process so the split PR of our changes will get merged and you will work on top of it.

  1. Regarding the C preprocessor, I’ve already proposed merging this change, but you disagreed. As clearly stated in the PR description, I am making a concession here—I’ll wait for your preprocessor implementation.

#21510 what about merge this, but you disagree!

Because your PR is duplicated of our initial PR. Until yesterday this PR do have duplicate of my fix PR.

All these circle backs to one point where our PR is still floating and your new PR or duplicate PR work creates more and more conflict enough to delay further.

@zhangyu981027

zhangyu981027 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

NACK. This kind of rework is creating serious of huge conflict and problem with current Nuttx support. Have you tested with current upstream base HEAD or all your test results are based on downstream tree?

AS:  common/tasking/tricore_vectors.asm
astc E301: ["common/tasking/tricore_vectors.asm" 32] unknown C preprocessor directive used
astc E301: ["common/tasking/tricore_vectors.asm" 33] unknown C preprocessor directive used
astc E139: ["common/tasking/tricore_vectors.asm" 117] cannot emit expression in object file, replaced with integral value '0'
make[1]: *** [Makefile:135: tricore_vectors.o] Error 1

tcpu = up_cpu_index() is 0 without ARCH_HAVE_MULTICPU (AMP): every core reports CPU0. Before, the entry read CORE_ID. Most of these changes are aligned with your downstream BMP instead of current NuttX.
Unnecessary changes : Renames .intvec -> .inttable, tricore_int_vector -> tricore_inttab, tricore_trap_vectors_cpuN -> tricore_traptab; all four linker scripts touched, collides with #21546.
Implements the single trap table we deferred is in my TODO list as part of review comments from my PR which conflict the work.

#21510 what about merge this, but you disagree!

tcpu = up_cpu_index() is 0 without ARCH_HAVE_MULTICPU (AMP): every core reports CPU0. Before, the entry read CORE_ID. Most of these changes are aligned with your downstream BMP instead of current NuttX.
Unnecessary changes : Renames .intvec -> .inttable, tricore_int_vector -> tricore_inttab, tricore_trap_vectors_cpuN -> tricore_traptab; all four linker scripts touched, collides with #21546.
Implements the single trap table we deferred is in my TODO list as part of review comments from my PR which conflict the work.

This objection is invalid. Reason 1: I have already addressed the multi-core issue—I will submit the relevant code later

exactly the problem is this PR doesn't mentioned anything about it dependency or build failure with current master.

  1. Renaming intvec to inttable ensures consistency with traptable, which is an improvement.

Never against the improvement, as I have been struggling with the basic cleanup PR series to be merge the improvement shall be later which directly conflicting. you proposed to speed up the review process so the split PR of our changes will get merged and you will work on top of it.

  1. Regarding the C preprocessor, I’ve already proposed merging this change, but you disagreed. As clearly stated in the PR description, I am making a concession here—I’ll wait for your preprocessor implementation.

#21510 what about merge this, but you disagree!

Because your PR is duplicated of our initial PR. Until yesterday this PR do have duplicate of my fix PR.

All these circle backs to one point where our PR is still floating and your new PR or duplicate PR work creates more and more conflict enough to delay further.
where i disagree

In that case, please extract your C pre-processing logic and merge it separately. As for your objection to the PR regarding this trap, I don’t find it well-founded.

many pr waiting for push, please split your C pre-processing and i will rebase on your this pr

@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@ssekar15 do you have more comment?

zyfeier and others added 2 commits November 20, 2026 20:08
Read CORE_ID directly instead of using the iLLD helper. Clamp the
TC3xx core index to 5 to match IfxCpu_getCoreIndex().

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
Use a single trap vector table and a common register-based trap entry
for both toolchains. Move trap declarations into tricore_vectors.h and
let FCU recovery use a registered CSA pool.

Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
Co-Authored-By: Kimi <noreply@moonshot.cn>
@GUIDINGLI
GUIDINGLI merged commit 31bbc2f into apache:master Nov 22, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: tricore Issues related to the TriCore architecture from Infineon Board: tricore Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants