izot / lon-driver

The EnOcean LON driver enables developers to add support to Linux for the EnOcean U10, U20, U60, and U70 USB LON network interfaces. The LON protocol is an open standard defined by the ISO/IEC 14908 series of standards.
https://www.enocean.com/edge
Other
4 stars 0 forks source link

u50 Driver compilation issue #3

Open joshmarshall1995 opened 6 months ago

joshmarshall1995 commented 6 months ago

Hello,

OS: Ubuntu 22.04.4 LTS GCC: gcc version 11.4.0

When compiling driver using this makefile:

EXTRA_CFLAGS += -I$(src)/include -DU50_KERNEL -g obj-m += u50.o u50-y += U50Link.o U50Osal.o U50Log.o U50Driver.o packet_util.o ipv6_ls_to_udp.o ip_util.o

all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean: sudo rm -rf .??.cmd .tmp_versions .ko *.o Module.symvers modules.order

I get declaration issues from the code such as this:

lon-driver/u50/U50Link.c:191:12: error: implicit declaration of function ‘getUplinkBufferSize’ [-Werror=implicit-function-declaration] 191 | while (getUplinkBufferSize(state)) { | ^~~~~~~

u50/lon-driver/u50/U50Link.c:192:9: error: implicit declaration of function ‘removeUplinkBufferFront’ [-Werror=implicit-function-declaration] 192 | removeUplinkBufferFront(state);

wsdickerson commented 6 months ago

I must have created the header file "U50Osal_functions.h".  I don't see it in the download.  I am developing for Centos/Rocky Linux.

/// SPDX-License-Identifier: GPL-2.0 AND MIT
// Copyright © 2022 Dialog Semiconductor
//
// Permission is hereby granted, free of charge, to any person
obtaining a copy of
// this software and associated documentation files (the
"Software"), to deal in
// the Software without restriction, including without limitation
the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies
// of the Software, and to permit persons to whom the Software is
furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be
included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE
// SOFTWARE.

#ifndef U50OSAL_FUNCTIONS_H
#define U50OSAL_FUNCTIONS_H

#undef U50LINK_H // FIXME Why is this necessary for U50LinkState?
#include "U50Link.h"
#include "U50Defs.h"
//FIXME #include "Ldv32.h"
//FIXME #include "platform.h"

// function declarations
pLONVXD_Buffer getUplinkBufferFront(struct U50LinkState *state);
void removeUplinkBufferFront(struct U50LinkState *state);
void addToUplinkBuffer(struct U50LinkState *state, pLONVXD_Buffer data);
size_t getUplinkBufferSize(struct U50LinkState *state);
pLONVXD_Buffer getDownlinkBufferFront(struct U50LinkState *state);
void removeDownlinkBufferFront(struct U50LinkState *state);
void addToDownlinkBuffer(struct U50LinkState *state, pLONVXD_Buffer
data);
size_t getDownlinkBufferSize(struct U50LinkState *state);
int CalLowerReadCount(struct U50LinkState *state);
int LogThrottleCheck(struct U50LinkState *state);
DWORD CalLowerRead(struct U50LinkState *state, PVOID pDest, WORD
Count, PWORD pActual);
void CalLowerWrite(struct U50LinkState *state, PVOID OutputBuffer,
ULONG OutputBufferLength);
WORD CalLowerGetOvlr(struct U50LinkState *state);
OsalStatus OsalCreateEvent(OsalHandle *pHandle);
OsalStatus OsalDeleteEvent(OsalHandle *pHandle);
OsalStatus OsalWaitForEvent(OsalHandle handle, unsigned int waittime);
OsalStatus OsalSetEvent(OsalHandle handle);
OsalTickCount OsalGetTickCount(void);
void* allocateMemory(size_t size);
void freeMemory(void * buf);

#endif  // U50OSAL_FUNCTIONS_H/

Stan

On 4/16/24 07:51, Jmarts wrote:

Hello,

OS: Ubuntu 22.04.4 LTS

When compiling driver using this makefile:

EXTRA_CFLAGS += -I$(src)/include -DU50_KERNEL -g obj-m += u50.o u50-y += U50Link.o U50Osal.o U50Log.o U50Driver.o packet_util.o ipv6_ls_to_udp.o ip_util.o

all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean: sudo rm -rf .??.cmd .tmp_versions .ko *.o Module.symvers modules.order

I get declaration issues from the code such as this:

lon-driver/u50/U50Link.c:191:12: error: implicit declaration of function ‘getUplinkBufferSize’ [-Werror=implicit-function-declaration] 191 | while (getUplinkBufferSize(state)) { | ^~~~~~~

u50/lon-driver/u50/U50Link.c:192:9: error: implicit declaration of function ‘removeUplinkBufferFront’ [-Werror=implicit-function-declaration] 192 | removeUplinkBufferFront(state);

— Reply to this email directly, view it on GitHub https://url.emailprotection.link/?bMt_GyhMyvS5bhy8le5-i4_e9ltFAPMfZqyRlWWvqNtO7ouixs9CP8Dj6mJjFhoyem0mbtRLX_XAJV-dtEzCpXc4eomAL9ljL7CQ-kQLIHMMIWWTJKKFLK-sq9t3770B3, or unsubscribe https://url.emailprotection.link/?bBop0MHhF-HDtljca3FwARe--nqIlivc1BLlp88IGiQ9_zkGtl5lHNYoS726U5iR9L0Td_s_P9FYHIQGbB42J9kdD70d_Yi5yMMz46rW6_tK37F4LMtOH2-LeZrJTUUFPPqOJToZ7QyIX4dyymyw9h_KPuomZv0g7avbcOjV2a9l1Jlu5h8m6x3i88iQdOUaEVFvBpqLHWLX4ejGWbEJk2nc6_ZyvsvYfU0BMMagYgZxFwp35eY22Jq0G34-dqEfA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

--------------x0c2aMAVMVAkhqbrF8OuiKVf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: 8bit

<!DOCTYPE html>

I must have created the header file "U50Osal_functions.h".  I don't see it in the download.  I am developing for Centos/Rocky Linux.
// SPDX-License-Identifier: GPL-2.0 AND MIT
// Copyright © 2022 Dialog Semiconductor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#ifndef U50OSAL_FUNCTIONS_H
#define U50OSAL_FUNCTIONS_H

#undef U50LINK_H // FIXME Why is this necessary for U50LinkState?
#include "U50Link.h"
#include "U50Defs.h"
//FIXME #include "Ldv32.h"
//FIXME #include "platform.h"

// function declarations
pLONVXD_Buffer getUplinkBufferFront(struct U50LinkState *state);
void removeUplinkBufferFront(struct U50LinkState *state);
void addToUplinkBuffer(struct U50LinkState *state, pLONVXD_Buffer data);
size_t getUplinkBufferSize(struct U50LinkState *state);
pLONVXD_Buffer getDownlinkBufferFront(struct U50LinkState *state);
void removeDownlinkBufferFront(struct U50LinkState *state);
void addToDownlinkBuffer(struct U50LinkState *state, pLONVXD_Buffer data);
size_t getDownlinkBufferSize(struct U50LinkState *state);
int CalLowerReadCount(struct U50LinkState *state);
int LogThrottleCheck(struct U50LinkState *state);
DWORD CalLowerRead(struct U50LinkState *state, PVOID pDest, WORD Count, PWORD pActual);
void CalLowerWrite(struct U50LinkState *state, PVOID OutputBuffer, ULONG OutputBufferLength);
WORD CalLowerGetOvlr(struct U50LinkState *state);
OsalStatus OsalCreateEvent(OsalHandle *pHandle);
OsalStatus OsalDeleteEvent(OsalHandle *pHandle);
OsalStatus OsalWaitForEvent(OsalHandle handle, unsigned int waittime);
OsalStatus OsalSetEvent(OsalHandle handle);
OsalTickCount OsalGetTickCount(void);
void* allocateMemory(size_t size);
void freeMemory(void * buf);

#endif  // U50OSAL_FUNCTIONS_H

Stan

On 4/16/24 07:51, Jmarts wrote:

Hello,

OS: Ubuntu 22.04.4 LTS

When compiling driver using this makefile:

EXTRA_CFLAGS += -I$(src)/include -DU50_KERNEL -g
obj-m += u50.o
u50-y += U50Link.o U50Osal.o U50Log.o U50Driver.o packet_util.o ipv6_ls_to_udp.o ip_util.o

all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
sudo rm -rf .??*.cmd .tmp_versions *.ko *.o Module.symvers modules.order

I get declaration issues from the code such as this:

lon-driver/u50/U50Link.c:191:12: error: implicit declaration of function ‘getUplinkBufferSize’ [-Werror=implicit-function-declaration]
191 | while (getUplinkBufferSize(state)) {
| ^~~~~~~~~~~~~~~~~~~

u50/lon-driver/u50/U50Link.c:192:9: error: implicit declaration of function ‘removeUplinkBufferFront’ [-Werror=implicit-function-declaration]
192 | removeUplinkBufferFront(state);


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <izot/lon-driver/issues/3@github.com>


--------------x0c2aMAVMVAkhqbrF8OuiKVf--

--------------054HkrzNnag2S7j04bhQ4lss Content-Type: text/vcard; charset="UTF-8"; name="stan.vcf" Content-Disposition: attachment; filename="stan.vcf" Content-Transfer-Encoding: base64

QkVHSU46VkNBUkQNCkZOOlN0YW4gRGlja2Vyc29uDQpOOkRpY2tlcnNvbjtTdGFuOzs7DQpP Ukc6RW5lcmd5IENvbnRyb2wgU3lzdGVtcw0KQURSOjs7Mjk0MC1BIENvbGUgQ291cnQ7Tm9y Y3Jvc3M7R0E7MzAwNzE7VVNBDQpFTUFJTDtQUkVGPTE6c3RhbkBlbmVyZ3ljb250cm9sc3lz dGVtcy5jb20NClRJVExFOlByb2R1Y3QgRGV2ZWxvcG1lbnQgRW5naW5lZXINClRFTDtUWVBF PXdvcms6NDA0LTQzMi03MDkxDQpURUw7VFlQRT1jZWxsOjQwNC00MzItNzA5MQ0KWC1NT1pJ TExBLUhUTUw6VFJVRQ0KVVJMOnd3dy5lbmVyZ3ljb250cm9sc3lzdGVtcy5jb20NClRaO1ZB TFVFPVRFWFQ6QW1lcmljYS9QaG9lbml4DQpFTkQ6VkNBUkQNCg==

--------------054HkrzNnag2S7j04bhQ4lss--

joshmarshall1995 commented 6 months ago

Thanks for the reply & code - got that in the repo now, I'm still getting some more issues mainly due to time classes:

home/josh/lontalk/u50/lon-driver/u50/include/U50Link.h:68:9: error: unknown type name ‘time_t’ 68 | time_t m_tStartup; // for reboot control. | ^~ /home/josh/lontalk/u50/lon-driver/u50/U50Link.c: In function ‘U50LinkStart’: /home/josh/lontalk/u50/lon-driver/u50/U50Link.c:214:25: error: storage size of ‘ts’ isn’t known 214 | struct timespec ts; | ^~ /home/josh/lontalk/u50/lon-driver/u50/U50Link.c:241:9: error: implicit declaration of function ‘getnstimeofday’ [-Werror=implicit-function-declaration] 241 | getnstimeofday(&ts);

Added in #include <linux/ktime.h> for later kernel versions to no avail.

Would it be possible to see your Makefile? Some of these issues look like its due to needed different flags while building

wsdickerson commented 6 months ago

I made hundreds of changes to port to Rocky Linux.  I've never made a fork and that looks like too much trouble.  How can I share my whole project directory?

Makefile

/# 03/11/24 uninstall rm RM_PATH is optional
# 02/19/24 ECS: MAJORVERSION >= 5 (was =5)

module_lc:=u50
MODULE_UC:=U50

KVERSION:=$(shell uname -r)
SRC:=/usr/src/kernels/$(KVERSION)
#EXTRA_CFLAGS += -Iinclude -I$(SRC)/include -D$(MODULE_UC)_KERNEL -g

obj-m += $(module_lc).o
$(module_lc)-y += $(MODULE_UC)Link.o $(MODULE_UC)Osal.o
$(MODULE_UC)Log.o $(MODULE_UC)Driver.o packet_util.o
ipv6_ls_to_udp.o ip_util.o

# -g includes debugging info
ccflags-y:=-I$(src)/include -I/usr/include -I/usr/include/linux
-D$(MODULE_UC)_KERNEL -g

BUILD_DIR:=/lib/modules/$(KVERSION)/build/
install_path:=kernel/drivers/lon
LON_DIR:=/lib/modules/$(KVERSION)/$(install_path)
RM_PATH:=$(LON_DIR)/$(module_lc).ko

DEBIAN_VERSION_FILE:=/etc/debian_version
DEBIAN_DISTRO:=$(wildcard $(DEBIAN_VERSION_FILE))
MAJORVERSION:=$(shell uname -r | cut -d '.' -f 1)
MINORVERSION:=$(shell uname -r | cut -d '.' -f 2)
RM:=rm -r
SUBLEVEL:=$(shell uname -r | cut -d '.' -f 3)

obj-m +=$(module_lc).o

#ax99100-objs := ax99100_spi.o ax99100_sp.o

default:
     - $(RM) *.mod.c *.o *.ko .*.cmd *.symvers
     make -Wimplicit-fallthrough=2 -C $(BUILD_DIR) M=$(PWD) modules
     $(RM) *.mod.c *.o .*.cmd *.symvers

install:
     $(info Install)
#ifeq ($(shell expr $(MAJORVERSION) \>= 5), 1)
     install -d $(LON_DIR)
     $(MAKE) INSTALL_MOD_DIR=$(install_path) -C $(BUILD_DIR)
M=$(PWD) modules_install
     su -c "/sbin/depmod -a"
     modprobe $(module_lc)

uninstall:
     $(info Uninstall)
     $(info modprobe-r)
     modprobe -r $(module_lc)
     - rm -r $(RM_PATH)
     depmod -A

clean:
     #$(RM) *.mod.c *.o *.o.* *.ko .*.cmd *.symvers *.o.ur-safe *.mod
     $(RM) .??*.cmd .tmp_versions *.ko *.o Module.symvers modules.order
     make -C $(BUILD_DIR) M=$(PWD) clean/

On 4/17/24 05:42, Jmarts wrote:

Thanks for the reply & code - got that in the repo now, I'm still getting some more issues mainly due to time classes:

home/josh/lontalk/u50/lon-driver/u50/include/U50Link.h:68:9: error: unknown type name ‘time_t’ 68 | time_t m_tStartup; // for reboot control. | ^~ /home/josh/lontalk/u50/lon-driver/u50/U50Link.c: In function ‘U50LinkStart’: /home/josh/lontalk/u50/lon-driver/u50/U50Link.c:214:25: error: storage size of ‘ts’ isn’t known 214 | struct timespec ts; | ^~ /home/josh/lontalk/u50/lon-driver/u50/U50Link.c:241:9: error: implicit declaration of function ‘getnstimeofday’ [-Werror=implicit-function-declaration] 241 | getnstimeofday(&ts);

Would it be possible to see your Makefile? Some of these issues look like its due to needed different flags while building

— Reply to this email directly, view it on GitHub https://url.emailprotection.link/?bixiBO_XuphmauVk9736aiJgSDWx6_H6g6r9YIfWOmailERnPbvvYchTUJ-5HhSZLMoQoqRAb92mPTJuCKsNeCMd_VzkysW360cQ9p5FOJegj_4Qu2APAEfurl9WHXFxd, or unsubscribe https://url.emailprotection.link/?bVawyuVPvIpPLnWlfA5CgoQfeYJn0ObB2c4l0ucqANyfKi6G-ERI0uljJ5XvrDqS-EonI-Dq85lNbQjbG--n4P7WicVi5ofJ65yNhopfjWI2WJtMOrsM1wLqwAOx8FO9JIzJc-fgYKrLsqSWlfsnpE6f9GrxCaXP4ZSK559hvjEIzqdtI40G99Kfa89u6uzoIwW6ZFctEnxtzUCr6B1yjjOjabRBhHlTlD6ud_qNPe38wuNuBtTrKXAcw1rmMbToW. You are receiving this because you commented.Message ID: @.***>

--------------suwUKzIOmhnpYp70rnAXInK5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: 8bit

<!DOCTYPE html>

I made hundreds of changes to port to Rocky Linux.  I've never made a fork and that looks like too much trouble.  How can I share my whole project directory?

Makefile
# 03/11/24 uninstall rm RM_PATH is optional
# 02/19/24 ECS: MAJORVERSION >= 5 (was =5)

module_lc:=u50
MODULE_UC:=U50

KVERSION:=$(shell uname -r)
SRC:=/usr/src/kernels/$(KVERSION)
#EXTRA_CFLAGS += -Iinclude -I$(SRC)/include -D$(MODULE_UC)_KERNEL -g

obj-m += $(module_lc).o
$(module_lc)-y += $(MODULE_UC)Link.o $(MODULE_UC)Osal.o $(MODULE_UC)Log.o $(MODULE_UC)Driver.o packet_util.o ipv6_ls_to_udp.o ip_util.o

# -g includes debugging info
ccflags-y:=-I$(src)/include -I/usr/include -I/usr/include/linux -D$(MODULE_UC)_KERNEL -g

BUILD_DIR:=/lib/modules/$(KVERSION)/build/
install_path:=kernel/drivers/lon
LON_DIR:=/lib/modules/$(KVERSION)/$(install_path)
RM_PATH:=$(LON_DIR)/$(module_lc).ko

DEBIAN_VERSION_FILE:=/etc/debian_version
DEBIAN_DISTRO:=$(wildcard $(DEBIAN_VERSION_FILE))
MAJORVERSION:=$(shell uname -r | cut -d '.' -f 1)
MINORVERSION:=$(shell uname -r | cut -d '.' -f 2)
RM:=rm -r
SUBLEVEL:=$(shell uname -r | cut -d '.' -f 3)

obj-m +=$(module_lc).o

#ax99100-objs := ax99100_spi.o ax99100_sp.o

default:
    - $(RM) *.mod.c *.o *.ko .*.cmd *.symvers
    make -Wimplicit-fallthrough=2 -C $(BUILD_DIR) M=$(PWD) modules
    $(RM) *.mod.c *.o .*.cmd *.symvers

install:
    $(info Install)
#ifeq ($(shell expr $(MAJORVERSION) \>= 5), 1)
    install -d $(LON_DIR)
    $(MAKE) INSTALL_MOD_DIR=$(install_path) -C $(BUILD_DIR) M=$(PWD) modules_install
    su -c "/sbin/depmod -a"
    modprobe $(module_lc)

uninstall:
    $(info Uninstall)
    $(info modprobe-r)
    modprobe -r $(module_lc)
    - rm -r $(RM_PATH)
    depmod -A

clean:
    #$(RM) *.mod.c *.o *.o.* *.ko .*.cmd *.symvers *.o.ur-safe *.mod
    $(RM) .??*.cmd .tmp_versions *.ko *.o Module.symvers modules.order
    make -C $(BUILD_DIR) M=$(PWD) clean



On 4/17/24 05:42, Jmarts wrote:

Thanks for the reply & code - got that in the repo now, I'm still getting some more issues mainly due to time classes:

home/josh/lontalk/u50/lon-driver/u50/include/U50Link.h:68:9: error: unknown type name ‘time_t’
68 | time_t m_tStartup; // for reboot control.
| ^~~~~~
/home/josh/lontalk/u50/lon-driver/u50/U50Link.c: In function ‘U50LinkStart’:
/home/josh/lontalk/u50/lon-driver/u50/U50Link.c:214:25: error: storage size of ‘ts’ isn’t known
214 | struct timespec ts;
| ^~
/home/josh/lontalk/u50/lon-driver/u50/U50Link.c:241:9: error: implicit declaration of function ‘getnstimeofday’ [-Werror=implicit-function-declaration]
241 | getnstimeofday(&ts);

Would it be possible to see your Makefile? Some of these issues look like its due to needed different flags while building


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: <izot/lon-driver/issues/3/2061170798@github.com>


--------------suwUKzIOmhnpYp70rnAXInK5--

--------------fmWjBhvDZJnVwzihrXx2zO6X Content-Type: text/vcard; charset="UTF-8"; name="stan.vcf" Content-Disposition: attachment; filename="stan.vcf" Content-Transfer-Encoding: base64

QkVHSU46VkNBUkQNCkZOOlN0YW4gRGlja2Vyc29uDQpOOkRpY2tlcnNvbjtTdGFuOzs7DQpP Ukc6RW5lcmd5IENvbnRyb2wgU3lzdGVtcw0KQURSOjs7Mjk0MC1BIENvbGUgQ291cnQ7Tm9y Y3Jvc3M7R0E7MzAwNzE7VVNBDQpFTUFJTDtQUkVGPTE6c3RhbkBlbmVyZ3ljb250cm9sc3lz dGVtcy5jb20NClRJVExFOlByb2R1Y3QgRGV2ZWxvcG1lbnQgRW5naW5lZXINClRFTDtUWVBF PXdvcms6NDA0LTQzMi03MDkxDQpURUw7VFlQRT1jZWxsOjQwNC00MzItNzA5MQ0KWC1NT1pJ TExBLUhUTUw6VFJVRQ0KVVJMOnd3dy5lbmVyZ3ljb250cm9sc3lzdGVtcy5jb20NClRaO1ZB TFVFPVRFWFQ6QW1lcmljYS9QaG9lbml4DQpFTkQ6VkNBUkQNCg==

--------------fmWjBhvDZJnVwzihrXx2zO6X--

joshmarshall1995 commented 6 months ago

Thankyou! I'll see if that makes any difference but have a feeling I need to fiddle with the code some more to port it.

Possibly compress folder and send in email? Would be much appreciated. Did you have to make lots of code changes due to different dependencies?

My email is: jgmarshall95@gmail.com