Recompiling and load existing package with changes

This is probably a basic question, but not sure the steps involved.

I am trying to use the existing gnss calls with python, which works fine, but instead of getting text status
‘Success!’ or ‘The GNSS device is already started’ which is returned to my python subprocess function call,
I would like to just receive an integer so I don’t have to try to pattern match every single thing the system might return.

So how do I take the code found here:

here is an example…

static int Enable
(
    void
)
{
    le_result_t result = LE_FAULT;

    result = le_gnss_Enable();

    switch (result)
    {
        case LE_OK:
            printf("Success!\n");
            break;
        case LE_DUPLICATE:
            printf("The GNSS device is already enabled\n");
            break;
        case LE_NOT_PERMITTED:
            printf("The GNSS device is not initialized\n");
            break;
        case LE_FAULT:
            printf("Failed to enable GNSS device\n");
            break;
        default:
            printf("Invalid status\n");
            break;
    }

    return (LE_OK == result) ? EXIT_SUCCESS : EXIT_FAILURE;
}

Would be revised to:

static int Enable
(
    void
)
{
    le_result_t result = LE_FAULT;

    result = le_gnss_Enable();

    switch (result)
    {
        case LE_OK:
            #printf("Success!\n");
            ***Return 1;  ***
            break;
        case LE_DUPLICATE:
            #printf("The GNSS device is already enabled\n");
            ***Return 1;  ***
            break;
        case LE_NOT_PERMITTED:
            #printf("The GNSS device is not initialized\n");
            ***Return 0;  ***
            break;
        case LE_FAULT:
            #printf("Failed to enable GNSS device\n");
            ***Return 2;  ***
            break;
        default:
            printf("Invalid status\n");
            ***Return 3;  ***
            break;
    }

    return (LE_OK == result) ? EXIT_SUCCESS : EXIT_FAILURE;
}

So an integer (0-3) returned instead of status text.
(I realize that my revised code is probably NOT correct c, just trying to show what I need to accomplish)

Once I make the change, how do I re-compile and reload this on the FX30?

Do I have to use Leaf or can I somehow compile it and upload it with SCP or perhaps load raw c and compile it on the device?
Leaf is not working to well for me, as I keep getting errors when trying to load sample code.

I have a tried using leaf with a Debian 11 on Virtualbox, but the sample apps never seem to compile correctly on the FX30 and I haven’t had much luck figuring out all the errors.

Thanks.

you need to compile the legato.cwe in leaf shell:

In your case will be using “make wp77xx”

I was using make wp77xx but from the command line as I was using the command line debian and not using VS code inside of debian as I didn’t have a desktop environment installed, so I didn’t install VS code.

I did get leaf installed, I did get the latest version of the Fx30 code using the search function, and got all the way to the make step and it craps out with errors.

I received a bunch of compile errors, and I wasn’t able to capture them all because they scrolled up in the virtualbox window and there was no way to scroll up to see them.

Should I try a full debian install with a desktop environment?

I have to re-compile the entire legato? I can’t just do the single module /app ?

When I installed the python app, it was just a pyrte.wp77xx.update file that could be SCP over to the unit and then running update locally and it was installed super easy. That is what I would like to do if possible.

root@fx30s:/tmp# update pyrte.wp77xx.update
Unpacking package: 100% ++++++++++++++++++++++++++++++++++++++++++++++++++
Applying update: 100% ++++++++++++++++++++++++++++++++++++++++++++++++++
SUCCESS
root@fx30s:/tmp# update --mark-good
System is now marked 'Good'.
root@fx30s:/tmp#

About halfway down the page…
https://bitbucket.org/m2mconnectivity/pyrtedoc/wiki/Home

The author does not give the source code or tell how he made the update file however.

you can try in ubuntu16 or ubuntu 18 desktop environment

Ok, I am installing a full Ub18 in a virtualbox and will report back when I get leaf and visualcode installed.

Thanks.

I installed Ubuntu 18 into virtual box with visual code, installed leaf, and got to Step 7 in the VS code / leaf integration.

I do have the leaf icon and the legato icon along the left side…

My Legato: Hiearchy View is Blank.

I have closed and re-started VS code and it never asks me to create a new system.

At the bottom of the VS Code window, I do see my FX30Stable (current leaf profile) and mySystem.sdef, but not sure what to do now to get the hierarchy populated.

Additionally, on the right side of VS Code, I have an error: Couldn’t find file ‘AirVantage/le_avc.api.’

I tried to updating mySystem.sdef file with:

#include $LEGATO_ROOT/default.sdef

interfaceSearch:
{
$LEGATO_ROOT/interfaces/airVantage
}

But that doesn’t make the error go away.

also $LEGATO_ROOT/interfaces/ is empty. It never told me to put anything in there.


UPDATE for future users…


I still needed to install cmake, guess the leaf installation missed it or assumed I had it.
sudo apt-get install cmake

Make sure you are running all your make commands from the correct profile directory in my case:

home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato
(the fx30stable is what I chose to name my profile)

Also the make command has to be entered in leaf shell.

home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato/ leaf shell
(lsh:fx30stable) <— NOTICE THIS WHEN IN SHELL

then type:

make clean (should take a few seconds), then

make wp77xx on my VirtualBox with 4 GB Ram took about 10 mins

Thanks.

Did you try to do “make wp77xx” inside leaf shell?

I didn’t know I needed to make it when installing. I thought that was just when you are compiling a new program.

here are the results…

make wp77xx
make: *** No rule to make target ‘wp77xx’. Stop
make fx30stable
make: *** No rule to make target ‘fx30stable’. Stop

fx30stable is what I named the target when I downloaded it.

I just thought of something…

the target I downloaded was swi-fx30-catm_4.2.0 since that is what I am using an FX30S
Is that ok to use or should I have downloaded the swi-wp77_6.0.1 ?
They are both Release 15.1 and Legato 21.05

Thanks.

after “leaf shell”, which directory are you typing the “make wp77xx”?

As an example on my side with wp76xx, I type the command “make wp76xx” in
/home/owner/leaf/leaf-data/wp76/wp76-legato/build/wp76xx/

BTW, you better use the package of fx30 instead of that of wp77

Ok. that was partially the problem. I was in the wrong directory.

Now I am in…

home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato/build/wp77xx

wp77xx and tools are the only option under build there…

make wp77xx
make: *** No rule to make target ‘wp77xx’. Stop

Where should $LEGATO_ROOT point to?

sorry, should be this path:

home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato

So $LEGATO_ROOT should point to home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato?

After install it was pointing to: home/me/

I then revised it to point to: home/me/myWorkspace/ because when I looked at some of the code, it did not have the full path from myWorkspace.

The docs don’t tell you where it points, they just say it will be setup

  • $LEGATO_ROOT - resolves to the location of the Legato Application Framework for your profile

Ok . I changed $LEGATO_ROOT to home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato

I double checked with cd $LEGATO_ROOT and it does take me to that directory.
I tried make wp77xx from $LEGATO_ROOT and from home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato/build/wp77xx and neither work.

home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato/build/wp77xx/make wp77xxx
make: *** No rule to make target ‘wp77xx’. Stop
home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato/make wp77xxx
Building Legato for target 'wp77xx'
Makefile:131: build/wp77xx/.config.mk: No such file or directory
modules/WiFi/moduleDefs:12: Legato Wifi version is undefined...
Makefile:251: *** Unable to find toolchain for targer 'wp77xx'. Stop
make: *** No rule to make target ‘wp77xx’. Stop

if you do it in “leaf shell”, this path will be set automatically

Ok . I changed $LEGATO_ROOT to home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato

I double checked with cd $LEGATO_ROOT and it does take me to that directory.
I tried make wp77xx from $LEGATO_ROOT and from home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato/build/wp77xx and neither work.

home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato/build/wp77xx/make wp77xxx
make: *** No rule to make target ‘wp77xx’. Stop
home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato/make wp77xxx
Building Legato for target 'wp77xx'
Makefile:131: build/wp77xx/.config.mk: No such file or directory
modules/WiFi/moduleDefs:12: Legato Wifi version is undefined...
Makefile:251: *** Unable to find toolchain for targer 'wp77xx'. Stop
make: *** No rule to make target ‘wp77xx’. Stop

There is a Makefile in the fx30-catm-legato directory…

home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato/build/wp77xx/
–Contents–
3rdParty
config.sh
debug
framework
tools

are you doing like this?

cd home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato/
make wp77xx

Yes, I am in that directory and I type ‘make wp77xx’ and get the response below.

It appears to me there is supposed to be a .config.mk file in the build/wp77xx directory that does not exist…
I don’t have wifi, so no idea why that is there (not even an option on this modem)
No idea why it can’t find toolchain, followed the leaf docs, line by line

how about doing a “make clean” first before “make wp77xx”?

Ok. Something may be working, I will post the output…

home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato/
leaf shell
lsh:fx30stable) home/me/myWorkspace/leaf-data/fx30stable/fx30-catm-legato/make wp77xx

Started trying to compile…

Output:

(lsh:fx30stable) me@me-VirtualBox:~/myWorkspace/leaf-data/fx30stable/fx30-catm-legato$ make wp77xx
Building Legato for target 'wp77xx'
Makefile:131: build/wp77xx/.config.mk: No such file or directory
modules/WiFi/moduleDefs:12: Legato WiFi version is undefined...
  KSET      build/wp77xx/.config - TARGET_WP77XX
  KCONFIG   build/wp77xx/.config
  GEN       build/wp77xx/.config.mk
Building Legato for target 'wp77xx'
modules/WiFi/moduleDefs:12: Legato WiFi version is undefined...
  GEN       version
  GEN       build/wp77xx/framework/include/le_config.h
  MAKE      tools
make[1]: Entering directory '/home/me/.leaf/fx30-catm-legato_21.05.0'
Using ninja installed at: /usr/bin/ninja
  GEN       /home/me/.leaf/fx30-catm-legato_21.05.0/build/tools/build.ninja
Tools arch: x86_64
  MAKE      mkPatch
make[2]: Entering directory '/home/me/.leaf/fx30-catm-legato_21.05.0/framework/tools/mkPatch'
  CCLD      /home/me.leaf/fx30-catm-legato_21.05.0/bin/mkPatch
make[2]: Leaving directory '/home/me/.leaf/fx30-catm-legato_21.05.0/framework/tools/mkPatch'
  NINJA     /home/me/.leaf/fx30-catm-legato_21.05.0/build/tools/build.ninja
[87/87] Linking tool
make[1]: Leaving directory '/home/me/.leaf/fx30-catm-legato_21.05.0'
  GEN       sources.md5
  GEN       package.properties
  GEN       build/wp77xx/config.sh
  MAKE      framework
make[1]: Entering directory '/home/me/.leaf/fx30-catm-legato_21.05.0'
  GEN       /home/me/.leaf/fx30-catm-legato_21.05.0/build/wp77xx/framework/build.ninja
  NINJA     /home/me/.leaf/fx30-catm-legato_21.05.0/build/wp77xx/framework/build.ninja
[70/70] Dynamic linking liblegato
  COPY      /home/me/.leaf/fx30-catm-legato_21.05.0/build/wp77xx/framework/lib/libComponent_le_pa_start.so
  CCLD      /home/me/.leaf/fx30-catm-legato_21.05.0/build/wp77xx/framework/bin/startSystem
  MKEXE     /home/me/.leaf/fx30-catm-legato_21.05.0/build/wp77xx/framework/bin/supervisor
[55/55] Linking C executable
  MKEXE     /home/me/.leaf/fx30-catm-legato_21.05.0/build/wp77xx/framework/bin/serviceDirectory
[5/5] Linking C executable
  MKEXE     /home/me/.leaf/fx30-catm-legato_21.05.0/build/wp77xx/framework/bin/logCtrlDaemon
[14/14] Linking C executable
  MKEXE     /home/me/.leaf/fx30-catm-legato_21.05.0/build/wp77xx/framework/bin/configTree
[27/27] Linking C executable
  MKEXE     /home/me/.leaf/fx30-catm-legato_21.05.0/build/wp77xx/framework/bin/watchdog
[40/40] Linking C executable
  MKEXE     /home/me/.leaf/fx30-catm-legato_21.05.0/build/wp77xx/framework/bin/updateDaemon
[59/59] Linking C executable
  MAKE      targetTools
make[2]: Entering directory '/home/me/.leaf/fx30-catm-legato_21.05.0'
  CMAKE     /home/me/.leaf/fx30-catm-legato_21.05.0/build/wp77xx/framework/lib/libjansson.so
Makefile.targetTools:108: recipe for target '/home/me/.leaf/fx30-catm-legato_21.05.0/build/wp77xx/framework/lib/libjansson.so' failed
make[2]: *** [/home/me/.leaf/fx30-catm-legato_21.05.0/build/wp77xx/framework/lib/libjansson.so] Error 127
make[2]: Leaving directory '/home/me/.leaf/fx30-catm-legato_21.05.0'
Makefile.framework:249: recipe for target 'targetTools' failed
make[1]: *** [targetTools] Error 2
make[1]: Leaving directory '/home/me/.leaf/fx30-catm-legato_21.05.0'
Makefile:552: recipe for target 'framework' failed
make: *** [framework] Error 2

Tried make clean and ran it again, and same output as above both times…

you need to install cmake:


sudo apt-get install cmake
make clean
make wp77xx

Ok. It completed with no errors…

I still don’t have anything in Legato:Hierarchy View

I do have the leaf icon and legato symbol down the left side and then fx30stable (profile) mySystem.sdef 192.168.2.2 along the bottom edge

Also, the error for the airVantage/le_avc.api error went away, so I assume that me adding that interfaces/airVantage entry fixed that problem.

Do I need the Legato:Hierarchy View ?

If so, any idea why it might not be showing up?