Discussion:
linux uart driver
Prashanth Mundkur
2017-02-15 02:06:23 UTC
Permalink
Hi,

I'm exploring writing a simple uart driver for linux in order
to get terminal_mux working on linux. When I disable the linux spec
check in terminal_mux.run, the build always picks up:

Program drivers/uart/spec/x86/uart_drv

even though I created a drivers/uart/spec/linux/

and changed drivers/uart/spec/linux/target.mk to read

REQUIRES = linux

and the etc/specs.conf in the build directory to read:

SPECS += linux x86_64

I'd like to know how I can get the build to say

Program drivers/uart/spec/linux/uart_drv


Thanks,

--prashanth
Norman Feske
2017-02-16 09:48:00 UTC
Permalink
Hi Prashanth,
Post by Prashanth Mundkur
I'm exploring writing a simple uart driver for linux in order
to get terminal_mux working on linux. When I disable the linux spec
Program drivers/uart/spec/x86/uart_drv
even though I created a drivers/uart/spec/linux/
and changed drivers/uart/spec/linux/target.mk to read
REQUIRES = linux
SPECS += linux x86_64
I'd like to know how I can get the build to say
Program drivers/uart/spec/linux/uart_drv
I suspect that the build system actually picks up and builds both
targets because each of them meets the SPECS as defined for the build
directory. The problem is that the targets are named the same. So the
symlink in '<build-dir>/bin' is overwriten by the target last visited.
To check this assumption, you may have a look at the content of the
build locations for the two drivers in question:

<build-dir>/drivers/uart/spec/linux
<build-dir>/drivers/uart/spec/x86

I presume that each of those locations contains the respective executable.

The best way to solve the ambiguity would be to give your driver a
distinct name, e.g., by adding the following line in your
'spec/linux/target.mk' file:

TARGET = linux_uart_drv

Now, both drivers should appear in the bin/ directory side by side.

Cheers
Norman
--
Dr.-Ing. Norman Feske
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
Prashanth Mundkur
2017-02-16 19:12:07 UTC
Permalink
Hi Norman,
Post by Norman Feske
Post by Prashanth Mundkur
I'm exploring writing a simple uart driver for linux in order
to get terminal_mux working on linux. When I disable the linux spec
Program drivers/uart/spec/x86/uart_drv
even though I created a drivers/uart/spec/linux/
and changed drivers/uart/spec/linux/target.mk to read
REQUIRES = linux
SPECS += linux x86_64
I'd like to know how I can get the build to say
Program drivers/uart/spec/linux/uart_drv
I suspect that the build system actually picks up and builds both
targets because each of them meets the SPECS as defined for the build
directory. The problem is that the targets are named the same. So the
symlink in '<build-dir>/bin' is overwriten by the target last visited.
To check this assumption, you may have a look at the content of the
<build-dir>/drivers/uart/spec/linux
<build-dir>/drivers/uart/spec/x86
I presume that each of those locations contains the respective
executable.
In my case, I only had <build-dir>/drivers/uart/spec/x86 built, and no
sign of spec/linux.
Post by Norman Feske
The best way to solve the ambiguity would be to give your driver a
distinct name, e.g., by adding the following line in your
TARGET = linux_uart_drv
Now, both drivers should appear in the bin/ directory side by side.
I did try this, but it didn't quite work because of the

include $(REP_DIR)/src/drivers/uart/target.inc

line at the bottom of spec/linux/target.mk which was copied over from
the spec/x86/target.mk. The target.inc itself defines TARGET to
uart_dev. Perhaps this might have something to do with the
spec/linux/ driver not getting built.

When I removed that include line and copied over the target.inc
contents minus the TARGET line, it indeed functioned like you said,
with both drivers being built.

Thanks for the suggestions!

--prashanth

Loading...