Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #37881
| Date | 2015-04-03 12:07 +0100 |
|---|---|
| From | Jan Coombs <Jan-54 <jenfhaomndgfwutc@murmic.plus.com>> |
| Newsgroups | comp.lang.forth |
| Subject | gforth mmap - can't connect? |
| Message-ID | <20150403120733.5b82aa6a@T60A> (permalink) |
I want to connect support tools for Forth chips like the
b16 and j1 to my development tools, so that I can
interactively write code and debug on a simulation of the
hardware. The tools can the be later connected to the
FPGA hardware to continue testing at higher speed.
Small FPGA boards often include a USB comm port for debug,
so there is no problem connecting tools to real chip, but
in order to connect up for simulation I need a byte-wide
bi-directional pipe. To make this easy to port to Windows
I chose to implement this myself using mmap.
Getting this working at the chip tools end, in Python, was
not too difficult, but I cannot seem to get it connecting
in gforth. The mmap'd file has only one writer.
This is the read end setup in Python:
import os
fd_in = os.open('/home/jan/tmp/mmaptest', os.O_RDONLY)
buf = mmap.mmap(fd_in, mmap.PAGESIZE, mmap.MAP_SHARED, mmap.PROT_READ)
This is my gforth read setup:
include mmap_0.7.9.fs
s" /home/jan/tmp/mmaptest" r/o open-file throw Value fd_in
here >pagealign here - allot
here pagesize allot constant buf
\ buf pagesize PROT_READ MAP_SHARED fd_in off mmap
\ buf pagesize PROT_READ MAP_SHARED fd_in -1 mmap
buf pagesize PROT_READ MAP_SHARED fd_in 0 mmap
I do not know what 'iff' is, and having looked at mmap docs
for C still can't guess. Or perhaps my problem is elsewhere?
I'm not seeing any errors, but buff remains empty, while I
can see another receiver working correctly.
The gforth version is Gforth 0.7.0, running under ubuntu.
Any ideas, updated source or docs, would be appreciated.
Jan Coombs
--
email valid, else fix dots and hyphen
jan4clf2014@murrayhyphenmicroftdotcodotuk
Back to comp.lang.forth | Previous | Next — Next in thread | Find similar | Unroll thread
gforth mmap - can't connect? Jan Coombs <Jan-54 <jenfhaomndgfwutc@murmic.plus.com>> - 2015-04-03 12:07 +0100 Re: gforth mmap - can't connect? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-04-03 12:03 +0000
csiph-web