Re: [cc65] Porting cc65 to embedded system that has no OS, boot ROM or monitor

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2004-09-23 23:49:32
On Thu, Sep 23, 2004 at 05:36:59PM -0400, Ormund Williams wrote:
> When I try to compile and link an empty main() the linker camplains:
>
> [ormund@station1 src]$ ld65 -C cc64.cfg cc64.o interrupts.o main.o \
> cc64.lib -m test.map -o test.bin
> ld65: Error: cc64.cfg(12): Range error
>
> Every thing up to this point has been smooth sailing, any ideas?

A segment cannot have a size attribute. The error is caused because the linker
tries to place the zeropage at $0 into the RAM, but because you did already
place other stuff into this memory area, $0 is already taken. To solve this,
the zeropage segment should go into its own RAM area. And I do assume that you
don't want to use the CPU stack at $100 to be used for your program. So the
following config would be better:

MEMORY {
    ZP: start = $0, size = $100, type = rw, define = yes;
    RAM: start = $200, size = $1E00, define = yes;
    NVRAM: start = $2000, size = $2000, define = yes;
    ROM: start = $8000, size = $8000, file = %O;
}
SEGMENTS {
    CODE:        load = ROM, type = ro;
    RODATA:      load = ROM, type = ro;
    VECTORS:     load = ROM, type = ro, start = $FFFA;
    DATA:        load = ROM, run = RAM, type = rw, define = yes;
    BSS:         load = RAM, type = bss, define = yes;
    ZEROPAGE:    load = ZP, type = zp, define = yes;
}
FEATURES {
    CONDES: segment = RODATA,
            type = constructor,
            label = __CONSTRUCTOR_TABLE__,
            count = __CONSTRUCTOR_COUNT__;
    CONDES: segment = RODATA,
            type = destructor,
            label = __DESTRUCTOR_TABLE__,
            count = __DESTRUCTOR_COUNT__;
}

Your startup file should either call the copydata subroutine to copy the data
from ROM to RAM or take some other measures to put the data in place.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Sep 23 23:49:37 2004

This archive was generated by hypermail 2.1.8 : 2004-09-23 23:49:46 CEST