(new c lib) -create-app added to compile options

New features and project activity between releases
Post Reply
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

(new c lib) -create-app added to compile options

Post by alvin »

-create-app is something that has always existed for classic c compiles. When added to the compile line, it invokes appmake with default parameters so that output binaries will be further processed to generate suitable output formats for the target. What this might mean is rather than stopping at a raw binary as output, tape file, disk file, ihx file or rom image might be generated from the binary output.

This functionality has been added to new c lib compiles as of the July 4 build.

The new c lib only has three supported targets so I'll just show example compiles for each target and describe what the create-app does.

1. cpm

(sdcc) zcc +cpm -vn -SO3 -clib=sdcc_iy --max-allocs-per-node200000 test.c -o test -create-app
(sccz80) zcc +cpm -vn -O3 -clib=new test.c -o test -create-app

create-app causes a com file to produced in addition to the output binary(-ies).

2. zx

(sdcc) zcc +zx -vn -SO3 -clib=sdcc_ix --reserve-regs-iy --max-allocs-per-node200000 test.c -o test -create-app
(sccz80) zcc +zx -vn -O3 -clib=new test.c -o test -create-app

create-app causes a tap file to be produced in addition to the output binary(-ies)

(sdcc) zcc +zx -vn -SO3 -startup=32 -clib=sdcc_ix --reserve-regs-iy --max-allocs-per-node200000 test.c -o test -create-app -subtype=if2
(sccz80) zcc +zx -vn -O3 -startup=32 -clib=new test.c -o test -create-app -subtype=if2

create-app causes a 16k .rom file to be generated which is the if2 cartridge image. This is designed for new c lib compiles with startup value >= 32. When startup >= 32, a crt written for if2 cartridges is used in the compile.

3. embedded

(sdcc) zcc +embedded -vn -SO3 -clib=sdcc_iy --max-allocs-per-node200000 test.c -o test -create-app
(sccz80) zcc +embedded -vn -O3 -clib=new test.c -o test -create-app

create-app causes a .bin or .rom file to be generated containing the complete binary to be loaded into a rom at the org address the compile uses. create-app will automatically take care of appending the data section if the rom model or compressed rom model is used.

(sdcc) zcc +embedded -vn -SO3 -clib=sdcc_iy --max-allocs-per-node200000 test.c -o test -create-app -Cz--romsize=0x4000
(sccz80) zcc +embedded -vn -O3 -clib=new test.c -o test -create-app -Cz--romsize=0x4000

create-app will create a 16k rom with the output binary inserted inside it at the correct org address. "-Cz" tells zcc to pass along the following parameter to appmake. You can see what other parameters are supported by entering "appmake +rom", "+rom" being the flavour of appmake invoked by create-app for the embedded target.

Here's another example compile that tweaks a few more appmake parameters.

(sdcc) zcc +embedded -vn -SO3 -clib=sdcc_iy --max-allocs-per-node200000 test.c -o test -create-app -Cz--romsize=0x4000 -Cz--rombase=0xc000 -Cz--filler=0 -Cz--ihex
(sccz80) zcc +embedded -vn -O3 -clib=new test.c -o test -create-app -Cz--romsize=0x4000 -Cz--rombase=0xc000 -Cz--filler=0 -Cz--ihex

create-app will create a 16k rom that is intended to be mapped to address 0xc000 in physical memory. The output binary must have on org inside the address range of the rom [0xc000,0xffff] in order to be successfully inserted into it. If the output binary can't be contained in the rom's address range, an error will be emitted. Other parameters change the fill byte used when creating the rom and --ihex is enabled so that an ihex file describing the output rom is also generated.

With these output rom images, "appmake +inject" can be used to insert more binary data into the rom image.


In all of the above, appmake will correctly take care of ram model, rom model and compressed rom model compiles. create-app will ignore other sections manually created in a project (eg, sections that may be added to hold code/data for memory banks outside the standard 64k space).


If you've created your own target, you can add -create-app behaviour by adding to z88dk/lib/config/TARGETNAME.cfg :

"-subtype=default" to the OPTIONS line
"SUBTYPE default -Cz+rom" to the bottom of the file.

You can see an example for the embedded target here:

http://z88dk.cvs.sourceforge.net/viewvc ... iew=markup

In this case, "appmake +rom" is chosen to process the output files for embedded. You can add other default "appmake +rom" parameters in the same SUBTYPE default line using "-Cz" to pass the parameter.
Post Reply