I am following this guide: https://www.renesas.com/us/en/document/apn/integrated-development-environment-e-studio-using-cmake-renesas-cc-rx-compiler?language=en to set up a very basic CCRX executable project in e2 Studio
The make files are built without error, but I face the following error when I type "make all":
E0562310:Undefined external symbol "__INITSCT" referenced in "CMakeFiles\CCRX_Project.dir\resetprg.c.obj"
Suprisigly, I didn't receive any error while compiling this with IDE, I immediately thought to replicate all the compiler and linker options from IDE into the CmakeLists.txt. None of was much use.
I have spent 2 days on this issue, the file is located in the CCrx\include folder in program files. It is also included in the CmakeLists.txt command.
The __InitSCT function is declared in _h_c_lib.h. I searched my whole computer but couldnt find the function body / definition. I couldnt find any source file either that uses this function, just the start up.
The function copes data section from ROM to RAM on start up. If any path is hidden in the IDE, please tell me as I am stuck with this for days.
I would also suggest that you update your documentation
I have an update. I request any Renesas expert who comments here to please give me a relevant answer. Nobody from renesas has replied to me yet
1) The CMake guide by Renesas in OP (original post) is invalid. There are many problems in it. I'll list them in the next points
2) The main problem is library generator. The e2 Studio library generator creates a .lib file with C standard libraries.
I found the symbol in the RX library (CC-RX\lib\rx600xx.lib), and it is also in the "bin\libsrc_C89.pak" file
There is no syntax provided by Renesas tutorial to include library generator in the CMake script. The Library generator (lbgrx.exe) in bin folder of Renesas toolchain.
3) I tried to use e2 Studio generated .lib file, add it to the -library options like this:
It detects it and proceeds to create .mot file.
Next I end up having these errors:
W0561012:Duplicate symbol/section specified in option "start" : "C"
W0561120:Section address is not assigned to "C$DSEC"
W0561120:Section address is not assigned to "C$BSEC"
W0561120:Section address is not assigned to "C$INIT"
W0561120:Section address is not assigned to "C$VECT"
W0561120:Section address is not assigned to "C$VTBL"
F0563100:Section address overflow out of range : "C$DSEC"
I found the reason of this error as well. The map file created trims out the first alphatbet after $ in the linker section. For example C$DSEC becomes CSEC
I'm attaching the .map file as well so you can view it.
If I edit the .lib file to change the section's name. It considers it as a corrupt library upon Linking, which it should. I cant change the section name within source code because this is being linked to C89.pak and other libraries as well. I cant change it
The professional solution should be to provide the library generator commands with CMake. That way I can change section name in source code since because of some reason it clips of the '$' sign. Notice that's why it says 'C' symbol is declared twice.
Please provide me with the correct solution and do not point me towards HEW or any other obsolete material. I just want the correct syntax of the library generator command, and possibly the fact that why is -list command stripping "$" input. This is mostly backend stuff and I can't do much about it.
I am attaching .map file and the Cmake generated make file as well.
This from build.make:
rlink -noprelink -library=F:/test_cmake_rx/HardwareDebug/test_cmake_rx.lib -start=SU,SI,B_1,R_1,B_2,R_2,B,R/04,PResetPRG,C_1,C_2,C,C$*,D*,W*,L,PIntPRG,P/0FFF80000,FIXEDVECT/0FFFFFF80
Becomes this in .map:
Once again, I request all the renesas experts to provide me with the correct solution. This seems like there has been a problem with renesas documentation and tutorial. Please make it a point and even it takes time it's alright at least we can know it's taking time.
We can notify our client of this as well. We are in development phase.
Thanks in advance for going through this lengthy post.
Ali, I can help with W0561012:Duplicate symbol/section specified in option "start" : "C" ...
You are using MAKE and the characters $* represent an automatic variable. In this case referring to part of your target file name. So this is expanding and damaging your start option. You need to escape the $. Here that gets done by doubling upo the $ like this
That should fix this for you.
Yes you are absolutely right.
I figured this out on my own two weeks ago when I got no reply from Renesas forum. Its strange that the support from Renesas is really awful.
Thanks a lot for your input though :)
Ali, yeah I had hoped that you resolved this on your own given the time. But I thought to post it for others that may search for help. I had just ran into this myself in setting up a project to compile our system outside of any IDE.
Support from all directions generally is "really awful".
I should have posted for others too. I got too busy..
Yes I agree with you but the support here has been really lacklustre