We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

Problem: OpenWRT lora_gateway-5.0.1 compile as DEBUG enable



  • @optech For me the easiest solution is to fork the package then add the forked package to the feeds. Since you're going to have to release the source to your package anyway, you may as well set up the repository.

    I personally prefer to use NetBeans for my coding so working with the repository is seamless.


  • administrators

    @optech what @crispyoz is also a valid method. That's what you'll eventually need to do to consistently build your package.

    What I was suggesting is quicker for early development and debugging.

    Here is a more in-depth explanation of how to build a package with local application source code:

    1. In the build system (assuming ~/source), run make menuconfig and make sure your package is selected for compilation
    2. Download the source code for your package somewhere to your computer, let's say ~/lora_gateway/
    3. Make your changes to the source code in the ~/lora_gateway/ directory
    4. Go back to the build system at ~/source
    5. Following the openwrt guide on working for local application source code, you will then run:
      • make package/awesome_app/clean V=s
      • make package/awesome_app/prepare USE_SOURCE_DIR=~/src/awesome_src V=s
      • make package/awesome_app/clean V=s
      • (But replace awesome_app with the name of your package, and ~/src/awesome_src with the ~/lora_gateway directory from step 2)
    6. Compile just your package by running make package/awesome_app/compile but replace awesome_app with the name of your package. (More info on building a single package here)


  • @Lazar-Demin and @crispyoz Firstly, thank you all for trying to help me.i am really stuck at this point šŸ™‚

    • I copied "openwrt/build_dir/target-mipsel_24kc_musl/lora_gateway-5.0.1" directory to "~/OpenWRT/lora_gateway-5.0.1" path. this directory includes sources.
    • When I try to execute "make ~/OpenWRT/lora_gateway-5.0.1/clean V=s", i got an error like "make: *** No rule to make target '/home/ahmet/OpenWRT/lora_gateway-5.0.1/clean'."

    Another two comments:
    *When I execute "make clean" in "~/OpenWRT/lora_gateway-5.0.1", it completes the job but do not delete the binaries in "~/OpenWRT/lora_gateway-5.0.1/bin"
    *it is same for compile, it compiles but I guess to the original path...

    Could you advice me something at this point?

    I probably making a basic issue wrong šŸ™‚



  • @optech Are you using OpenWrt 18 or 19, your initial message states you are using 18.06 but the directory you refer to is 19. I'll try to duplicate your issue but I want to be sure I am using the correct source pool.



  • @crispyoz probably you can reproduce the problem for both 18 or 19.

    Firstly 18.06 was loaded in my system but I was editing 19.07 lora_gateway-5.0.1 sources to load 18.06 system šŸ™‚ But now i switched to 19.07 completely.



  • @optech try this:

    make menuconfig
    Check "Enable package source tree override" in the "Advanced configuration options (for developers)" menu
    exit and save

    make package/feeds/packages/lora-gateway-hal/clean V=s
    make package/feeds/packages/lora-gateway-hal/prepare USE_SOURCE_DIR=~/lora_gateway-5.0.1 V=s
    make package/feeds/packages/lora-gateway-hal/compile V=s



  • @optech I should mention that if all you want to do is turn on the debug options you can just tweak the patch file because this overrides the library.cfg settings. To do this just edit package/feeds/packages/net/lora-gateway-hal/patches/0001-add-cmake-support.patch

    Line 126 has the debug options you are looking for, just change the OFF to ON for the required options, then clean and make build again and you'll see the debug options you set are turned on.

    SPI_DEV_PATH is set in package/feeds/packages/net/lora-gateway-hal/patches/0002-add-preprocessing-for-SPI_DEV_PATH-and-SPI_SPEED.patch



  • @crispyoz I tried your advices as you commented.

    • I done --> "Check "Enable package source tree override" in the "Advanced configuration options (for developers)" " step

    • "make package/feeds/packages/lora-gateway-hal/clean V=s" is ok.

    • "make package/feeds/packages/lora-gateway-hal/prepare USE_SOURCE_DIR=~/lora_gateway-5.0.1 V=s" delete "lora_gateway-5.0.1" folder from main path, then creates a symbolic link to "~/lora_gateway-5.0.1".

    • "make package/feeds/packages/lora-gateway-hal/compile V=s" compiles well but the result is same as before, no output as my changes in source codes or header/configuration files.

    This operation just changes the path of "lora_gateway-5.0.1"... šŸ˜•

    If I execute a "make package/feeds/packages/lora-gateway-hal/clean V=s", it deletes the symbolic link. So, if I compile again, it download the "lora_gateway-5.0.1" folder again to the original path, then compile the original code... šŸ˜–



  • @crispyoz I tried the edit the patch file also. I made :

    +option(DEBUG_SPI "Active debug mode in SPI module" ON)
    +option(DEBUG_REG "Active debug mode in REG module" ON)
    

    But when i load the executable file (util_spi_stress) to omega2s+ as getting from "lora_gateway-5.0.1/bin", i can not see any debug output.

    But this time i see changes in config.h:

    #define DEBUG_AUX 0
    #define DEBUG_SPI 1
    #define DEBUG_REG 1
    #define DEBUG_HAL 0
    #define DEBUG_GPS 0
    #define DEBUG_GPIO 0
    #define DEBUG_LBT 0
    

    Do you think it is correct path for compiled executable? --> "lora_gateway-5.0.1/bin" ???

    By the way, I wanna edit sources also to solve a communication problem as looking debug outputs...



  • @optech if you look at the code it doesn't log much at all, regardless of the debug settings.

    clean does remove the symlink. This is basically a hack so it's always going to be a pain. This is why my original suggestion was to fork the source and set up your own package so you have control of the code.



  • This post is deleted!


  • @crispyoz How can i set up a separate package ? When I copy and compile separately at different location, it compiles but no changes at output (changes for source codes and configs)? I mean not for just debug outputs, i cant get results for source code changes too.. Could you tried something at your side to reproduce the problem with a small source code change(like console print text change)?



  • @crispyoz I cloned "https://github.com/Lora-net/lora_gateway.git" repository and I made cross compile settings. Then I can see the results what i did šŸ™‚ Thank you for your help @crispyoz and @Lazar-Demin



  • @optech Congratulations.
    This was my original advice, because the other methods are really workarounds/hacks/shortcuts. In my experience shortcuts rarely are that.



  • @crispyoz Yes it is. I remember. Thank you šŸ™‚



Looks like your connection to Community was lost, please wait while we try to reconnect.