CPCWiki forum

General Category => Programming => Topic started by: Arnaud on 20:26, 13 October 15

Title: Cpctelera custom file build arguments
Post by: Arnaud on 20:26, 13 October 15
Hello,

i have got some memory space problem for my code and some solutions were provided in this post : Specify address for function and sdcc link question (http://www.cpcwiki.eu/forum/programming/specify-address-for-function-and-sdcc-link-question/)
But in order to implement a code banking i need to specify compilation and link arguments for a C file.

Is there a way to do that in the build_config.mk of Cpctelera ?

Example :
Code: [Select]
--codeseg UI_SEGMENT-c ui.c
-Wl -bSEGNAME=0x8000


Title: Re: Cpctelera custom file build arguments
Post by: ronaldo on 01:35, 14 October 15
Well, compiler options are all placed in this section
Code: [Select]
####
## SECTION 3: COMPILATION CONFIGURATION
##
##   Flags used to configure the compilation of your code. They are usually
##   fine for most of the projects, but you may change them for special uses.
#####
Z80CCFLAGS    :=
Z80ASMFLAGS   := -l -o -s
Z80CCINCLUDE  := -I$(CPCT_SRC)
Z80CCLINKARGS := -mz80 --no-std-crt0 -Wl-u \
                 --code-loc $(Z80CODELOC) \
                 --data-loc 0 -l$(CPCT_LIB)

Anyway, It is not clear for me what is your concrete problem. Your affirmation does not have sense for me: your code arriving to 0x4000 and reaching "data" and crashing... it has no sense. If you had data/code "colliding" at 0x4000, SDCC should have warned you on compilation about overlapping records.

Are you using CPCtelera (http://lronaldo.github.io/cpctelera)'s drawString/drawChar functions? If so, where are they placed in memory?
Title: Re: Cpctelera custom file build arguments
Post by: Arnaud on 23:09, 14 October 15
Hello,
to explain my problem, here the memory map i use :

0x138 -> 0x3FFF     : Code compiled
0x4000 -> 0x7FFF   : Data directly loaded at this address, i also use bank switching
0x8000 -> 0x9000  : Swap and temporary
0x9000-> 0xBFFF    : Free memory

When my code reaches the address 0x4000 it collides with the data i load.

I was looking to set functions at the specific address, and a solution was to set compilation arguments for the specific file (not the whole project) i want to set at 0x9000.

Are you using CPCtelera (http://lronaldo.github.io/cpctelera)'s drawString/drawChar functions? If so, where are they placed in memory?
I don't use these functions.

I hope it's clearer now  ::)