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'


Eclipse with CMake project on windows

Published at September 12, 2020 ·  5 min read

CMake is a powerful tool to manage c/c++ projects, and I prefer to use it in on my embedded projects also. Usually, the MCU has some communication with other processors (usually PC), and CMake also allows easy integration between both projects: MCU and HOST. For example, a shared source code that simultaneously able to recompile in both processors when any change occurs in these shared files. Usually, I work in a Linux environment in the terminal where everything is installed correctly in its place, and things work great....

install linux on microzed board

Published at August 1, 2020 ·  4 min read

The microzed development board has Xilinx zynq7000 chip. It has an application process unit with cortex a9 and FPGA fabric. The board also contains interfaces like SDIO and QSPI. I want to install Linux on it directly with yocto and without petalinux, which runs yocto behind the scene, so I tried to eliminate the need to use it. Why do so? It is interesting, and I have a lot of experience with yocto and it very easy to work with its script once you know it easy porting to other processors: IMX, stm32Mp157, etc' using build tools like CMake,Autotools, and yocto scripts make it very easy to port SW between different processors....

Custom opkg repository

Published at June 18, 2020 ·  2 min read

The post presenst simple example to create opkg repository to upgrade embbded linux systems using nginx server. The opkg pakcge should be installed as part of the image furing the first instalation. To add opkg to yocto image type type folloing line in file conf/local.conf IMAGE_INSTALL_append = " opkg \ " downlad and install opkg utils: git clone git://git.yoctoproject.org/opkg-utils and create Packages.gz file: cd /path-to-yocto-build/build/tmp/deploy/ipk ~/opkg-utils/opkg-make-index . > Packages.gz install nginx I haved used gentoo system , so inorder to install nginx on gentoo type:...

Kalman filter and pair trading

Published at May 1, 2020 ·  4 min read

Pair trading is a type of cointegration approach to statistical arbitrage trading strategy in which usually a pair of stocks are tcraded in a market-neutral strategy, i.e. it doesn’t matter whether the market is trending upwards or downwards, the two open positions for each stock hedge against each other. The key challenges in pairs trading are to: Choose a pair which will give you good statistical arbitrage opportunities over time Choose the entry/exit points One of the challenges with the pair trading is that cointegration relationships are seldom static....

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 = { ....