Welcome to my thecnical blog

Welcome to my thecnical blog

Welcome to my thecnical blog

This blog is about technical stuff like: Linux, embedded, RT, algorithm, web, etc'


Simple Hello World application using qt5 for embedded Linux device.

Published at April 1, 2020 ·  2 min read

This blog presents a simple example of how to create a qt5 application for a Linux embedded device that runs Wayland or x-server. I’m using Yocto build system. I already have a BSP for IMX8 + toolchain so. I just have to install qt5 on it. In the time that I wrote this page. See here a reference to use Yocto project. bug workaroud I worked with sumo branch and had to do some work around over three bugs that I found during the compilation of qt5....

Debug Linux Kernel With Qemu

Published at March 18, 2020 ·  2 min read

I have tried to debug the Linux kernel using GDB and a system emulator qemu. I use YOCTO and standard pokey distribution to build Linux image and kernel. I made changes to the standard .config file to support debug symbols and remove the KASLR option from the kernel kernel config The kernel has to modify as the following: Build a Linux kernel with debug symbols by set: CONFIG_DEBUG_INFO=y Remove KASLR definition from the Linux kernel by unset: CONFIG_RANDOMIZE_BASE....

Linux UIO driver to handle with IRQ source.

Published at February 24, 2020 ·  6 min read

The Userspace I/O framework (UIO) is part of the Linux kernel and allows device drivers to be written almost entirely in userspace. UIO is suitable for hardware that does not fit into other kernel subsystems (Like special HW like FPGA) and allowing the programmer to write most of the driver in userspace using all standard application programming tools and libraries. This greatly simplifies the development, maintenance, and distribution of device drivers for this kind of hardware....

Install Yocto and kernel development tools of IMX8

Published at February 24, 2020 ·  2 min read

The GCC toolchain and kernel installation. The purpose of this post is to show the installation process of development tools for imx8m-var-dart, which is SOM made by Variscite. When using yocto, the kernel, userspace applications, and toolchain are part of the build. Still, when developing kernel modules, device tree changes, or userspace applications, it is more practical to make a standalone kernel build and to work on it outside the yocto....

Linux module magic info

Published at February 20, 2020 ·  3 min read

Sometimes we want to build a module separate from the kernel. When the kernel is built, it generates a magic number, which probably depends on compiler version, kernel version, git source revision, etc. Time is also probably part of this magic number, since the kernel may build with the same parameters but with a different timestamp, it will have a different magic number, and then we will get this message when we try to insert it:...

Linux char device to handle with IRQ

Published at February 20, 2020 ·  2 min read

We have an external FPGA that triggers GPIO. To handle the IRQ in userspace, it had to write a Linux chr device to control the IRQ in the kernel space and than signalize the userspace using a standard system call. Here is the simple drive: #include <linux/module.h>#include <linux/kernel.h> /* printk() */#include <linux/moduleparam.h>#include <asm/uaccess.h>#include <asm/pgtable.h>#include <linux/fs.h>#include <linux/gfp.h>#include <linux/cdev.h>#include <linux/sched.h>#include <linux/interrupt.h>#include <linux/of_address.h>#include <linux/of_irq.h>#include <linux/of_platform.h> #include <linux/semaphore.h> DECLARE_WAIT_QUEUE_HEAD(hq); static int irq_num; static int x=0; //spinlock_t mLock = SPIN_LOCK_UNLOCKED; unsigned long flags; static DEFINE_SPINLOCK(mLock); static irqreturn_t fpga_irq_handle(int irq, void *dev_id) { wake_up(&hq); // printk(KERN_DEBUG "Interrupt\n"); return IRQ_HANDLED; } static ssize_t fpga_read(struct file *file, char __user *buf,size_t count,loff_t *ppos) { wait_event(hq,x); return 0; } static struct file_operations fpga_fops = { ....

Linux module to disassemble code in the Linux kernel.

Published at February 18, 2020 ·  4 min read

Here is a simple module to disassemble memory using a Linux kernel module. This module is integrated into this module based on Zydis. Also, there is a userspace application to demonstrate the Zydis library on a test function in user space and disassembly of the same c function at the kernel space. Also can dissemble internal c functions of the kernel like printk, kmalloc, etc.' It could download the project from here....

Linux core isolation

Published at February 18, 2020 ·  1 min read

I have a real-time task that needed to run periodically at a constant rate - a continuous IRQ drives it. Just running this task on a multithreaded environment can cause it to run in different timing values. When the system runs on stress (using stress utility) the system is not a response to all IRQ requests. A possible solution to this problem is to use Linux core isolation. In this case, we assign a specific core for the task, and the Linux kernel is getting out from the SMP balancing, and this core can use for a particular job with minimal interrupts....

Color transformation from Bayer to RGB

Published at February 17, 2020 ·  4 min read

A Bayer filter mosaic is a color filter array (CFA) for arranging RGB color filters on a square grid of photosensors. Its particular arrangement of color filters is used in most single-chip digital image sensors used in digital cameras, camcorders, and scanners to create a color image. The filter pattern is 50% green, 25% red and 25% blue - see here. Color conversion algorithm The conversion algorithm is based on simple linear interpolation of pixels to find the missing value....

My First Post

Published at February 10, 2020 ·  2 min read

It is My first Hugo post. I decided to work with Hugo after I had experience with word press. I write documents in Markdown format and use GitHub to manage my files, tags, and categories instead of using MySQL database is much easier to manage and deploy. To learn how to create such a blog in Hugo, you can try this blog. Table Of Contents diagram mathematical equations Refer to table of content for more information on creating a Hugo post with a table of contents....