cpcitor / cpc-dev-tool-chain

A development toolchain to compile your modern C or assembly projects on a modern OS and run on an Amstrad CPC or emulator.
45 stars 5 forks source link

New CPCRSLib version changed building system #10

Open lronaldo opened 9 years ago

lronaldo commented 9 years ago

New version of CPCRSLib does not work with present cpc-dev-tool-chain makefiles.

It also introduces a problem (not a library problem, but a requirement for latest SDCC patches), as it uses new SDCC functionalities with bugs on SDCC 3.5.0. Namely __z88dk_callee and __z88dk_fastcall calling conventions have problems that are solved on latest commits (source code could be got from snapshot builds http://sourceforge.net/projects/sdcc/files/snapshot_builds/sdcc-src/) but not on 3.5.0.

cpcitor commented 9 years ago

Hello Francesco, Thank you for notifying of this incompatibility of the new version of CPCRSLib. This will help if anyone encounters the same problem. Fastcall and callee conventions from z88dk do have some speed benefits for very small functions. I'm happy to see it's made its way into SDCC. Do you recommend any simple action for now (or perhaps no action at all until upstream SDCC with fix gets released)?

lronaldo commented 9 years ago

Yes, callee and fastcall are a nice new feature. SDCC developers have had some small problems with some peepholes breaking generated assembly when using these new conventions, but they seem to be completely solved on recent commits.

CPCRSLib requires a new Makefile for building it (it comes with DOS/Windows batch files). Regarding SDCC's problems, I think the solution is using some more recent tarball including the fixes. Using 3.5.0. will show program crashes using CPCRSLib when these bugs come into place.

zx70 commented 7 years ago

I noticed that a problem is arising on cpcsrlib for the recent z88dk version, now able to deal with interrupts nicely. One of the tricks making it possible is the rom interposer. The correct way to call the ROM is now: EXTERN firmware call firmware defw rom_fn

Rather than a direct call to rom_fn.

cpcsrlib should have some function fixed not to crash, then the nice callee mode and sdcc can add mored magic..

cpcitor commented 7 years ago

@zx70 I'll look into what you write. Now addressing @lronaldo issue.

@lronaldo, I've updated the build procedure to cope with the new cpcrslib zip. I first looked at how you did it on https://github.com/lronaldo/cpctelera/blob/master/cpctelera/tools/scripts/cpct_installrslib . There you don't compile cpcwyzlib and examples, :-). It turned out to be complicated to fix regressions, because the new archive not only rearrange directories, but also lacks important source files, like Wyz.s. Also, several samples no longer compiled. Now, cpcwyzlib compiles again, along with all samples (not yet tested if they run). To avoid future problems, I forked cpcrslib/cpcwyzlib on a new URL: https://github.com/cpcitor/cpcrslib

Thanks again for your report! Feel free to comment!

lronaldo commented 7 years ago

Yes, you are right. My script does not compile examples, nor wyzlib. In fact, I would prefer to follow CPCtelera philosopy of integrating all sources to prevent problems with changing versions and repositories. It's more or less the same as the fork you produced of cpcrslib. However, I did it this way after according it with Raúl.

In any case, I much prefer your approach of forking, fixing, and leaving it in a stable status.

cpcitor commented 7 years ago

@zx70 Thank you for your comment. What you mean is not completely clear to me, for lack of some context.

I had a look at z88dk and see https://github.com/z88dk/z88dk/blob/master/libsrc/cpc/cpmfirmware.asm and https://github.com/z88dk/z88dk/blob/master/libsrc/cpc/firmware.asm which both define a firmware symbol.

I understand that it is about a ROM/firmware interposer. As z88dk/cpc_crt0.asm says:

; These subroutines make it possible to coexist with the firmware.

I'd be happy to do anything but I do not understand. What makes these steps necessary, compared with cpctelera, cpc-dev-tool-chain and plain development where it just works? What are you doing in the first place? Perhaps you're doing something super powerful but I lack some introductory knowledge.

I add a comment on https://github.com/z88dk/z88dk/pull/466 which mentions cpcrslib. As written there, please open an issue on Raúl's original project https://sourceforge.net/projects/cpcrslib/ or the portable, cleaned up version on https://github.com/cpcitor/cpcrslib .