Page 2 of 2

Re: cc65 compiling

Posted: Sun Jun 10, 2018 8:47 am
by Banshaku
Included, the basic runtime that I'm using with 2.17. The other file (runtime.lst) list which files are included. I think I'm almost using the same thing as Shiru.

Once my makefile is finished, I will release it and you will be able to build the runtime anytime you want. For now I don't like that it uses a copy in a specific folder so I want to retrieve specifics files from the cc65 folder if the version gets updated some day.

That make file will even compile your project once a few specific files are set in the lib folder (neslib/famitone) and in the src folder (your c/s files and crt files). I want to make it so that even if you use a specific neslib/famitone/crt that it still can compile some generic project. It should help for people that want to start C like project (which I'm in the same situation right now).

Will share it soon, once I find it good enough. For now, I will try to help you figure out your current issues until it is available.

Re: cc65 compiling

Posted: Sun Jun 10, 2018 8:08 pm
by kennyp1369
Now that I switched to nes.lib, I'm getting a different error:

ld65 -C nes.cfg -o example1.nes crt0.o example1.o nes.lib
ld65: Error: Missing memory area assignment for segment `ONCE'

The only leads I have to follow are to search all the files for ONCE and try to
figure out what's going on with it.

I welcome any suggestions for finding some complete example code to start
working with and modifying

Re: cc65 compiling

Posted: Sun Jun 10, 2018 10:57 pm
by Banshaku
Like mentioned before, I’m working on making a sample Makefile that should make it easier to create simple c projects with the latest runtime.

I just finished an example based of Shiru’s example1.c and added some code to test famitone inside it.

It should be usable in it’s current state. Except for example.c and the cfg files, other files were not modified (crt0, neslib, famitone) since it would be a common cause of bugs if some file a refreshed with the current examples.

Librsc folder contains the latest files from cc65 (2.17) so it can be tested right away. You just call make from root folder and everything should be compiled. It is possible to compile/clean the runtime only when required.

The files may be removed at a later stage if there is some issues to include it in a personal project. It is possible to use the currently installed lbsrc on your computer by modifying the Makefile accordingly.

There is not much doc with it for now but I think the Makefile should be quite a time saver. It took me time to make it but I’m more than happy to share it if it can helps people use the latest runtime.

Since I had the same issues to make it work with the latest version, I understand how it feels when nothing compiles with no obvious reason why it failed and you don’t know yet the tool chain.

It’s a work in progress but any comments on possible issues is always appreciated.

Re: cc65 compiling

Posted: Mon Jun 11, 2018 7:21 am
by dougeff
Copied from a .cfg file that I use...notice the 'ONCE' segment.


SEGMENTS {
HEADER: load = HEADER, type = ro;
STARTUP: load = PRG, type = ro, define = yes;
LOWCODE: load = PRG, type = ro, optional = yes;
INIT: load = PRG, type = ro, define = yes, optional = yes;
CODE: load = PRG, type = ro, define = yes;
RODATA: load = PRG, type = ro, define = yes;
DATA: load = PRG, run = RAM, type = rw, define = yes;
CHARS: load = CHR, type = rw;
BSS: load = RAM, type = bss, define = yes;
HEAP: load = RAM, type = bss, optional = yes;
ZEROPAGE: load = ZP, type = zp;
ONCE: load = PRG, type = ro, define = yes;

VECTORS: load = PRG, start = $fffa, type = ro;
}



you could also write it as...

ONCE: load = PRG, type = ro, define = yes, optional = yes;

Re: cc65 compiling

Posted: Mon Jun 11, 2018 7:46 am
by Banshaku
The once segment is something they added around 2.14 and is now mandatory if my memory is good. Since Shiru's example where done with 2.11, this segment was not defined in the examples.

edit:

this segment is used for constructors. Since I do not define any, this segment is not in any file and should cause no issue. It just the config file that seems to nags you if you don't define it.

edit2:

@dougeff

Since you did some C tutorials, I would like to know if you think the make file I did is useful for beginners or not. I think it is since you just create you files (.s or .c) in src and it will compile them automatically.

Re: cc65 compiling

Posted: Mon Jun 11, 2018 7:56 am
by kennyp1369
It compiled. Thanks everyone. I can start figuring out how to make changes now.

Re: cc65 compiling

Posted: Mon Jun 11, 2018 10:29 am
by dougeff
Since you did some C tutorials, I would like to know if you think the make file I did is useful for beginners or not. I think it is since you just create you files (.s or .c) in src and it will compile them automatically.
I think it will be useful. Yes. I'm always thinking about changing my tutorial, so it is good for me to see other people write source code.

Maybe one day I should collaborate with you or na_th_an or cppchriscpp to write some better example code.