All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pham, Phong" <phamp@ddc-web.com>
To: Philippe Gerum <rpm@xenomai.org>,
	"xenomai@xenomai.org" <xenomai@xenomai.org>
Cc: "Hillman, Robert" <hillman@ddc-web.com>
Subject: Re: [Xenomai] mmap when using in conjunction with mapper to retrieve memory mapped IO space
Date: Wed, 18 Apr 2018 19:33:06 +0000	[thread overview]
Message-ID: <C2EC5BA46D13CD44B5915A8FEEB4C44E8489E1E1@DDCEXCH.ddc-ny.com> (raw)
In-Reply-To: 2fa46484-f8e1-ffbd-5e67-79d6345d08d2@xenomai.org


Hi,

Instead of  symbol `mmap' out of range, I now have symbol `malloc' out of range.  I removed  all the -fPIC in my environment.  I have to recompile libc???  I never compiled libc and wants to avoid it.

Any suggestion on
R_PPC_REL24 relocation at 0x0ffacd3c for symbol `mmap/malloc' out of range

is appreciated.

This is after I add LDFLAGS (from xeno-config) during the process of creating a shared library.

Phong.

-----Original Message-----
From: Pham, Phong
Sent: Tuesday, April 17, 2018 7:22 PM
To: 'Philippe Gerum'; xenomai@xenomai.org
Cc: Hillman, Robert
Subject: RE: [Xenomai] mmap when using in conjunction with mapper to retrieve memory mapped IO space


Hi Philippe and all,

Regarding "Your app may be missing symbol wrapping. Please check out this doc:

https://xenomai.org/documentation/xenomai-3/html/xeno3prm/group__cobalt__api.html"

Thanks for the tip.  In the Makefile fragment from this link:
https://xenomai.org/building-applications-with-xenomai-3-x/

I suggest you add the missing --posix in the LDFLAGS as well.  After all, I copied my app from this very snippet and that's why I get the error.

On the same idea (using LDFLAGS from xeno-config), I would like to create a dynamically linked library (.so).  Without the LDFLAGS from xeno-config, my library loads fine (but will fail when mmap is called); with the LDFLAGS that has --posix, I get this error when loading:

R_PPC_REL24 relocation at 0x0ffacd3c for symbol `mmap' out of range

Does this mean I have to recompile all of the Xenomai library with -fPIC?  I didn't see anything regarding that choice during "configure" but peeking into the configure script, there are a few -fPIC occurrences.  Currently, I am using "Building the PPC32 libraries" instruction and also I didn't need to perform ./script/bootstrap b/c I am building it from the release tarball.

$xenomai_root/configure --host=powerpc-linux --with-core=cobalt --enable-debug=symbols

Suggestion on the error above and/or compiling Xenomai library w/ -fPIC is appreciated.

Just fyi w/ regard to your updated "comment fix" on how to mmap(), I don't know if you need to update udd.h (right above struct udd_memregion) as well.  i.e. the same comment exists there but don't know if the comment there is retrieved from the location where you made the "comment fix".

Phong.

-----Original Message-----
From: Philippe Gerum [mailto:rpm@xenomai.org]
Sent: Thursday, April 12, 2018 1:58 AM
To: Pham, Phong; xenomai@xenomai.org
Cc: Hillman, Robert
Subject: Re: [Xenomai] mmap when using in conjunction with mapper to retrieve memory mapped IO space

On 04/10/2018 09:03 PM, Pham, Phong wrote:
>
> Hi,
>
> According to page 651
> https://xenomai.org/documentation/xenomai-3/pdf/xeno3prm.pdf
>
>
> This will make such region accessible via the mapper device using the
> following sequence of code, via the default ->mmap() handler from the UDD core:
> int fd, fdm;
> void *p;
> fd = open("/dev/foocard", O_RDWR);
> fdm = open("/dev/foocard,mapper@2", O_RDWR); p = mmap(NULL, 4096,
> PROT_READ|PROT_WRITE, 0, fdm, 0);
>
>
> I have several questions:
>
> 1)      It looks like the 4th argument of mmap (the one to the left of "fdm") needs to be either MAP_SHARED or MAP_PRIVATE
>
> 2)      The "@" character right after "mapper" is not valid (ie. there should be no "@" character at all)
>
> 3)      /dev/foocard should be /dev/rtdm/foocard


Fixed, thanks.

https://xenomai.org/documentation/xenomai-3/html/xeno3prm/structudd__memregion.html#udd_memory_region

>
> here's my real question:
>
> Assuming all 3 of the above is valid from user space, and on the
> kernel space, I followed the ex. to create memory region, etc. such
> that I do see my device
>
> # ls -l dev/rtdm
> crw-------    1 root     root      252,   0 Jan  1 00:00 autotune
> crw-------    1 root     root      247,   0 Jan  1 00:00 eeprom
> crw-------    1 root     root      246,   0 Jan  1 00:00 eeprom,mapper0
> crw-------    1 root     root      254,   0 Jan  1 00:00 memdev-private
> crw-------    1 root     root      254,   1 Jan  1 00:00 memdev-shared
> crw-------    1 root     root      253,   0 Jan  1 00:00 memdev-sys
> crw-------    1 root     root      249,   0 Jan  1 00:00 mmio
> crw-------    1 root     root      248,   0 Jan  1 00:00 mmio,mapper0
> crw-------    1 root     root      248,   1 Jan  1 00:00 mmio,mapper1
> crw-------    1 root     root      248,   2 Jan  1 00:00 mmio,mapper2
> crw-------    1 root     root      248,   3 Jan  1 00:00 mmio,mapper3
> crw-------    1 root     root      248,   4 Jan  1 00:00 mmio,mapper4
> crw-------    1 root     root      250,   0 Jan  1 00:00 switchtest
> crw-------    1 root     root      251,   0 Jan  1 00:00 timerbench
>
>
> like /dev/rtdm/eeprom and /dev/rtdm/eeprom,mapper0  etc. I don't see
> my kernel hook ever gets called
>
>
> static struct udd_device eeprom = {
>               .device_flags = RTDM_NAMED_DEVICE,
>               .device_name = "eeprom",
>               .ops = {
>                              .close = phong_scs750_close,
>                              .open = phong_scs750_open,
>                              .mmap = phong_scs750_mmap,
>               }
>
> By that, I mean phong_scs750_open, phong_scs750_mmap never gets invoked.  mmap() from user space returns -1 with errno value of 19 (ENODEV).  Any advise?

Your app may be missing symbol wrapping. Please check out this doc:

https://xenomai.org/documentation/xenomai-3/html/xeno3prm/group__cobalt__api.html


--
Philippe.
Notice: This e-mail and any files transmitted with it may contain Data Device Corporation's privileged and proprietary information. It is intended solely for the use of the individual or entity to whom it is addressed. If you are not the named recipient of this transmission, any disclosure, copying, distribution or reliance on the contents of this message is prohibited. If you received this e-mail in error, please destroy it and any attached files and notify me immediately.

  parent reply	other threads:[~2018-04-18 19:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10 19:03 [Xenomai] mmap when using in conjunction with mapper to retrieve memory mapped IO space Pham, Phong
2018-04-12  8:58 ` Philippe Gerum
2018-04-18  2:21   ` Pham, Phong
2018-04-18 19:33   ` Pham, Phong [this message]
2018-04-18 19:58     ` Philippe Gerum
2018-04-18 23:02       ` Pham, Phong
2018-04-19  7:26         ` Philippe Gerum
2018-05-02  0:32           ` Pham, Phong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C2EC5BA46D13CD44B5915A8FEEB4C44E8489E1E1@DDCEXCH.ddc-ny.com \
    --to=phamp@ddc-web.com \
    --cc=hillman@ddc-web.com \
    --cc=rpm@xenomai.org \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.