Dear all:
I'am working on DS-5 Professional Edition: 5.28.1 wigth tool Arm Compiler6 DS-5 built-in.
Imported sample project startup_Cortex-R8. and modified main.c file with code like:
extern int g_TobeyTest;
void TobetTestFun(void)
{
g_TobeyTest = 0xffff;
while(1);
}
add option -flto for armclang; then add option -lto for armlink
but actually I don't invoke function TobetTestFun(), or use g_TobeyTest in the project.
AS i thought, with armclang -flto armlink --lto can help me remove symbol g_TobeyTest, but it doesn't work.
Can somebody help me solve it, thanks!!
================================================
below is project build log:
11:16:42 **** Build of configuration Debug for project startup_Cortex-R8 ****make all 'Building file: ../main.c''Invoking: Arm C Compiler 6'armclang --target=arm-arm-none-eabi -mcpu=cortex-r8 -O0 -w -flto -mthumb -MD -MP -c -o "main.o" "../main.c"'Finished building: ../main.c'' ''Building file: ../sorts.c''Invoking: Arm C Compiler 6'armclang --target=arm-arm-none-eabi -mcpu=cortex-r8 -O0 -w -flto -mthumb -MD -MP -c -o "sorts.o" "../sorts.c"'Finished building: ../sorts.c'' ''Building file: ../startup.s''Invoking: Arm Assembler 6'armclang --target=arm-arm-none-eabi -mcpu=cortex-r8 -marm -g -w -x assembler-with-cpp -c -o "startup.o" "../startup.s"'Finished building: ../startup.s'' ''Building target: ../startup_Cortex-R8.axf''Invoking: Arm Linker 6'armlink --entry=Start --scatter="M:\tobey\DS-5 Workspace\startup_Cortex-R8\VT3549_FW_MCU0.scat" --info=totals --info=inline --lto -o "../startup_Cortex-R8.axf" ./main.o ./sorts.o ./startup.o armclang.exe: warning: Your license for feature ulteval_armcompiler will expire in 14 days [-Wlicense-management]Error: L6218E: Undefined symbol g_TobeyTest (referred from main.o).Finished: 0 information, 0 warning and 1 error messages.
BR
TobeyTan
Hi Tobey,
The error in your code is the use of extern on the variable. If you remove it the code will build.
// don't put extern here: int g_TobeyTest; void TobetTestFun(void) { g_TobeyTest = 0xffff; while(1); }
You will see a message from the linker:
Removing main.o(.bss.g_TobeyTest), (4 bytes).
Thanks,
Jason