[Solved] Compiling WiFi Driver

Hi,

I am working on updating some wifi-driver software. I am trying to build it for a wp85 board. I went through the setup here: Install the Application Framework - Legato Docs , and installed everything. Here is running cfgLegato which sets up the development environment variables:

mangoh@mangoh-virtualbox:~/repos/legato-af-16.10.3$ cfgLegato
Modules: wp85, wp750x
SDK Path: /home/mangoh/legato/packages/legato.sdk.17.6.0.wp85-wp75-native-x86_64-201707120921
Framework Path: /home/mangoh/legato/packages/legato.framework.17.6.0.wp85-wp750x-201707120855 - $LEGATO_ROOT
Toolchain Path: /home/mangoh/legato/packages/legato.toolchain.1.7.3.SWI9X15Y_07121000-wp85-wp750x-native-x86_64-201707120848 - $WP85_TOOLCHAIN_DIR $WP750X_TOOLCHAIN_DIR
Device Image Path: /home/mangoh/legato/packages/legato.device.image.7.12.10.00.wpX5-201707120854 - $LEGATO_DEVICE_IMAGE
Recovery tools Path: /home/mangoh/legato/packages/legato.recovery.4.0.6.1.linux-201704190909 - $LEGATO_RECOVERY
No toolchain found for target ‘ar7’.
Unable to find compatible cross-build toolchain for target ‘ar7’.
No toolchain found for target ‘ar86’.
Unable to find compatible cross-build toolchain for target ‘ar86’.
Toolchain specified for target ‘wp76xx’ is invalid.
Unable to find compatible cross-build toolchain for target ‘wp76xx’.
Toolchain specified for target ‘ar758x’ is invalid.
Unable to find compatible cross-build toolchain for target ‘ar758x’.
Toolchain specified for target ‘ar759x’ is invalid.
Unable to find compatible cross-build toolchain for target ‘ar759x’.
Toolchain specified for target ‘em75xx’ is invalid.
Unable to find compatible cross-build toolchain for target ‘em75xx’.
/home/mangoh/repos/legato-af-16.10.3

I cloned the repo here: GitHub - legatoproject/legato-WiFi: WiFi support for Legato and tried to make and got an error that a source file could not be found…:

********************* VERSION ********************
Legato WiFi version is 17.09.0-7-g5445645


make -C /home/mangoh/repos/legato-WiFi/service wp85
make[1]: Entering directory ‘/home/mangoh/repos/legato-WiFi/service’
mkapp -v -t wp85
-i /home/mangoh/repos/legato-WiFi/platformAdaptor/inc/
wifiService.adef
Env var ‘WP77XX_TOOLCHAIN_DIR=/opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi’ became ‘SHELL=/bin/bash’.
Environment variables are different this time.
Parsing file: ‘/home/mangoh/repos/legato-WiFi/service/wifiService.adef’.
Modelling application: ‘wifiService’
defined in ‘/home/mangoh/repos/legato-WiFi/service/wifiService.adef’
Application ‘wifiService’ contains executable ‘wifiService’.
Parsing file: ‘/home/mangoh/repos/legato-WiFi/service/daemon/Component.cdef’.
Modelling component: ‘daemon’
found at: ‘/home/mangoh/repos/legato-WiFi/service/daemon’
** ERROR:
/home/mangoh/repos/legato-WiFi/service/daemon/Component.cdef:15:4: error: Couldn’t find source file ‘/home/mangoh/repos/legato-WiFi/…/service/platformAdaptor/ti/pa_wifi_client_ti.c’
Makefile:10: recipe for target ‘wp85’ failed
make[1]: *** [wp85] Error 1
make[1]: Leaving directory ‘/home/mangoh/repos/legato-WiFi/service’
Makefile:86: recipe for target ‘/home/mangoh/repos/legato-WiFi/service/wifiService.wp85.update’ failed
make: *** [/home/mangoh/repos/legato-WiFi/service/wifiService.wp85.update] Error 2

Now, I don’t think it would make it much further than this step anyways, because when I go into some C files, such as the one in legato-WiFi(from the github link)/apps/sample/wifiWebAp/wifiWebApComponent/wifiWebAp.c, there is contained:
#include legato.h
#include interfaces.h

From cfgLegato, we can see that the framework path is here:/home/mangoh/legato/packages/legato.framework.17.6.0.wp85-wp750x-201707120855, and if we go a bit deeper, there is a legato.h library at $THAT_PATH/resources/legato/framework/c/inc/legato.h. But if we replace “legato.h” from the C files with this one, this .h file does not include the function declarations necessary for the wifi drivers…

My question is, did I install the legato framework correctly? If so, where could I go about getting the proper source files? Where can I find the proper .h files?

If there is any reference material that you have, please point me in the right direction!

Thank you in advacne

Is it not possible to build the wifi drivers?

If you got legato using repo, then I think that you shouldn’t have to clone https://github.com/legatoproject/legato-WiFi.git manually because repo should have put it under legato/modules/WiFi/.

Are you trying to use the WiFi IoT card or are you trying to use a different WiFi adapter?

The WiFi IoT card. For clarification, the command line tools work, but in order to implement a callback function I need to be able to compile the native C. And if I go into legato-17.10.0 and try to compile, i get the same issue with the file not found, but the file does exist… :

./modules/WiFi/service/platformAdaptor/ti/pa_wifi_client_ti.c
./modules/WiFi/service/platformAdaptor/ti_simu/pa_wifi_client_ti.c
mangoh@mangoh-virtualbox:~/repos/legato-17.10.0$

there seems to be something up with the makefile? How is it not finding that?

Are you trying to write a client that makes use of the le_wifiClient.api exposed by the wifiService app?

Yes, exactly! Except for le_wifiAp rather than le_wifiClient. What I would like to do is write a C program that uses the le_wifiAP api so that I can start and stop the AP and trigger callback code when new devices are connected.

OK, I can build the apps if I move to the large legato-af github repository like you mentioned, this is great news! But there is another problem -

If I install any of the apps WITHOUT modifying them, I get an error[1] about a protocol ID, which is not very descriptive. I assume this is because the legato development environment is 17.10 , while my legato version on the board is 16.10.

As far as I can tell, there is no board version for 17.10, is this correct? The new firmware release from Jan 13 is here :https://source.sierrawireless.com/resources/airprime/software/wpx5xx/wpx5xx-firmware-latest-release/ , and the version is 16.10.04

So, I downloaded the releases for both 16.10.1 and 16.10.3 and I get an error building both platforms, the same error here:

mangoh@mangoh-virtualbox:~/repos/legato-af-16.10.3$ ./bin/legs
Using legato framework found under ‘/home/mangoh/repos/legato-af-16.10.3/.’
mangoh@mangoh-virtualbox:~/repos/legato-af-16.10.3$ export PATH=/home/mangoh/repos/legato-af-16.10.3/./bin:/home/mangoh/repos/legato-af-16.10.3/./bin:/home/mangoh/legato/packages/legato.framework.17.6.0.wp85-wp750x-201707120855/resources/legato/bin:/home/mangoh/bin:/home/mangoh/.local/bin:/home/mangoh/bin:/home/mangoh/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/mangoh/legato/packages/legato.framework.17.6.0.wp85-wp750x-201707120855/resources/legato/build/localhost/bin:/home/mangoh/repos/legato-af-16.10.3/./build/localhost/framework/bin:/home/mangoh/repos/legato-af-16.10.3/./build/localhost/framework/bin
mangoh@mangoh-virtualbox:~/repos/legato-af-16.10.3$ source /home/mangoh/repos/legato-af-16.10.3/./framework/tools/scripts/configToolchainDirEnvVars
No toolchain found for target ‘ar7’.
Unable to find compatible cross-build toolchain for target ‘ar7’.
No toolchain found for target ‘ar86’.
Unable to find compatible cross-build toolchain for target ‘ar86’.
mangoh@mangoh-virtualbox:~/repos/legato-af-16.10.3$ exec <> /dev/tty
mangoh@mangoh-virtualbox:~/repos/legato-af-16.10.3$ make wp85
make -f Makefile.hostTools
make[1]: Entering directory ‘/home/mangoh/repos/legato-af-16.10.3’
Using ninja installed at: /usr/bin/ninja
ln -sf …/build/tools/mk bin/mk
ln -sf mk bin/mkcomp
ln -sf mk bin/mkexe
ln -sf mk bin/mkapp
ln -sf mk bin/mksys
ln -sf …/framework/tools/scripts/findtoolchain …/framework/tools/scripts/instsys …/framework/tools/scripts/settime …/framework/tools/scripts/mkinfo …/framework/tools/scripts/instlegato …/framework/tools/scripts/stoplegato …/framework/tools/scripts/settz …/framework/tools/scripts/createsdk …/framework/tools/scripts/legato-qemu …/framework/tools/scripts/checkpa …/framework/tools/scripts/update-pack …/framework/tools/scripts/security-pack …/framework/tools/scripts/instapp …/framework/tools/scripts/mklegatoimg …/framework/tools/scripts/app …/framework/tools/scripts/av-pack …/framework/tools/scripts/releaselegato …/framework/tools/scripts/sbhelper …/framework/tools/scripts/systocwe …/framework/tools/scripts/configlegatoenv …/framework/tools/scripts/update …/framework/tools/scripts/configtargetssh …/framework/tools/scripts/legs …/framework/tools/scripts/gettargettype …/framework/tools/scripts/update-util …/framework/tools/scripts/configToolchainDirEnvVars …/framework/tools/scripts/simu …/framework/tools/scripts/fwupdate …/framework/tools/scripts/setname …/framework/tools/scripts/mkdoc …/framework/tools/scripts/startlegato …/framework/tools/scripts/shlib bin/
ln -sf …/framework/tools/ifgen/ifgen bin/
ninja -f /home/mangoh/repos/legato-af-16.10.3/build/tools/build.ninja
ninja: no work to do.
make[1]: Leaving directory ‘/home/mangoh/repos/legato-af-16.10.3’
‘platformAdaptor’ directory is missing, which means these Legato sources have not been downloaded properly.
Please refer to GitHub - legatoproject/legato-af: Legato Application Framework
Makefile:174: recipe for target ‘platformAdaptor’ failed
make: *** [platformAdaptor] Error 1
mangoh@mangoh-virtualbox:~/repos/legato-af-16.10.3$

So, at this point I’m pretty lost. legato-17 will build, but when updated to the device, the app crashes. And for versions earlier than this, I can’t build. What is the next step? Thanks for your help!

Error[1]

Jan 19 16:25:25 swi-mdm9x15 user.err Legato: =ERR= | serviceDirectory[472]/serviceDirectory_exe T=main | serviceDirectory.c DispatchToServer() 713 | Client (uid 0 ‘root’, pid 1894) disagrees with server (uid 0 ‘root’, pid 534) on protocol ID of service 'wifiApTest.wifiApT
Jan 19 16:25:25 swi-mdm9x15 user.emerg Legato: EMR | UNKNOWN[1894]/framework T=main | LE_FILENAME ReceiveSessionOpenResponse() 684 | Unexpected server response: -6 (LE_FAULT).
Jan 19 16:25:26 swi-mdm9x15 user.info Legato: INFO | supervisor[468]/supervisor T=main | proc.c proc_SigChildHandler() 1942 | Process ‘wifiApTest’ (PID: 1894) has exited with exit code 1.
Jan 19 16:25:26 swi-mdm9x15 user.info Legato: INFO | supervisor[468]/supervisor T=main | proc.c GetFaultAction() 1744 | No fault action specified for process ‘wifiApTest’. Assuming ‘ignore’.
Jan 19 16:25:26 swi-mdm9x15 user.warn Legato: -WRN- | _appStopClient[1895]/framework T=main | LE_FILENAME CreateSocket() 550 | Socket opened as standard i/o file descriptor 2!
Jan 19 16:25:26 swi-mdm9x15 user.warn Legato: -WRN- | supervisor[468]/supervisor T=main | app.c app_SigChildHandler() 3221 | Process ‘wifiApTest’ in app ‘wifiApTest’ faulted: Ignored.
Jan 19 16:25:26 swi-mdm9x15 user.info Legato: INFO | supervisor[468]/supervisor T=main | apps.c DeactivateAppContainer() 340 | Application ‘wifiApTest’ has stopped.

I recommend upgrading your Legato on your target to 17.11.0 (and 18.01.0 when it is released). Although this isn’t a configuration “officially” supported by the WP team, you will have a much better experience than trying to stick with 16.10.3.

@dfrey Thanks for your help, upgrading worked !