makefile ignoring flags set in oil.file

Forum related to ERIKA Enterprise and RT-Druid version 2

Moderator: paolo.gai

Post Reply
alben
Newbie
Posts: 2
Joined: Wed Oct 17, 2018 11:41 am

makefile ignoring flags set in oil.file

Post by alben » Wed Oct 17, 2018 3:07 pm

Hi,
I'm currently using a Tricore TC275 and ErikaOS on a project.
Needing shared variables, I used export files in the .oil file (according to http://erika.tuxfamily.org/wiki/index.p ... neon_Aurix) to access those variables on all cores:

excerpt of conf.oil file:

Code: Select all

CPU test_application {

  OS EE {
    REMOTENOTIFICATION = USE_RPC;

    CFLAGS ="-I../../../3rdParty/iLLD_Build/src";
    CFLAGS ="-I../../../3rdParty/iLLD_1_0_1_3_0/Src/BaseSw/Infra/Sfr/TC27D/_Reg";
    CFLAGS ="-I../../../3rdParty/iLLD_1_0_1_3_0/Src/BaseSw/Infra/Platform";
    CFLAGS ="-I../../../3rdParty/iLLD_1_0_1_3_0/Src/BaseSw/Service/CpuGeneric";
    CFLAGS ="-I../../../3rdParty/iLLD_1_0_1_3_0/Src/BaseSw/iLLD/TC27D/Tricore";
    CFLAGS ="-I../../../.";
    CFLAGS ="-I../../.";
    CFLAGS ="-fdata-sections -ffunction-sections";
    CFLAGS ="-O2";

    LDFLAGS ="-Wl,--gc-sections";
    LDFLAGS ="-L../../../3rdParty/iLLD_Build/lib";      
    LIBS ="-liLLD";

    EE_OPT = "EE_EXECUTE_FROM_RAM";
    EE_OPT = "EE_SAVE_TEMP_FILES";
    EE_OPT = "EE_ICACHE_ENABLED";
    EE_OPT = "EE_DCACHE_ENABLED";
    EE_OPT = "EE_TRIBOARD_TC2X5";

    //EE_OPT = "GPIO_SHIELDBUDDY";
    EE_OPT = "GPIO_TRIBOARD_TC275C";

    EE_OPT = "__TC27XX__";
    EE_OPT = "IFX_TC27x";
    EE_OPT = "ERIKA_OS";
    //EE_OPT = EE_BUILD_SINGLE_ELF;
    EE_OPT = VERBOSE;
    MASTER_CPU = "C0";

    CPU_DATA = TRICORE {
      ID = "C0";
      CPU_CLOCK = 200.0;
      APP_SRC = "master.c ./app_core_0.c ./app_event_table_core_0.c ./app_ccu_table_core_0.c ./app_db_core_0.c ./IO/GPIO/gpio.c ../ILM/src/ilm_core.c ../ILM/os/ilm_os_erika.c ../ILM/hw/ilm_hw_aurix.c ./ILM/cfg/ilm_hooks.c ";
      MULTI_STACK = TRUE;
      SYS_STACK_SIZE = 256;
      COMPILER_TYPE = GNU {
	EXPORT_FILE = "c0.exp";
      };
    };
    
    ...
But when doing so, the makefile ignores all LDFLAGS set in the oil file. Therefore, even though the library itself is loaded, the lookup path to that lib isn't, resulting in errors during the build process. Without using the export files the programm obviously does not work either, but the LDFLAGS are handled properly.

My current suspicion is, that there might be something wrong with the cc_tricore_gnu_new.mk makefile, since that's the one handling the export files. But due to a lack of experience with makefiles, I wasn't able to track the problem even further.

I would really appreciate every help possible :)

regards
Alex

e.guidieri
Full Member
Posts: 166
Joined: Tue May 10, 2011 2:05 pm

Re: makefile ignoring flags set in oil.file

Post by e.guidieri » Wed Oct 17, 2018 9:06 pm

Hi Alben,

I just checked the issue that you pointed, but I verified the LDFLAGS are correctly passed to linker, even with EE_BUILD_SINGLE_ELF.

You have to be aware that EE_BUILD_SINGLE_ELF is a little peculiar and the only real link that happens is the last one

and you should get a message like this at the end of the building (In bold LDFLGS added by me in OIL)

/cygdrive/c/HighTec/TOOLCH~1/tricore/V492~1.0//bin/tricore-gcc -T ee_tc27x_gnu_flash_recollect.ld -nostartfiles -mcpu=tc27xx -Wl,--gc-sections -Wl,--mem-holes -Wl,-warn-flags -Wl,-Map="tc27x_multicore.map" -Wl,--cref -fshort-double -Wl,--extmap="a" -L prova -o "tc27x_multicore.elf" master/myProject_master.elf slave1/myProject_slave1.elf slave2/myProject_slave2.elf

for me the problem is something else.

Moreover I want to inform you, if you didn't knew that, that the Multicore support for tc27x have been recently realesed even for the new ERIKA3.
ERIKA3 is still missing Memory Protection and Timing protection features (and they will miss for some time in the future).

The new ERIKA3 is nativelly multicore so just one elf in generate and one linkage is done, so you won't need to export shared symbols.

http://www.erika-enterprise.com
https://github.com/evidence/erika3

e.guidieri
Full Member
Posts: 166
Joined: Tue May 10, 2011 2:05 pm

Re: makefile ignoring flags set in oil.file

Post by e.guidieri » Wed Oct 17, 2018 9:29 pm

Update,

ok I found the problem. The problem is that ${LIBS} flags are passed even to the intermediate linkage of EE_BUILD_SINGLE_ELF.
This is not correct so we need to prevent this.

Unfortunatly you have to patch the file by hand

Open:
$ERIKA_FILES/pkg/cfg/arch/cc_tricore_gnu_new.mk
and add at line 361

Code: Select all

LIBS :=
before the makefile else

Code: Select all

else #  !__BASE_MAKEFILE__

Post Reply