Repository navigation
arch/tricore: add tc3xx and tc4xx boot support - #21511
zhangyu981027 wants to merge 3 commits into
Conversation
In the current cmake build, all sources of arch will be added to libarch.a, which will cause a hidden problem: vector may be ignored by the linker. In the makefile, HEADSRC is a header link file independent of the static library, so there will be no such problem. In this patch, we also assign HEAD src in cmake directly to nuttx, so that it can directly participate in the link. Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
Support including nuttx/config.h and #if on CONFIG_* in tasking .asm sources by preprocessing them with ctc -E before assembly. 1. ctc -E runs as a pre-pass since the astc assembler has no C preprocessor of its own. 2. Comments in asm must not contain lone apostrophes since ctc -E reads them as unterminated C character constants. Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
Optimize the TriCore startup and organize it like other architectures such as arm64 (head.S + boot.c): 1. Write the startup in assembly (tricore_head.S for GNU and tricore_head.asm for TASKING). All cpus enter at the common __start. 2. CPU0 initializes .data/.bss and calls tricore_boot_primary(), which releases the other cores and enters nx_start(). Secondary cpus enter tricore_boot_secondary(). 3. Move the chip-specific watchdog and clock initialization to tricore_boot() of each chip. 4. Remove tricore_main.c and the per-core coreN_main() entries. 5. Update the TC4xx and TC397 linker scripts for the new startup. Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
|
| HEAD_CSRC += tricore_doirq.c | ||
|
|
||
| ifeq ($(CONFIG_ARCH_TOOLCHAIN_TASKING),y) | ||
| CMN_ASRCS += tricore_head.asm |
There was a problem hiding this comment.
With the TASKING toolchain and make, tricore_head.asm is never assembled: arch/tricore/src/Makefile maps only .S (AOBJS = $(ASRCS:.S=$(OBJEXT)) and the rule %$(OBJEXT): %.S), so make reports "doesn't match the target pattern" and __start is missing at link time. The Testing section lists CMake builds only.
Fix: make arch/tricore/src/Makefile use $(ASMEXT) for ASRCS and its rule (as #21496 does), and build the TASKING configs with make too.
|
|
||
| /* TriCore core special function register (CSFR) */ | ||
|
|
||
| #define CPU_PSW 0xFE04 /* Program Status Word */ |
There was a problem hiding this comment.
CPU_PSW, CPU_FCX and the other new CSFR defines repeat what arch/csfr.h (included by this header) already has as TRICORE_CPU_PSW and TRICORE_CPU_FCX.
Fix: add the missing offsets (CORE_ID, BIV, BTV, ISP, LCX, VCON0) to arch/csfr.h with the TRICORE_CPU_ prefix and use them.
ssekar15
left a comment
There was a problem hiding this comment.
@zhangyu-duck @xiaoxiang781216 avoid duplication and conflict of our initial work, here is split up for startup without iLLD #21546.
This startup optimization does not involve removing iLLD; rather, it aligns the approach with that of other architectures. |
As I mentioned earlier, if our initial PR had merged there is no needed of this PR. whole point is we already doing split of our PR and asked to wait untill.. these PR create unnecessary conflict and duplication, please wait until we finish. |
Regarding the removal of the |
Depends on #21509 and #21510. Please review the last commit only.
Summary
Rework the TriCore startup using the common
head.S/head.asmandboot.cstructure used by other architectures. CPU0 initializes.data/.bssand enters the primary boot path, while secondary CPUs enter the secondary boot path. Add TC3xx/TC4xx chip-specific boot hooks and update the board linker scripts for the new startup.The first two commits provide the CMake HEAD-source handling and TASKING assembly preprocessing required by the final boot commit.
Impact
TriCore TC3xx and TC4xx now use the NuttX assembly entry and boot flow instead of the previous per-core
coreN_main()startup. Both GNU and TASKING assembly entry paths and the corresponding linker scripts are supported. No interface changes are introduced for applications.Testing
Host: Ubuntu Linux, x86_64, CMake.
The following board/toolchain combinations were built, flashed, and tested over the serial console. Both
helloandostestpassed in all four configurations:a2g-tc397-5v-tft:nsh)a2g-tc397-5v-tft:nsh)triboard_tc4x9_com:nsh)triboard_tc4x9_com:nsh)Each run verified the serial
hellooutput and successful completion ofostest.All three commits also pass
tools/checkpatch.sh -c -u -m -g master..HEADandgit diff --check master..HEAD.