Author Topic: Cpctelera custom file build arguments  (Read 661 times)

0 Members and 1 Guest are viewing this topic.

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 689
  • Country: fr
  • Liked: 613
  • Likes Given: 1246
Cpctelera custom file build arguments
« 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
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



Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 648
  • Country: es
    • Profesor Retroman
  • Liked: 941
  • Likes Given: 827
Re: Cpctelera custom file build arguments
« Reply #1 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's drawString/drawChar functions? If so, where are they placed in memory?
« Last Edit: 01:37, 14 October 15 by ronaldo »

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 689
  • Country: fr
  • Liked: 613
  • Likes Given: 1246
Re: Cpctelera custom file build arguments
« Reply #2 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's drawString/drawChar functions? If so, where are they placed in memory?
I don't use these functions.

I hope it's clearer now  ::)