User forums > Embedded development

cc65 (6502/6510) toolchain for hobbyist retro work -- need help...

(1/5) > >>

DigitalMonk:
I'm loving C::B, particularly its code completion system, which I haven't really found anywhere else in a "choose your own toolchain" setting.  Many thanks for that, because I just can't code anymore without parameter and member prompting.

For some entirely silly reasons, I've decided to do some goofing around with cross compiling to the C64.  I'm trying to satisfy my teenage self, who always wanted to make a Car Wars game for his (my) C64, but didn't have the skills or tools for it.  25 years later, I've got both (I hope  :lol:)

So, there appear to be two approaches I could take to get cc65 running under C::B.

1. cc65 comes with a compile and link tool called cl65.  Usage looks roughly like:
        cl65 -g -Oi -Ln project.LBL -o project.PRG main.c another.c more.c stuff.c
I tried wedging that under the Tools menu with this command line:
        -g -Oi -Ln${TARGET_OUTPUT_DIR}\${TARGET_OUTPUT_BASENAME}.LBL -o
        ${TARGET_OUTPUT_DIR}\${TARGET_OUTPUT_BASENAME}.PRG ${ALL_PROJECT_FILES}
The problem is that it passed my .h files in as well, and cl65 doesn't know what to do with those.  Is there a variable that I can use to pull out all of the .C files?  I'm not sure how such a "variable" would be expressible in the generic case, but C and CPP files are common enough that I thought it might be special cased.

This is probably the easiest to get working, but the least slick.  If all else fails, I could manually modify the tool parameters whenever I added or removed a code file (I don't expect to write a lot of separate C64 apps).  But however I do it, I have to remember to save everything myself first (which I'm notoriously bad at), and it appears I need to go through the menu instead of having a hotkey.  But that may just be issues of my complete newbieness with C::B.

2. I could make a custom compiler toolchain.  This should be much slicker.  So I've gone down this path:
    Compiler settings / Other options: -g -Oi
    Linker settings / Other linker options: -t c64 -Ln ${exe_dir}\${exe_name}.LBL
    Search directories: compiler and linker pointed at my cc65\include and cc65\lib directories, respectively
    Toolchain executables:
        C compiler: cc65.exe
        Linker for dynamic (and static) libs: ld65.exe
        Debugger: x64.exe (from WinVICE -- a C64 emulator with monitor/debugger built in -- uses the .LBL file)
        Make program: none
        Additional Paths: the path to WinVICE so x64.exe can be found.
So I try to build with that and I get: "cc65.exe: Unknown option: -c" and it aborts.  I see where the problem comes in, by looking through the (English) manual and seeing how the variables are used for compilation:
"3.5  Compile single file
$compiler  $options  $includes  -c  $file  -o  $object"
That -c appears to be hardwired into C::B and not adjustable through any of the config settings.  Is that correct?

I suppose I could make a batch file or some simple console app that would shuffle arguments around and discard the -c, but that's a moderate headache if there's a simple fix that I'm just not seeing.  I say "shuffle arguments" because I think cc65 needs the input file to be the last argument in the list.

Any help would be appreciated.  Many thanks,
DM

stahta01:
Unless your Compiler is very much like an preexisting compiler setup you will need to write your own compiler code which is two files if I recall right.

The other option to get started quickly is to use an custom makefile option in C::B.

Tim S.

DigitalMonk:
Thank you Tim.  I suspect that the "unlike other compilers" is my problem.  Where could I find docs for writing my own compiler code?  Are these config files, or scripts, or some kind of compiled plugin?

Thanks!
DM

stahta01:

--- Quote from: DigitalMonk on May 13, 2010, 06:36:10 pm ---Thank you Tim.  I suspect that the "unlike other compilers" is my problem.  Where could I find docs for writing my own compiler code?  Are these config files, or scripts, or some kind of compiled plugin?

Thanks!
DM

--- End quote ---

Requires the knowledge and ability to compile Code::Blocks from SVN
In SVN Compiler plug-in folder you will find about two files for each compiler toolset find the simplest or closest and copy that one and rename the files.

Tim S.

Jenna:
What you can (should ?) try first is to copy the closest compiler (I guess it's GCC) and change some of the commands in "Settings -> Compiler and debugger... -> Other settings -> Advanced options... -> Commands"

Navigation

[0] Message Index

[#] Next page

Go to full version