Jump to content
Electronics-Lab.com Community

BreanneJJustice

Members
  • Posts

    2
  • Joined

  • Last visited

Reputation Activity

  1. Like
    BreanneJJustice reacted to Forlinx in How to Support Virtual Network on Linux 4.1.15?   
    Taking the FETMX6ULL-C platform as an example, if you want to use VPN, you need to open the tun configuration in the kernel in the following way:
    Kernel Compilation
    Choose either of the two methods below:
    1. Modify the.config file directly
    Locate the.config file in the kernel source path.

    Find the CONFIG _ TUN in the file and modify it as follows:

    Replace the kernel's config file with .config.

    * Subject to actual use.
    Recompile the kernel.

    2. Configure the TUN using the graphical configuration interface
    Make menuconfig.
    Locate the following locations:

    Save and exit after modification, which can be seen in.config

    Replace the kernel's config file with .config.

    * Subject to actual use.
    Recompile the kernel.

    Update kernel:
    The arch/arm/boot/zImage file is generated after compilation, and the kernel can be replaced either by updating the kernel separately or by re-burning it.
    Use this file to replace the file with the same name in the target path of the flashing tool.
    Refer to the single-step kernel update chapter of the FETmx6ull-c User's Manual to replace the zImage file separately.
    Compilation module:
    In the kernel source code, some of the drivers are compiled in the form of modules, which are loaded from the specified path by the kernel version number when the system boots. When we recompile the kernel and update the kernel, the kernel version number in the system will be changed, the kernel version number can be viewed through the uname -r command. When you update the kernel, the uname -r version number changes, but the version number in the path where the module is stored (/lib/modules/) does not change. It may cause the module to fail to load, typically after updating the kernel, WiFi cannot be used.
    As seen below, the name under uanme -r and the name under /lib/modules/ are not the same, so you can't load the module when you go to the/lib/modules/$(uname -r) directory when booting up, and you need to change both names to be the same.

    You can solve this problem in two ways:
    1. Modify the module load path and change to the version number of the kernel;

    2. Repackage modules;
    The first method has two disadvantages:
    a. Not suitable for batch modification;
    b. Not suitable for changing the module driver;
    So it is possible to repackage the module when compiling the kernel:

    After executing the above operation, .tmp/root/modules.tar.bz2 will be generated, which can replace the file with the same name under the target path in the flashing tool.
    It is also extracted directly in the file system:

  2. Like
    BreanneJJustice reacted to MENG XI in How to easily turn on/off all debug message on Arduino IDE   
    Introduction
    Arduino IDE is a convenient tool to write your code and upload to microcontrollers. However, it doesn’t come with debugger function, which means the only way to debug our program is through using debug message through standard output, in this case, Serial Monitor.
    Debug message is handy and it helps to print out the information the registers holds at a specific time, but once you have done debugging and your program is ready to go, we often have to delete/comment out those debug message code manually, in a big project, this could be problematic as there are just too manny of them.
    Today, I am going to show you an easy method to turn on / off debug message with only a few lines of code.
    Method
    Take a look of the following C code,
    //#define __DEBUG__ #ifdef __DEBUG__ #define DEBUG(...) printf(__VA_ARGS__) #else #define DEBUG(...) #endif Since all Ameba microcontroller supports printf(), we can re-define printf() to a preprocessor function, in this case, I name it DEBUG(). Whenever you want to print out the debug message, instead of Serial.print() or printf(), you should try using DEBUG() instead, it works just like the previous two, but can be easily enabled or disabled by uncomment //#define __DEBUG__ or just leave the comment syntax there.
    Let’s look at an example
    Example code 1
    This is a simple code that only print out “Debug msg 1” and “Debug msg 2” alternatively with a 1 second delay in between.
     
    Screenshot 2021-01-22 1639441919×1079 173 KB  
    Note that the first line of the code is uncommented, and we are seeing the debug messages actually got printed out using the DEBUG() function.
    Example code 2
     
    Screenshot 2021-01-22 1641171920×1077 127 KB  
    Note that this is the same code except I keep the first line commented out, and as a result, no debug messages got print out at all.
    It works! 
    Conclusion
    All you need to do is to copy the few lines of code from above into the top of your arduino sketch and you may name your custom debug function anything you like and it will work like a charm.
    Turn on / off is just to keep / remove the // at the first line, very convenient.
    Hope you like this content, stay healthy and happy coding~ 
  3. Like
    BreanneJJustice reacted to MrNams in How to easily turn on/off all debug message on Arduino IDE   
    But even if we disable debug, it will call print method and do not print anything.
    I mean we should make it something like
    #ifdef DEBUG Serial.print("\n debug controlled print"); #endif Here when we disable macro, its like code is not written for compiler, code will be removed in macro processing itself.
     
×
  • Create New...