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 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