For some reason I wanted to run gforth-0.2.1 (from 1996). My old
binary no longer works (it's an a.out binary), so I had a go at
rebuilding it. And I got it to work, and in 64-bit mode, too (AMD64
only appeared in 2003, but we had already ported Gforth to the Alpha
when we released 0.2.1).
Here's how I built it:
./configure
make
That's just what the documentation says. Running it is a little more involved, though. From the build directory:
setarch `uname -m` -R ./gforth -p.
The "setarch -R" is there to disable ASLR (gforth-0.2.1 was released
shortly before that became fashionable), the "-p." is there so it
takes the gforth.fi image from the build directory rather than the
32-bit image that I have installed elsewhere.
That was surprisingly painless.
- anton
--
This makes me want to ask the group a question.
If you have a program that you build with a Forth cross-compiler, how
do you provide the user with the type of compiler switches that Anton
is demonstrating?
I have typically just written a Forth "script" to control everything but command line switches are pretty convenient . I am curious how
others people handle this in a Forth cross-compiler environment.
It merely concentrates on things like directory separators and the odd popen() call.
Predefined #macros figure most of that stuff out, like __GNU__, __TURBO_C__, __WIN32__, etc.
Then there is embedded bytecode, which comes in two versions, 32bit and 64bit.
When *not* cross compiling, the Makefile can figure out how to build these. It requires
a "dummy", intermediate compiler (which "make" creates as well) which is discarded
later.
Since the generated files are ordinary, valid C files, cross compilation just requires
inclusion of these files - and all will be fine. No "dummy" compiler needed.
Hans Bezemer
XFC99 FLOAD CC9900\SRC.ITC\FORTHITC.MAK
That part I am clear on. (at least until I find my next bug) :-)
But do you use the O/S command line typically ?
Do you use "compiler switches" on the command line? ( Like -R -o2 and the rest)
For example my hobby cross-compiler is used like this:
XFC99 FLOAD CC9900\SRC.ITC\FORTHITC.MAK
But I don't provide the user with any way to switch what will happen on the command line. Once the compiler begins reading the file it just runs.
Just wondering if that is ever done with Forth.
If you have a program that you build with a Forth cross-compiler, how
do you provide the user with the type of compiler switches that Anton
is demonstrating?
I have typically just written a Forth "script" to control everything but command line switches are pretty convenient . I am curious how
others people handle this in a Forth cross-compiler environment.
Do you use "compiler switches" on the command line? ( Like -R -o2 and the rest)
Just wondering if that is ever done with Forth.
On Monday, May 2, 2022 at 1:53:38 PM UTC-4, Anton Ertl wrote:
For some reason I wanted to run gforth-0.2.1 (from 1996). My old
binary no longer works (it's an a.out binary), so I had a go at
rebuilding it. And I got it to work, and in 64-bit mode, too (AMD64
only appeared in 2003, but we had already ported Gforth to the Alpha
when we released 0.2.1).
Here's how I built it:
./configure
make
That's just what the documentation says. Running it is a little more
involved, though. From the build directory:
setarch `uname -m` -R ./gforth -p.
The "setarch -R" is there to disable ASLR (gforth-0.2.1 was released
shortly before that became fashionable), the "-p." is there so it
takes the gforth.fi image from the build directory rather than the
32-bit image that I have installed elsewhere.
This makes me want to ask the group a question.
If you have a program that you build with a Forth cross-compiler, how
do you provide the user with the type of compiler switches that Anton
is demonstrating?
I have typically just written a Forth "script" to control everything but >command line switches are pretty convenient . I am curious how
others people handle this in a Forth cross-compiler environment.
Not that I've seen. 'command line and switch' being an OS-related feature
may exist or not. Typically what one finds in forth is a 'load block' (however that is implemented) and 'electives' i.e. blocks of code it loads
or not. One might call it a 'make' file. Whether it's worth adding command- line control depends on number of variables/targets etc. IIRC Moore said didn't care for 'conditional compilation' as being an unnecessary complication.
YMMV
Most Forth systems allow putting Forth code on the OS command line, so
you can mix between having some parameters in a configuration file,
and some on the OS command line.
That being said, gforth usually passes a configuration file name on
the command line, but not individual parameters, e.g.:
./preforth -p ".:~+:." -e 's" arch/8086/mach.fs" include ./kernel-ec/main.fs' -e "save-cross kernl-8086.fi- /usr/local/bin/gforth-0.7.9_20220428 bye"
The configuration file is arch/8086/mach.fs.
Secondly.most cross compilers support EQU, e.g
5 EQU MACHINE-TYPE
An equ is a constant that uses no target space and is ideal for
defining target switches. The MPE compiler has switches such
as
TASKING? \ true for multitasking
FAST-CMOVE? \ true for huge but fast CMOVE
as well as configuration values such as
SP-SIZE \ data stack size
The words available during interpretation include directives that
can change configuration.
Fine names/paths can also be used with macros, e.g.
ms" myproj/%arch%/floats.fth"
where %arch% may give x86 or x64 or ARM32 or ARM64.
Text Macros are also available in hosted systems.
The tools are designed with the knowledge that they will be
used in a cross-compiler. The techniques can be mixed as required.
The following programs the target Flash after compilation.
\ Define device, speed (0=auto) and project file
\ Download the target image when compilation finishes
jlink LPC4078 0 Project.jlink \ JLINK and device setup
useSWD \ use SWD rather than the
default JTAG
-download-prompts \ no prompting for download
afterwards download-sections \ download image after completion.
--
Stephen Pelc, ste...@vfxforth.com
MicroProcessor Engineering, Ltd. - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, +44 (0)78 0390 3612, +34 649 662 974 http://www.mpeforth.com - free VFX Forth downloads
That part I am clear on. (at least until I find my next bug) :-)
But do you use the O/S command line typically ?
Do you use "compiler switches" on the command line? ( Like -R -o2 and the rest)
For example my hobby cross-compiler is used like this:
XFC99 FLOAD CC9900\SRC.ITC\FORTHITC.MAK
But I don't provide the user with any way to switch what will happen on the >> command line. Once the compiler begins reading the file it just runs.
Just wondering if that is ever done with Forth.
Not that I've seen. 'command line and switch' being an OS-related feature >may exist or not. Typically what one finds in forth is a 'load block' >(however that is implemented) and 'electives' i.e. blocks of code it loads
or not. One might call it a 'make' file. Whether it's worth adding command- >line control depends on number of variables/targets etc. IIRC Moore said >didn't care for 'conditional compilation' as being an unnecessary complication.
YMMV
In article <t4sk0g$2hb$1...@gioia.aioe.org>, dxforth <dxf...@gmail.com> wrote:
On 4/05/2022 08:46, Brian Fox wrote:
That part I am clear on. (at least until I find my next bug) :-)
But do you use the O/S command line typically ?
Do you use "compiler switches" on the command line? ( Like -R -o2 and the rest)
For example my hobby cross-compiler is used like this:
XFC99 FLOAD CC9900\SRC.ITC\FORTHITC.MAK
But I don't provide the user with any way to switch what will happen on the
command line. Once the compiler begins reading the file it just runs.
Just wondering if that is ever done with Forth.
Not that I've seen. 'command line and switch' being an OS-related feature >may exist or not. Typically what one finds in forth is a 'load block' >(however that is implemented) and 'electives' i.e. blocks of code it loads >or not. One might call it a 'make' file. Whether it's worth adding command- >line control depends on number of variables/targets etc. IIRC Moore said >didn't care for 'conditional compilation' as being an unnecessary complication.I have turnkey manx. You run it with (bitbanging the parallel port)
YMMV
tmanx song.sco
If you are on linux machine with no parallel port, I purchased a
ser/par board on pci, now that parallel port is on C030.
In linux I do now
tmanx -p C030 song.sco
-p is a regular Forth word, say
\ Execute the only option in existance -p : set the port
: -p SHIFT-ARGS 1 ARG[] HEX EVALUATE ATTACH-PARALLEL-PORT DECIMAL
SHIFT-ARGS ;
\ Handle all options
: MANX-OPTIONS ARGC 1 > IF 1 ARG[] DROP C@ &- = IF -p THEN THEN ;
Prerequisites are ARG[] ARGC and SHIFT-ARGS. These are left as an
exercise for the reader. (Hint:it fits in one screen, with space
to spare for environment stuff)
Groetjes Albert
In MS-Windows I could define /p instead of -p.
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (2 / 14) |
Uptime: | 35:13:24 |
Calls: | 6,707 |
Files: | 12,239 |
Messages: | 5,353,387 |