Hi Claes,
I'm currently writing a driver to read DHT22 temp and humidity module for rpi and I'm stuck with my module starting in the linker step.
If you could give me a help because I'm running out of idea.
What I did so far is:
- writing my IO method (IORackInit / IOCardInit....) in a C file named rt_io_m_dht22.c
- Create two module in my class volume library name DHT22 (rack level) and DHT22_Module (card level)
- Created a makefile in $pwrp_appl with following content:
snarf_top : snarf
include $(pwr_exe)/pwrp_rules.mk
snarf_modules = $(pwrp_obj)/rt_io_m_dht22.o \
$(pwrp_obj)/rt_io_user.o
# Main rule
snarf : $(snarf_modules)
@ echo "****** Snarf modules built ******"
# Modules
$(pwrp_obj)/ra_io_m_dht22.o : \
$(pwrp_appl)/rt_io_m_dht22.c \
$(pwrp_inc)/bcm2835.h \
$(pwrp_inc)/pwr_cvoltnvclasses.h \
$(pwrp_obj)/rt_io_user.o : $(pwrp_appl)/rt_io_user.c
- Created a rt_io_user.c in $pwrp_appl with following content:
#include "rt_io_base.h"
pwr_dImport pwr_BindIoUserMethods(DHT22);
pwr_BindIoUserClasses(User) = {
pwr_BindIoUserClass(DHT22),
pwr_NullClass
};
- In my directory volume I added a BuildOptions object with the following arguments:
PlcProcess = iothread //name of my thread
SystemModules = 1 (io_user)
ObjectModules[0] = $pwrp_obj/rt_io_m_dht22.o
Building my classvolume went smoothly as the "make" command in $pwrp_appl
Building my rootvolume in force mode went well but the build node command failed with the following error:
collect2: error: ld returned 1 exit status
%GSX-F-CCERROR, Error from c compiler or linker
-- Build node greenhouse
-- Creating bootfile for node greenhouse
-- Plc thread generated priority 22, scantime 0.10000 s, 1 plcpgm's
-- Plc process compiled for arm_linux optimized -O3 -
-- Plc program linked for arm_linux plc_greenhouse_0001_plcthread
-- Plc thread generated priority 22, scantime 5.00000 s, 0 plcpgm's
-- Plc thread generated priority 22, scantime 2.00000 s, 0 plcpgm's
-- Plc process compiled for arm_linux optimized -O3 -
-- Using local option-file plc_greenhouse_0001_iothread.opt
** Plc program link errors for arm_linux node plc_greenhouse_0001_iothread
/usr/bin/ld: /usr/local/pwrp/greenhouse/bld/arm_linux/obj/rt_io_user.o:(.data+0x20): undefined reference to `pwr_gDHT22_IoUserMethods'
collect2: error: ld returned 1 exit status
%GSX-F-CCERROR, Error from c compiler or linker
the .opt file is showing correctly :
: Autogenerated options file, Do not edit !!` $pwrp_obj/rt_io_m_dht22.o $pwrp_obj/rt_io_user.o -lpwr_rt -lpwr_pnak_dummy -lpwr_cifx_dummy -lpwr_usb_dummy -lpwr_usbio_dummy -lpwr_nodave_dummy -lpwr_mqtt_dummy -lpwr_epl_dummy
What am I missing in the process ?
I can't find out my mistake
Thanks for your help
Snarf