SCR example
This guide contains instructions for how to successfully compile the iLLD_TC49x_ADS_SCR_Blinky_LED_1 project using the HighTec LLVM toolchain version 9.1.1. It assumes that the project has been imported into the current workspace.
The following changes are required before the first project build attempt:
-
Wait until the indexer finishes.
-
Right-click on the project, then Project updater → Update iLLD → Finish.
-
Right-click on the project and click on Refresh.
-
Wait until the indexer finishes.
SCR SDCC build configuration
The following changes are required to build the SCR project with the SDCC toolchain:
-
Right-click on the project, then Build Configurations → Manage → New
-
Give any name.
-
Select the option Import predefined, then SCR Application → External → SDCC → Debug and click OK.
-
-
One by one, Right-click on the following directories, then Resource Configuration → Exclude from build → Select your build configuration and click OK (some may already have been disabled).
Configurations,Libraries
CPU0_Main.c,CPU1_Main.c,CPU2_Main.c,CPU3_Main.c,CPU4_Main.c,CPU5_Main.c
SCR_AURIX_TC4x.c -
Edit the build settings: right-click on the project Properties → C/C++ Build → Settings
-
SDCC Compiler
-
Update Command with the full compiler path to:
"C:\HighTec\toolchains\scr\v1.0.0/bin/scr-cc" -c -mtc4xx-scr --model-large -MMD -o "SCR/main.rel" -
Update Command Line pattern to:
${COMMAND} ${INPUTS}
-
-
SDCC Linker
-
Update Command with the full compiler path to:
"C:\HighTec\toolchains\scr\v1.0.0/bin/scr-cc" -mtc4xx-scr --model-large --xram-size 0x400 -o 'aurix_scr.ihx' ./SCR/main.rel -
Update Command Line pattern to:
${COMMAND}
-
-
Update SDCC Object copy
CArraycommand with the full compiler path to:
"C:\HighTec\toolchains\scr\v1.0.0/bin/scr-objcopy" -I ihex -O binary aurix_scr.ihx aurix_scr.bin-
Update Command Line pattern to:
${COMMAND}
-
-
-
Build the SCR project.
TriCore™ external LLVM build configuration
The following changes are required to Build the Tricore project part:
-
Right-click on the project, then Build Configurations → Manage → New
-
Give any name
-
Select the option Import predefined, then TriCore Application → External → LLVM → Debug and click OK.
-
-
Set the newly created configuration to active by clicking on Set Active.
-
Wait until the indexer finishes.
-
Edit the build settings: right-click on the project Properties → C/C++ Build → Settings
-
Click on Settings and Update Path to the
LLVMbin directory, i.e., "C:\HighTec\toolchains\tricore\v9.1.1\bin" and click on Apply. -
Under the options for LLVM C Compiler, click on "Miscellaneous" and add
-merrata=cpu141, click on Apply. -
Click on LLVM Linker, extend the command string with
-merrata=cpu141toclang -merrata=cpu141and click on Apply. -
Click on LLVM Linker → Miscellaneous → Add
-lhtcos. Then click on OK and Apply.
-
-
Right-click on the project, then Properties → AURIX Development Studio → AURIX Build Booster → Libraries paths → Delete /Libraries/iLLD if present and click on Apply and close.
-
Right-click on the project , then Properties → AURIX Development Studio → AURIX Build Booster → Ignore paths, add the following folders, and click on Apply and close.
-
/Libraries/iLLD/TC49A/ArcEV
/Libraries/iLLD/TC49A/Csrm
/Libraries/iLLD/TC49A/Scr
-
-
Right-click on the project, then Properties → C/C++ General → Paths and Symbols → Includes → GNU C, ensure that the Include paths do not contain
/Libraries/iLLD/TC49A/Scror its subdirectories, and click on Apply and close. -
One by one, Right-click on the following directories, then Resource Configuration → Exclude from build → Select your build configuration and click OK (some may already have been disabled).
-
/Libraries/iLLD/TC49A/ArcEV
/Libraries/iLLD/TC49A/Csrm
/Libraries/iLLD/TC49A/Scr
/SCR
-
-
Change the following code in Cpu0_Main.c:
From:if (PMS_SCR_CON0.B.SCREN == 0) { IfxPmsPm_MemoryConfig memCfg = {&scr_xram, PMS_XRAM, SIZE_scr_xram}; IfxPmsPm_initScr(IfxPmsPm_ScrBootMode_userMode, FALSE, &memCfg); }To:
#if defined(__HIGHTEC__) && defined(__clang__) /* ---------------------------------------------------------------------------------------------- * Include the binary file of the SCR program into the TriCore build *---------------------------------------------------------------------------------------------*/ extern const unsigned char _bin_file_start[]; extern const unsigned char _bin_file_end[]; __asm__( ".section \".rodata\", \"a\", @progbits\n" "_bin_file_start:\n" ".incbin \"../../iLLD_TC49x_ADS_SCR_Blinky_LED_1/Debug_SCR/aurix_scr.bin\"\n" "_bin_file_end:\n" ".previous\n" ); #endif if (PMS_SCR_CON0.B.SCREN == 0) { #if defined(__TASKING__) IfxPmsPm_MemoryConfig memCfg = {&scr_xram, PMS_XRAM, SIZE_scr_xram}; #elif defined(__HIGHTEC__) && defined(__clang__) IfxPmsPm_MemoryConfig memCfg = {(void*)&_bin_file_start, PMS_XRAM, (unsigned long int)((unsigned long int)_bin_file_end-(unsigned long int)_bin_file_start)}; #endif IfxPmsPm_initScr(IfxPmsPm_ScrBootMode_userMode, FALSE, &memCfg); }
Please note that the file path to aurix_scr.bin, referenced in the snippet above, needs to correspond to the name chosen for the SCR build configuration.
-
Build TriCore™ project.