Robust C Library and Utility for GPIO sysfs Interface in Linux

Thisis a comprehensive and easy to read example C code designed to work alone or included as a library for dealing with general purpose I/O via the sysfs interface in Linux. It can easily be applied to any computer which utilizes the GPIO sysfs interface (both pro and maker boards). Getting started is a breeze. You just need to decide if you’re going to use it as a library, including it into your existing code, or as a stand-alone utility. We’ll talk about both in this article, but first and foremost, here’s the source code we’ll be working with:

https://github.com/embeddedts/gpio-sysfs-demo

Continue reading “Robust C Library and Utility for GPIO sysfs Interface in Linux”

How To Compile the Mainline Linux Kernel v4.9 for TS-4900

embedded-linux-ts-board

Here’s a quick how-to guide straight from one of our engineers on how to compile the mainline Linux Kernel v4.9-rc1 and install it on the TS-4900. Support for the TS-4900 in the mainline kernel image (v4.9 and up) is a pretty big deal for us, and we’re excited about it. A big shout out to our friends at Savoir-faire Linux for their hard work in making this happen!

Step 1: Install the Toolchain

We need to install the toolchain from Ubuntu or Debian Jessie by running the following command:              Home

apt-get install gcc-arm-linux-gnueabihf build-essential lzop u-boot-tools libncursesw5-dev -y

Continue reading “How To Compile the Mainline Linux Kernel v4.9 for TS-4900”

What I Wish I’d Known When I Was an Embedded Linux Newbie

embedded-linux-ts-board

Here are some tips compiled from our seasoned engineers on what they wish they’d known about embedded linux back when they were “newbs.” Newcomers and seasoned veterans alike should get some good nuggets of information and possibly a fun perspective looking back at our own humble beginnings. We’ll try not to overwhelm you as we make our way through the list. We’re not here to rewrite the books, but do want to provide a personal perspective. If you’re in the camp of people who’ve been using desktop Linux, just be aware embedded Linux is a different animal, especially when it comes to space constraints, different CPU architecture (ARM), resilience to sudden power outages, and inability to install any mainline Linux kernel or distribution you please. And maybe you’re in the microprocessor camp moving towards a more generalized and capable embedded Linux system. Either way, we’ll assume you have at least some knowledge of Linux as we walk through this guide.

Continue reading “What I Wish I’d Known When I Was an Embedded Linux Newbie”

Tag Jumping in a Codebase Using ctags and cscope in Vim

Introduction

Tag jumping is immensely helpful when developing in a CLI environment such as Vim or Emacs. Simply place a marker over the function, variable, class, macro, etc. and with a keystroke, jump to the declaration or view other references across multiple files. This productivity tool will help you develop and debug faster and get a better understanding of your codebase.

There are two main solutions for tag jumping: ctags and cscope. Both are very similar in how they function: scan a codebase and index keywords (tags) and their locations. Vim understands the index and provides you with an interface for jumping back and forth between the tags.

The differences between the two are small, but important to distinguish. With ctags, you can use autocomplete (aka omnicomplete) for function and variable names as you type, something cscope doesn’t give you. Also, there’s much less setup to get ctags up and running as it’s generally already installed. The downside is ctags doesn’t do as well as cscope with a conglomerated or mostly unknown codebase. The good news is, they can co-exist!    Home

We’re going to take a look at setting up and basic usage of both in this guide. If you need a diverse codebase to try this out on, try cloning a random trending c repository from GitHub. I settled on grpc/grpc because it was large and varied enough to really put ctags and cscope to the test.

Continue reading “Tag Jumping in a Codebase Using ctags and cscope in Vim”