use OSDK under Linux ?

Questions, bug reports, features requests, ... about the Oric Software Development Kit. Please indicate clearly in the title the related element (OSDK for generic questions, PictConv, FilePack, XA, Euphoric, etc...) to make it easy to locate messages.

User avatar
iss
Wing Commander
Posts: 1637
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: use OSDK under Linux ?

Post by iss »

Congrats from me too! :)

@xahmol: And to take your Makefile to a whole new level here is a small kick-start how to run your compiled project in Oricutron with auto-load of symbols and break-points for debugging:

Code: Select all

# # # Name your project
PROJECT      := LUDO
PROJECT_DIR  := $(shell pwd)

# # # Project targets
TAP          := BUILD/$(PROJECT).tap
DSK          := BUILD/$(PROJECT).dsk

# # # Edit to point to your Oricutron directory
EMUL_DIR := ~/where/is/Oricutron

# # # Use MACH to override the default and run as:
# # # make run-tap MACH=-ma for Atmos (default)
# # # make run-tap MACH=-m1 for Oric-1
# # # make run-tap MACH=-mo16k for Oric-1 / 16K
# # # make run-tap MACH=-mp for Pravetz-8D
# # # make run-tap MACH=-mt for Telestrat
MACH := -ma

# # #
EMU                     := ./oricutron
EMUDIR                  := $(EMUL_DIR)
EMUARG                  := $(MACH)

# # # (un)comment, add, remove more Oricutron cmd-line options
EMUARG                  += --serial none
EMUARG                  += --vsynchack off
EMUARG                  += --turbotape on

# append symbols and breakpoints
# read more at DF-forum:
# https://forum.defence-force.org/viewtopic.php?p=15145#p15145
EMUARG                  += -s $(PROJECT_DIR)/$(PROJECT).sym
EMUARG                  += -r :$(PROJECT_DIR)/$(PROJECT).brk


# # #
.PHONY: run-tap run-dsk

# # # Run with produced TAP file
run-tap: $(TAP)
        @([ -e $(PROJECT).brk ] || touch $(PROJECT).brk) || echo -n
	@cd $(EMUDIR) && $(EMU) $(EMUARG) $(PROJECT_DIR)/$<

# # # Run with produced DSK file
run-dsk: $(DSK)
        @([ -e $(PROJECT).brk ] || touch $(PROJECT).brk) || echo -n
	@cd $(EMUDIR) && $(EMU) $(EMUARG) $(PROJECT_DIR)/$<
Usage: make run-tap or make run-dsk
This is just a snipped but you will figure out what to do with it ;).
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: use OSDK under Linux ?

Post by xahmol »

Thanks again Iss!

With your pointers, adapted the make file to execute the disk in emulator using make run. And did some further variable optimizations.

Added make run-debug as well, seems to work, but really have to delve into how to create the necessary files from the CC65 compiler. Never used this type of debugging before, did debugging so far with temporarily add print statements for variables I want to follow in the source code.
Did look at https://cc65.github.io/doc/debugging.html , but using the -g flag on the compiler breaks actually on my conversion to CC65 of your libsedoric.s code from oricOpenLibrary (and did add the .debuginfo on flag). So I am obviously doing something wrong there to create proper debug info as I get these errors on adding -g flag to the compiler (errors disappear on removing the -g flag):

Code: Select all

src/main.s:57: Error: Assembler symbol '_sed_savefile' not found
src/main.s:58: Error: Assembler symbol '_sed_loadfile' not found
But for the rest it works great and happy to be able to simple execute in Oricutron using make run.

(did not add run-tap as my projects won run from .tap anyway as it loads screens, charsets and music).

Adapted makefile:

Code: Select all

# L U D O
# Written in 1992,2020, 2021 by Xander Mol

# https://github.com/xahmol/ludo
# https://www.idreamtin8bits.com/

# Originally written in 1992 in Commodore BASIC 7.0 for the Commodore 128
# Rewritten for Oric Atmos in BASIC in 2020
# Rewritten for Oric Atmos in C using CC65 in 2021

# For full credits: see src/main.c

# Thanks to Iss for pointers for this Makefile:
# https://forum.defence-force.org/viewtopic.php?p=25411#p25411

## Paths
# Path tp OSDK install. Edit for local dir
# Installation instructions for Linux: #https://forum.defence-force.org/viewtopic.php?p=25396#p25396
OSDK := /home/xahmol/OSDK-build/pc/tools/osdk/main/osdk-linux/bin/
# Path tp HxC Floppy Emulator command line tool: edit for local dir
# SVN repository: svn checkout https://svn.code.sf.net/p/hxcfloppyemu/code/ hxcfloppyemu-code
# Build with  HxCFloppyEmulator/build/make 
HXCFE := /home/xahmol/retro/oric/hxcfloppyemu-code/HxCFloppyEmulator/HxCFloppyEmulator_cmdline/trunk/build/
# Emulator path: edit for location of emulator to use
EMUL_DIR := /home/xahmol/retro/oric/oricutron/

## Project name
PROJECT      := LUDO
PROJECT_DIR  := $(shell pwd)
PROGRAM      := BUILD/$(PROJECT).bin
TESTPROG     := SAVETEST
TESTPROG_BIN := BUILD/$(TESTPROG).bin
DISK_DSK     := BUILD/$(PROJECT).dsk
DISK_HFE     := BUILD/$(PROJECT).hfe

## Tooling arguments variables
# Arguments for YM to MYM music conversion tool
YM2MYM = $(OSDK)Ym2Mym -h1 -m8192
# Arguments for emulator
# # # Use MACH to override the default and run as:
# # # make run-tap MACH=-ma for Atmos (default)
# # # make run-tap MACH=-m1 for Oric-1
# # # make run-tap MACH=-mo16k for Oric-1 / 16K
# # # make run-tap MACH=-mp for Pravetz-8D
# # # make run-tap MACH=-mt for Telestrat
MACH := -ma
EMU                     := ./oricutron
EMUDIR                  := $(EMUL_DIR)
EMUARG                  := $(MACH)
# # # (un)comment, add, remove more Oricutron cmd-line options
EMUARG                  += --serial none
EMUARG                  += --vsynchack off
EMUARG                  += --turbotape on
# append symbols and breakpoints
# read more at DF-forum:
# https://forum.defence-force.org/viewtopic.php?p=15145#p15145
EMUARG_DEBUG            := $(EMUARG) -s "$(PROJECT_DIR)/$(PROJECT).sym"
EMUARG_DEBUG            +=  -r :"$(PROJECT_DIR)/$(PROJECT).brk"

## C Sources and library objects to use
SOURCES = src/main.c
LIBOBJECTS = include/libsedoric-ca65.s include/MYM.s include/ijkdriver-ca65.s

TESTSOURCES = src/savetest.c
TESTOBJECTS = include/libsedoric-ca65.s

## Compiler and linker flags
CC65_TARGET = atmos
CC = cl65
CFLAGS  = -t $(CC65_TARGET) --create-dep $(<:.c=.d) -Oirs -I include
LDFLAGS = -t $(CC65_TARGET) -m $(PROJECT).map
LDFLAGSTEST = -t $(CC65_TARGET) -m $(TESTPROG).map

########################################

.SUFFIXES:
.PHONY: all clean run run-debug
all: $(PROGRAM) $(TESTPROG_BIN) $(DISK_DSK)

ifneq ($(MAKECMDGOALS),clean)
-include $(SOURCES:.c=.d) $(SOURCESUPD:.c=.d)
endif

# Compile C sources
%.o: %.c
	$(CC) -c $(CFLAGS) -o $@ $<

# Link compiled objects 
$(PROGRAM): $(SOURCES:.c=.o)
	$(CC) $(LDFLAGS) -o $@ $^ $(LIBOBJECTS)

$(TESTPROG_BIN): $(TESTSOURCES:.c=.o)
	$(CC) $(LDFLAGSTEST) -o $@ $^ $(TESTOBJECTS)

# Build disk
$(DISK_DSK): $(PROGRAM) $(TESTPROG_BIN)
	$(OSDK)header $(PROGRAM) BUILD/$(PROJECT)MAIN.tap 0x0501
	$(OSDK)header $(TESTPROG_BIN) BUILD/$(TESTPROG).tap 0x0501
	$(OSDK)header data/$(PROJECT)DATA.bin BUILD/$(PROJECT)DATA.tap 0xb000
	$(YM2MYM) "music/R-Type  2 - level 1.ym" BUILD/R-Type.tap		0x7e00 "$(PROJECT)MUS1"
	$(YM2MYM) "music/Wizball 1.ym" BUILD/Wizzball.tap               0x7e00 "$(PROJECT)MUS2"
	$(YM2MYM) "music/Defender of the Crown 1.ym" BUILD/Defender.tap 0x7e00 "$(PROJECT)MUS3"
	$(OSDK)tap2dsk -iCLS:$(PROJECT)MAIN -c20:3 -n$(PROJECT) BUILD/$(PROJECT)MAIN.tap BUILD/$(TESTPROG).tap screen/$(PROJECT)TITL.tap screen/$(PROJECT)SCRM.tap BUILD/$(PROJECT)DATA.tap BUILD/R-Type.tap BUILD/Defender.tap BUILD/Wizzball.tap $(DISK_DSK)
	$(OSDK)old2mfm $(DISK_DSK)
	cd $(HXCFE); hxcfe -finput:"$(WORKDIR)/$(DISK_DSK)" -foutput:"$(WORKDIR)/$(DISK_HFE)" -conv:HXC_HFE

# Clean old builds and objects
clean:
	$(RM) $(SOURCES:.c=.o) $(SOURCES:.c=.d) $(TESTSOURCES:.c=.o) $(TESTSOURCES:.c=.d) $(PROGRAM) $(PROGRAM).map $(PROGRAM).brk $(PROGRAM).sym $(TESTPROG) $(TESTPROG).map
	cd BUILD; $(RM) *.*

# Execute in emulator in debug mode: use make run-debug
run-debug: $(DISK_DSK)
	@([ -e $(PROJECT).brk ] || touch $(PROJECT).brk) || echo -n
	cd $(EMUDIR); $(EMU) $(EMUARG_DEBUG) "$(PROJECT_DIR)/$(DISK_DSK)"

run: $(DISK_DSK)
	cd $(EMUDIR); $(EMU) $(EMUARG) "$(PROJECT_DIR)/$(DISK_DSK)"

User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: use OSDK under Linux ?

Post by xahmol »

After finishing some Commodore projects, planning to revisit doing some coding for the Oric again.

Meanwhile, mainly use Linux under Windows 11 for my build chains using Ubuntu via Windows Subsystem for Linux 2 (WSL2) under Windows 11. Works great, even for GUI applications. Can now run both the Windows version as the Linux SDL2 version of Oricutron at the same time in two windows next to each other.

Have CC65, HxE Floppy Emulation tools and Oricutrion SDL2 working perfectly under this WSL2 environment now.

But for some reason I can not get the OSDK tools for Linux to build under Ubuntu/WSL2. Did anything change in the repo to break building under Linux? or do I miss another package I forgot to install?
The make file for the OSDK for Linux tools break with this message:

Code: Select all

sources/TapTool.cpp:238:5: error: ‘gets_s’ was not declared in this scope; did you mean ‘gets’?
  238 |     gets_s(reply,sizeof(reply));
      |     ^~~~~~
      |     gets
make[1]: *** [<builtin>: sources/TapTool.o] Error 1
make[1]: Leaving directory '/home/xahmol/OSDK-build/pc/tools/osdk/main/TapTool'
make: *** [Makefile:11: clean] Error 2
Can of course quick fix this by just copying he Linux compiled binaries from my pure Linux desktop where I previously did manage to build them, but would prefer to be able to also freshly build them under Ubuntu/WSL2.

Amy thoughts?

(funny, I now see my post before this was almost exactly one year ago. Time files)
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: use OSDK under Linux ?

Post by Dbug »

Both Tap2CD and TapTool have get_s, but one is .C and the other one .CPP.
Looks like get_s only exists in C (since C11) but not in C++, possibly that's the issue.

If Tap2CD works, I guess the best is that you remove TapTool from the makefile, that was a project I had started to mix Tap2Wav and Tap2CD in a single application, because it makes no sense to me to have many programs doing what is technically the same thing (convert an emulator file format into something you can use on a real Oric), but I never really quite worked on it other than making the project.

Imo, ideally we should have a tool that can do:
  • Tap2Wav
  • Tap2CD
  • All of Symoon fast loaders
in one single program with some flags to select different modes depending of the use context.
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: use OSDK under Linux ?

Post by xahmol »

Well, if I remove TapTools from the makefile it breaks on Tap2CD also:

Code: Select all

sources/tap2cd.c:330:5: warning: implicit declaration of function ‘gets_s’ [-Wimplicit-function-declaration]
  330 |     gets_s(reply,sizeof(reply));
      |     ^~~~~~
cc   sources/tap2cd.o  -L ../common -lcommon -lcurses -lstdc++ -o tap2cd
/usr/bin/ld: sources/tap2cd.o: in function `ask_name':
tap2cd.c:(.text+0x9f4): undefined reference to `gets_s'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:17: tap2cd] Error 1
If I delete Tap2CD as well, everything builds. But than i miss the 'header' tool in the compiled Linux binaries.
tap2dsk, Ym2Mym and old2mfm, which are the other tools I use in my buildchain makefile do compile properly.

Is it correct that 'header' is part of either TapTools or Tap2CD?
Honestly, the other TAP tools I probably will never use, so really only miss 'header'.
(allthough I have to check why I was actually using header to put a correct tape header on the CC65 binary output and why I did not want to use the option for .TAP output of CC65 itself. Maybe also solvable via the CC65 config file)
Last edited by xahmol on Mon May 30, 2022 1:07 pm, edited 1 time in total.
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: use OSDK under Linux ?

Post by Dbug »

Weird, how is "header" related to the other tools, they are all independent, the only thing they share is the common library module.
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: use OSDK under Linux ?

Post by xahmol »

In that case, I will freshly start over again to see if I botched something else while solving the breaking issues. Maybe deleted to much accidentally in the make file.
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: use OSDK under Linux ?

Post by xahmol »

Solved. Missed that header is copied for Linux in a higher level makefile than the one I was changing and rerunning. So now have the tools I need compiled again, thanks.
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: use OSDK under Linux ?

Post by Dbug »

Cool, good luck :)
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: use OSDK under Linux ?

Post by xahmol »

Hmm. Cheered to early: something still is wrong in my build chain as it now creates unreadable .DSK images.
So some further debugging needed, will first look if it still builds on my old build chain on my Linux desktop, and then trouble shoot whatever in my new build chain is causing this.
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: use OSDK under Linux ?

Post by xahmol »

(by the way: now test with rebuilding my Ludo game, so sources that a year ago provided working images....
My new project will be to try make an Oric version of my recent Commodore projects: a screen editor. See the original C128 80 column version and the port I just finished for the Commodore Plus/4.
Thought it would be a nice next challenge to port this to a usable Oric version)
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: use OSDK under Linux ?

Post by xahmol »

Never mind. Forgot that I changed the CC65 config file for the Oric on my other machine. Reminds me I should add the changed config file in my repo to avoid having issues like this, do this now in all my newer projects.
User avatar
iss
Wing Commander
Posts: 1637
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: use OSDK under Linux ?

Post by iss »

My workaround is to change:

Code: Select all

gets_s(reply,sizeof(reply));
to:

Code: Select all

gets(reply);
In general using the 'secure' version (i.e. ..._s()) is good practice and recommended always when working under Windows :twisted:
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: use OSDK under Linux ?

Post by Dbug »

What I've done in most places was to abstract these with #ifdef and use a neutral function in the Common library, guess that could be done for that one as well.
User avatar
iss
Wing Commander
Posts: 1637
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: use OSDK under Linux ?

Post by iss »

Bodhi wrote: Mon Jan 16, 2023 3:14 pm Hmm, when I follow the instructions of that post you linked to, I get the folloing:

Code: Select all

...
./doit-osdk.sh: 6: svn: not found
@Bodhi: You need to install 'svn' (or may be the package is called 'subversion').
Post Reply