Trap table missing when building iLLD as library project

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User22281
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted

Dear Aurix experts,

I am using Aurix Development Studio v1.5.0 with Tasking tools for a TC36x microcontroller. To increase code reusability, I have moved the iLLD library (and other shared code of mine) from all my application projects into a single library project (File -> New -> Infineon -> New Aurix Library Project). Then I build the library and link all my applications to that library.

However, if I do that, the trap vector table is missing in the final application. The table is defined in file IfxCpu_Trap.c, function IfxCpu_Trap_vectorTable0(), and located in section traptab_cpu0. Final map file shows that the table is missing (zeroed), and the symbol IfxCpu_Trap_vectorTable0 is not included in the final application binary.

If I build and link the iLLD sources directly from the application project, then everything works fine. It looks like the section traptab_cpu0 is lost somewhere when building or linking the library.

I have tried __attribute__((used, protect)) and it makes no difference. The table is still discarded.

I have tried to obtain section information from the library file, but the support from the Tasking tools included in Aurix Studio is very limited (I really miss a tool like GNU objdump).

Any ideas?

Thank you very much in advance.

0 Likes
1 Solution
User13836
Level 6
Level 6
50 likes received 50 solutions authored 100 sign-ins

When the vector table symbol is not referred to in the application code and this symbol is located in a library, there is no reason to pull the section including the symbol from the library. Using __attribute__((used, protect)) with  the definition of function 

void IfxCpu_Trap_vectorTable0(void)

does not help when the function is located in a library. It does help when the function is located in an object file which is passed to the linker invocation, to prevent a removal of the function caused by the delete unreferenced sections linker optimization, when this function is not called at all.

You can consider to enforce an extern reference to that function by adding:

--extern=IfxCpu_Trap_vectorTable0

at the end of the 'Command line pattern' entry in menu:

C/C++ Build >> Settings >>TASKING Linker 

so this can look like:

${COMMAND} -lrt -lfp_fpu -lcs_fpu ${FLAGS} ${OUTPUT_FLAG}"${BuildArtifactFileBaseName}.elf" -Wl${OUTPUT_FLAG}"${BuildArtifactFileBaseName}.hex:IHEX" --lsl-core=vtc --lsl-file=../Lcf_Tasking_Tricore_Tc.lsl ${INPUTS} --extern=IfxCpu_Trap_vectorTable

Then the --extern option will be added to the linker invocation which forces the linker to pull that symbol from the library.

The commercial version of the TASKING TriCore tools does include a HLL dump tool (hldumptc.exe), to dump the content of an object file.

Best regards,
Ulrich Kloidt

TASKING tools support

 

View solution in original post

0 Likes
3 Replies
Nambi
Moderator
Moderator
Moderator
50 likes received 5 likes given 100 solutions authored

Hi,

1. Could you check if your "New Aurix Library Project" includes and compiles "IfxCpu_Trap.c" successfully?

2. Could you check if the pragma directives for Tasking compiler before IfxCpu_Trap_vectorTable0() function are effective?

3. Could you check how the traptab_cpu0 section is handled in the linker file and if it is available as a part of the map file?

Best Regards.

0 Likes
User13836
Level 6
Level 6
50 likes received 50 solutions authored 100 sign-ins

When the vector table symbol is not referred to in the application code and this symbol is located in a library, there is no reason to pull the section including the symbol from the library. Using __attribute__((used, protect)) with  the definition of function 

void IfxCpu_Trap_vectorTable0(void)

does not help when the function is located in a library. It does help when the function is located in an object file which is passed to the linker invocation, to prevent a removal of the function caused by the delete unreferenced sections linker optimization, when this function is not called at all.

You can consider to enforce an extern reference to that function by adding:

--extern=IfxCpu_Trap_vectorTable0

at the end of the 'Command line pattern' entry in menu:

C/C++ Build >> Settings >>TASKING Linker 

so this can look like:

${COMMAND} -lrt -lfp_fpu -lcs_fpu ${FLAGS} ${OUTPUT_FLAG}"${BuildArtifactFileBaseName}.elf" -Wl${OUTPUT_FLAG}"${BuildArtifactFileBaseName}.hex:IHEX" --lsl-core=vtc --lsl-file=../Lcf_Tasking_Tricore_Tc.lsl ${INPUTS} --extern=IfxCpu_Trap_vectorTable

Then the --extern option will be added to the linker invocation which forces the linker to pull that symbol from the library.

The commercial version of the TASKING TriCore tools does include a HLL dump tool (hldumptc.exe), to dump the content of an object file.

Best regards,
Ulrich Kloidt

TASKING tools support

 

0 Likes

Hello Ulrich,

Thank you very much for your support. Your solution works like a charm 🙂

BR

0 Likes