Can't get cogc files to compile.
Kye
Posts: 2,200
The linker can't seem to find the __load_start symbol for the cogc file. I'm trying to build the libadcACpropab.side library distributed with SimpleIde. I've been developing my own build system with CMake.
I compile the cogc file by doing:
propeller-elf-gcc -g -Os -ffunction-sections -fdata-sections -m32bit-doubles -Wall -std=c99 -mcog -r -xc -o filename.cogc.obj -c filename.cogc
propeller-elf-objcopy --localize-text --rename-section .text=filename.cogc.obj filename.cogc.obj
And then the file is archived and finally is linked with the main program that calls functions that need to start the cogc object.
I saw this simpleide issue about this: https://code.google.com/p/propside/issues/detail?id=184&colspec=ID%20Type%20Status%20Priority%20Owner%20Summary
However, I'm not sure how to fix the library code via the compile process without editing it. The library code does not do what the above link says to do.
... Any thoughts? I'm at a dead end on how to get this to work.
I compile the cogc file by doing:
propeller-elf-gcc -g -Os -ffunction-sections -fdata-sections -m32bit-doubles -Wall -std=c99 -mcog -r -xc -o filename.cogc.obj -c filename.cogc
propeller-elf-objcopy --localize-text --rename-section .text=filename.cogc.obj filename.cogc.obj
And then the file is archived and finally is linked with the main program that calls functions that need to start the cogc object.
I saw this simpleide issue about this: https://code.google.com/p/propside/issues/detail?id=184&colspec=ID%20Type%20Status%20Priority%20Owner%20Summary
However, I'm not sure how to fix the library code via the compile process without editing it. The library code does not do what the above link says to do.
... Any thoughts? I'm at a dead end on how to get this to work.
Comments
I have no idea really as I have not been building cog code since before there was a SimpleIDE and I believe things have changed since then.
I just built that library with SimpleIDE and notice that the way it does it is a bit different to what you are doing. See below.
The highlighted line shows the ".text" section is reamed to "filename.cog" not "filename.cog.obj"
There is something up with this. The build seems to work OK but something fails with propeller-load and then as you see the status report says ". Build Succeeded!". Simple IDE does pop up a build failed dialog which when clicked continues and ends with a "build done" in green as if everything was OK. Still that is nothing to do with the issue you have.
Looking into it...
propeller-elf-gcc.exe -Os -mcog -r -xc -o adcACpropab.cogc.obj -c adcACpropab.cogc
propeller-elf-objcopy.exe --localize-text --rename-section .text=".adcACpropab.cog" adcACpropab.cogc.obj
propeller-elf-ar.exe cr liblibadcACpropab.a adcACpropab.cogc otherthing1.c.obj otherthing2.c.obj
propeller-elf-gcc.exe -g -Os -m32bit-doubles -Wall -std=c99 -lm -mcmm mainFile.c.obj -o output.elf -Wl,--start-group liblibwavplayer.a liblibabvolts.a liblibadcACpropab.a liblibadcDCpropab.a liblibdacctr.a liblibvgatext.a liblibmstimer.a liblibservo.a liblibservoAux.a liblibservodiffdrive.a liblibsimplei2c.a liblibsirc.a liblibabcalibrate.a liblibabdrive.a liblibcolorpal.a liblibcompass3d.a liblibgps.a liblibmma7455.a liblibmx2125.a liblibping.a liblibrfidser.a liblibsoundimpact.a liblibfdserial.a liblibsimpletext.a liblibsimpletools.a liblibstacktest.a -Wl,--end-group
I've examined the output object and its section has been renamed to .adcACpropab.cog, however, the linking still fails. Maybe there is some magic that has to happening during the linking stage to get everything to work? The link I posted in the first posts says that the way the file that is looking for __load_start_adcACpropab_cog is coded that there is a problem.
I've attached the build output if that helps.
EDIT: Don't I need to copy the .data section to the output too?
The other way seems... eh...
It looks like ranlib is already run on each library after it is compiled... so that isn't the problem.
Using objcopy is a pain to work with in cmake. I'm trying to avoid doing what you have suggested because it will require an extremely long add_custom _command in cmake to make it happen (this is because objcopy requires you to invoke it from the directory from where the object is when generating the binary symbols the path is added to the file name. Spin file support was already complex enough...
SimpleIDE does put the .cog files into a library. I don't know why it doesn't have any problems.
...
Putting all .cogc.obj files into the final link command works perfectly. cmake will automatically put everything in a response file if the command line gets too long so there is no problem.