How to add new cstartup file to the IAR RL78 IDE?

I'm using the RL78/D1 series microcontroller and IAR RL78 4.10.1 IDE. My project builds and works fine when I use the default cstartup file(in the IAR directory). But when I add my own cstartup file into my project (I copied the default cstartup file from the IAR directory to my project directory and add it to my project) and complie the project, I get the duplication definition error as follow:

. . .
Linking 
Error[Li006]: duplicate definitions for "@cend"; in "D:\General Basic Software\RL78\CICM16b1\Code\IAR\3- Workspace\Debug\Obj\cstartup.o", and "cstartup.o(dlrlfnf22n.a)" 
Error[Li006]: duplicate definitions for "@cstart"; in "D:\General Basic Software\RL78\CICM16b1\Code\IAR\3- Workspace\Debug\Obj\cstartup.o", and "cstartup.o(dlrlfnf22n.a)" 
Error[Li006]: duplicate definitions for "__INIT_WRKSEG"; in "D:\General Basic Software\RL78\CICM16b1\Code\IAR\3- Workspace\Debug\Obj\cstartup.o", and "cstartup.o(dlrlfnf22n.a)" 
Error[Li006]: duplicate definitions for "__iar_program_start"; in "D:\General Basic Software\RL78\CICM16b1\Code\IAR\3- Workspace\Debug\Obj\cstartup.o", and "cstartup.o(dlrlfnf22n.a)" 
Error[Li006]: duplicate definitions for "__program_end"; in "D:\General Basic Software\RL78\CICM16b1\Code\IAR\3- Workspace\Debug\Obj\cstartup.o", and "cstartup.o(dlrlfnf22n.a)" 
Error while running Linker 
. . .

I did what should I did as the IAR's help tells me, but the problem still exists.

Do you know how can I get rid of this problem?

Thanks

Parents
  • Hello Ebi!

    How's it going? I do hope our experts can respond to this soon. Have you already referred to this: https://www.renesas.com/us/en/document/apn/application-execution-ram-rl78?language=en ?

    I hope that would be helpful. All the best!

    Sai
    RenesasRulz Forum Moderator

    https://renesasrulz.com/
    https://academy.renesas.com/
    en-support.renesas.com/knowledgeBase 

  • Hello Sai,

    Was there ever any resolution to this issue? I am getting the same linker errors. 

    We have legacy code previously compiled on IAR v2.21.2 that we are attempting to move to v4.21.1. We were using a modified cstartup.s that we copied into our project directory and it was working fine in v2, but gives linker errors in v4.

    The document referenced did not directly address the linker errors; they seem to be a double-defined symbols in cstartup.s which makes me think we need to tell the IDE not to include the original, unaltered, cstartup.s file.

    Any thoughts?

    Thanks,

     Mark

  • Hello Mark,

    If you add a copy of the `cstartup.s` to your `.ewp`project, it should override the default one from the C Runtime Library.

    Please note that there were significant changes on the startup code from EWRL78 v3.10+, involving a section split between the reset vector (__iar_program_start) and the rest of the interrupt vector. When porting legacy code which uses custom runtime initialization, these differences must be taken into consideration.

    I'd suggest taking as basis the cstartup shipped with the product in use as starting point (`/path/to/rl78/src/lib/cstartup.s`), and then, apply required changes on top in the project's copy (e.g., $PROJ_DIR$/cstartup.s).

    Also, take into consideration that if the project has overridden the stock IAR ILINK linker configuration (`.icf`), it also must be updated using the same approach.

Reply
  • Hello Mark,

    If you add a copy of the `cstartup.s` to your `.ewp`project, it should override the default one from the C Runtime Library.

    Please note that there were significant changes on the startup code from EWRL78 v3.10+, involving a section split between the reset vector (__iar_program_start) and the rest of the interrupt vector. When porting legacy code which uses custom runtime initialization, these differences must be taken into consideration.

    I'd suggest taking as basis the cstartup shipped with the product in use as starting point (`/path/to/rl78/src/lib/cstartup.s`), and then, apply required changes on top in the project's copy (e.g., $PROJ_DIR$/cstartup.s).

    Also, take into consideration that if the project has overridden the stock IAR ILINK linker configuration (`.icf`), it also must be updated using the same approach.

Children
No Data