Since the time when a number of ARM sub-architectures are entering the ground, it's been a big headache to the maintainers of the Linux source as there were huge number of duplicates to support specific sub-architecture and board configurations making the Linux Mainline so big and clumsy. To avoid this, the team came up with an idea to keep the board specific files away from the Kernel mainline and thus the birth of Device Tree Source (.dts) files which will be compiled as separate binary, Device Tree Blob (.dtb). With device tree, it is possible to use a single kernel image on different boards using the same SoC by simply passing a different device tree containing board specific data structure.. When booting, it is the boot-loader which passes this device tree to the kernel. At present, it is made mandatory to have Device Tree. More story about device tree can be found at xillybus.com, elinux.org, freebsd.org and more. Also check this document.
Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts
June 01, 2016
March 18, 2016
Bringing Wi-Fi Client Feature on your Embedded board running GNU/Linux
To prepare your embedded board with GNU/Linux running on it, read through this link.
To bring Wi-Fi Access Point feature, read through this link.
----
To bring Wi-Fi client feature with the given NIC on your Embedded board running Linux, we may need
To bring Wi-Fi Access Point feature, read through this link.
----
To bring Wi-Fi client feature with the given NIC on your Embedded board running Linux, we may need
-
Device driver for the given NIC enabled in the Kernel.
- Some HAL layer firmware, if required by the device driver. (Ref. ath9k_htc firmware - github.com)
-
Certain utilities to configure and manage Wi-Fi.
(iw, ip, iwconfig, wpa_passphrase, wpa_supplicant, firmware-atheros)
Installing custom packages
You may require some software utilities like, iwconfig, iw, etc., which may be required to solve your purpose. To install them there are the following possibilities.
-
Download .deb packages of required utilities to a USB Stick or to the SD Card and install them using dpkg with -i
option. But, we have to know all the dependencies for evey package you
install and have them downloaded and installed prior to installing the
main package.
-
Include the packages while building the rootfs.
-
Connect to internet through any possible interface available (ethernet, wlan) and using apt-get install them from your favorite repository. But, your board should have any such interface enabled and available for use.
-
Use chroot on your host Linux System to change from the host’s rootfs to the SD Cards rootfs/(target fs). This method is followed in this case.
Installing custom packages using chroot
- This requires super user access. VirtualBox together with Vagrant can be used to get super user access by normal user.
-
Also, chroot will work only if the target architecture is same as that of the host.
-
When configuring kernel during compilation, enable support for ath9k_htc under device drivers in menuconfig. ath9k_htc is a device driver specific to atheros AR9271 which is the chipset used in our given NIC (TP-Link TL-WN722N).
-
qemu-arm-static is a binary that can be installed in host and
copied to target file system. This is used as an interpreter to run arm
binaries of target file system(SD Card rootfs/). This will fix the
architecture issue while using chroot.
$ sudo apt-get install binfmt-support qemu-user-static $ cp /usr/bin/qemu-arm-static /home/user/rootfs/usr/binHere, SD Card is mounted at /home/user/. The option binfmt-support says the binfmt_misc kernel module to use qemu-arm-static as the interpreter to execute arm binaries. -
Mount proc/ and sys/
$ cd rootfs $ sudo mount -t proc none proc/ $ sudo mount -t sysfs sysfs sys/ $ sudo mount -o bind /dev dev/ -
Change rootfs
(need to be super user to do this)
$ sudo chroot rootfs/ root@emdebian:/# -
Update list and install packages (firmware-atheros, wireless-tools, wpasupplicant, wireless-tools, iw, kmod) and then exit and unmount proc, sys and dev. firmware-atheros is required for our case but not mandatory for all the atheros devices[3].
# apt-get update # apt-get install firmware-atheros wpasupplicant wireless-tools iw kmod # exit $ unmount /rootfs/proc/ $ unmount /rootfs/sys/Unmount the SD Card from the PC and connect to the board and boot it. In SAMA5D3_Xplained board, a dedicated DEBUG console is provided which can be used to connect to system terminal through a USB-Serial converter. After the system boots up and logged in, plug the NIC in the USB port. The device should be automatically detected and will be ready to use. -
Enable wlan0
# ifconfig /* To check if wlan inteface is listed */ # ifconfig wlan0 upThe second command will enable the default WLAN interface wlan0. Now the interface will be up and ready to use.
-
When configuring kernel during compilation, enable support for ath9k_htc under device drivers in menuconfig. ath9k_htc is a device driver specific to atheros AR9271 which is the chipset used in our given NIC (TP-Link TL-WN722N).
Connecting to an open network as Client
-
Connecting to an open network is simple. It can be achieved using the iwconfig utility.
# iwconfig dev wlan0 connect <SSID>You can also try iw. -
Get IP assigned from AP
# dhclient wlan0You can check -r option for dhclient to release the current IP lease when necessary.
More Reading
-
What is the significance of firmware-atheros package?
-
What is the significance of wireless-tools utility?
-
What is iw and iwconfig? How do they differ?
-
What is wpa_supplicant[4]? How to connect to an encrypted connection?
-
What is Wireless Extensions(WE)?
-
What are nl80211 and cfg80211 and how do they differ from WE?
-
What is Bridging in network connections?
Build and Install Linux for ARM Cortex-A5 based embedded board
For this present article, we use SAMA5d3_Xplained board based on ATSAMA5D36 (ARM based MPU). But, the same step follows for any other hardware.
This article aims to introduce on bringing up SAMA5D3_Xplained board as a Linux System.
Before we start, we need to understand the boot sequence to know what should be done (Ref. Getting Started - at91.com)
The above image will show you three levels of bootloaders which are optional based on whether we implement simple firmware or OS.
Step:1 Prepare the necessary objects
This article aims to introduce on bringing up SAMA5D3_Xplained board as a Linux System.
Before we start, we need to understand the boot sequence to know what should be done (Ref. Getting Started - at91.com)
| Boot Sequence (Source: at91.com) |
Step:1 Prepare the necessary objects
- Bootstrap image
- Kernel Image
- Kernel modules
- Device tree file
- Rootfs Image
Note:
arm-linux-gnueabi- toolchain required to build the image, can be downloaded form release.linaro.org and add path to gcc-linaro_<version>_arm-linux-gnueabi/bin directory.$ export PATH=~/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabi/bin/:$PATH
To permanently add the path to the environment, add the above command to .bashrc file.
Building Bootstrap Image
-
Clone/Download at91bootstrap source from linux4sam/at91bootstrap git repository.
-
Configure the source with the default configuration for SD Card boot.
You can find a number of default configurations for different boot media
at ./board/sama5d3xek/ directory.
$ cd at91bootstrap/ $ make mrproper $ make sama5d3_xplainedsd_linux_image_dt_defconfigNote:nf- NandFlash, sd - MMC Card, df - SerialFlash, linux - linux kernel, android - android kernel, uboot - u-boot, dt - device tree binary (dtb). (Ref. AT91Bootstrap - at91.com) -
Compile the at91bootstrap
$ make CROSS_COMPILE=arm-linux-gnueabi-The resulting binary will be created at ./binaries/ with the name sama5d3_xplained……bin .
Building Kernel Image, Device Tree (.dtb) and Kernel Modules
The Kernel Image, Device Tree Binary and Kernel Modules are all built form Kernel Source with different options.
-
Get Kernel Source either from kernel.org or linux4sam/linux-ar91 git repository.
-
Configure the build with default configuration.
Note: More default configurations for various standard boards can be found at arch/arm/configs/. Equivalently, you can also copy the desired configuration file from this directory to root directory with file name '.config' and run make defconfig.$ cd linux-at91 $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- sama5_defconfig -
For any changes needed in the configuration, configure using menuconfig
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig -
Compile for Kernel Image
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage -
Compile for Device Tree Binary(.dtb)
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- dtbs -
Compile for Kernel Modules
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modulesThe images will be created at arch/arm/boot/.
Building Rootfs
There are several Roofs build systems available such as Yocto, Buildroot, Busybox, Multistrap, etc.,
For our convenience, we can get the archived pre-built custom Rootfs from shark/zdrive. Other sources can also be found online(sborut.wordpress.com, Dropbox). But, for ARM architecture.
Preparing SD/MMC Card
In SD Card, two partitions are to be created.
-
First partition (FAT32) ⇒ boot/ ⇒ required to move the boot images(bootstrap, kernel image and device tree binary).
-
Second partition (EXT4) ⇒ rootfs/ ⇒ for the root file system requied by the kernel to run.
Note:
fdisks is a command-line tool for creating and managing partitions. mkfs is another command-line tool to format paritions to required file system. Need to be super user to use this tool.-
After the SD Card is ready with the required partitions say by name, boot and rootfs, copy the bootstrap image, kernel image, dtb to boot/ as follows.
$ at91bootstrap/binaries/sama5d3_xplained-sdcardboot-linux-image-dt-3.8.bin /media/user/boot/boot.bin $ cp linux-at91/arch/arm/boot/zImage /media/user/boot/image $ cp linux-at91/arch/arm/boot/dts/at91-sama5d3_xplained.dtb /media/user/boot/ -
Untar the downloaded rootfs archive to the second partition rootfs
$ tar -xvf rootfs-armel-wheezy.tar.xz -c /media/user/rootfs -
Install the Kernel Modules into rootfs
~/linux-at91 $ make modules_install ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=/media/user/rootfsNow, your SD Card is ready with the necessary components to run Linux on SAMA5D3 Xplained board.
Bringing Wi-Fi Client Feature
To bring Wi-Fi client feature with the given NIC, we may need
-
Device driver for the given NIC enabled in the Kernel.
- Some HAL layer firmware, if required by the device driver. (Ref. ath9k_htc firmware - github.com)
-
Certain utilities to configure and manage Wi-Fi.
(iw, ip, iwconfig, wpa_passphrase, wpa_supplicant, firmware-atheros) - Read on through this link to bring WiFi Client feature.
Read on through this link to bring WiFi Access Point feature.
December 17, 2015
Etags - Source code navigation tool for Emacs
Why do you need etags?
- You would have come across situation where we need to traverse through pre-written source codes written in C, C++, Python, etc.,
- You might have come across difficulties in looking for function definitions that could be located anywhere among the included header files that are distributed across different directories.
- etags come to the rescue.
What is etags?
- When we use IDEs like Keil, MPLAB, etc., simply clicking on function call can take you to the function definition.
- etags provides you with similar functionality when using emacs as your editing tool.
- etags comes as part of emacs and hence no need to install it and you can directly jump in. Check man page for 'etags' to know more.
Usage
- Open terminal and move to the parent directory of the source code where you want the TAGS file to be created.
$ cd /location/of/parent/directory/
- Type in the below code to create the tags table in a file with default name 'TAGS' in the current directory. The name can be changed using the --output=filename option. The ''-'' as the filename prints the table to the standard output.
$ find . -regex ".*\.c\|.*\.h" -print | etags -to create tags table for selected files alone, you can simply use
$ etags filenames...Check your directory for the TAGS file created. It might take some time to create the file depending on the depth of your source.
Now you are done with configuration. Lets see how to use it to traverse across source code.
- Open any source file under your source directory using emacs.
- Move your text cursor over a function call.
- Type M-. (Alt+.) and click enter. You will be prompted with 'Find tag (default <function name>):'.
- Click <Enter>
- Now you will get a prompt 'Visit tags table (default TAGS):'. It means, you need to provide the location to the directory where the TAGS file is located. (This is a one time prompt for every emacs session.)
- Enter the location to your TAGS file and click enter.
- 'Mark set' will be displayed and you will be taken to the definition of the function. After reading through the definition, at any point you can type M-* (Alt+Shift+8) to return back where you started.
WARNING: Use (Alt+Shift+8) in the default keyboard. Don't use number pads.
NOTE: This procedure will hold good for traversing to header files and macros as well. Also, you can check tutorial on ctags.
References
November 24, 2015
Linux - Getting started with Texas Instruments CC3200 SimpleLink Launchpad IoT evaluation module
- CC3200 has a FT2232 FTDI chip with USB to JTAG & UART (dual endpoints)
- udev rules need to be added to enable FTDI chip to be visible in the file system
/etc/udev/rules.d/99-tiftdi.rules
$ cat /etc/udev/rules.d/99-tiftdi.rules
# For CC3200 Launchpad with FTDI Chip that TI put their codes in. ID = 0x0451, Product ID = 0xc32a
ATTRS{idVendor}=="0451", ATTRS{idProduct}=="c32a", MODE="0770", GROUP="dialout", RUN+="/sbin/modprobe ftdi-sio", RUN+="/bin/sh -c '/bin/echo 0451 c32a > /sys/bus/usb-serial/drivers/ftdi_sio/new_id'"
- Necessary kernel modules are usbserial and ftdi_sio. We need to initiate ftdi_sio kernel module manual every time we connect the device. RUN+="/sbin/modprobe ftdi-sio" in the above rules does this automatically.
- Though CCS studio is available for linux, arm-none-eabi-gcc toolchain can be used for compilation arm-none-eabi-gdb and openocd can be used for debugging.
- Configuring the build and installing procedure for openocd to support cc3200 is given at http://azug.minpet.unibas.ch/~lukas/bricol/ti_simplelink/CC3200-LaunchXL.html
- Uniflash a flashing tool provided by TI is available for Linux environment with both GUI and CLI. However, its is mentioned that it comes with some bugs as well. Procedure for using Uniflash GUI is given at http://processors.wiki.ti.com/index.php/CC31xx_%26_CC32xx_UniFlash
- energia, a opensource IDE for TI chips as like Arduino for Atmel chips. Energia can also be used as abstraction framework for other IDEs as well. Source: http://energia.nu/
- energia is the easiest way to develop the project as it provides the highest level of abstraction with simple API for every feature.
- Ideally, the MCU code should use the SimpleLink (TM) APIs pre-defined to access the Network Processor to configure the Wi-Fi. The documentation on Wi-Fi is detailed at http://www.multisilicon.com/_a/blog/a25365269~/index.html
August 13, 2015
A complete course materials on embedded System design
This is a series of presentation from an Embedded System Course that covers the course content in total of 8 modules. Below is the link to all the modules. These presentations will suffice the basics to start with embedded system design.
Labels:
8051,
ARM,
Embedded basics,
Embedded C Programming,
Embedded System,
FPGA,
Linux,
Microcontrollers,
RTOS
November 13, 2014
NIELIT | Course Calendar 2015
http://calicut.nielit.in/course/calendarcedti.asp
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||
| |||||||||||||||||||||
| ||||||||||||||||||||||||||
| ||||||
July 12, 2013
Subscribe to:
Posts (Atom)
Receive all updates via Facebook. Just Click the Like Button Below▼
▼
You can also receive Free Email Updates:
Copyright © 2008 -2012 dgpride. All rights reserved.
Subject/Topics
2 Marks
(26)
8051
(1)
AC Machines
(7)
Animations
(1)
Anna University Chennai
(31)
Arduino
(4)
ARM
(3)
Audio
(1)
Basic C Concepts
(8)
Basic Electronics
(13)
Basic principles
(9)
Book list
(1)
CAD
(1)
Chemical
(2)
Circuit theory
(6)
Civil
(2)
Cloud Computing
(1)
Communication
(4)
Competitive exams
(2)
Computer Architecture
(4)
Control system and components
(9)
CSE
(40)
Curriculum
(4)
DC Machines
(9)
Did you know
(14)
Digital
(13)
DLC
(4)
Documentation
(1)
DSP
(1)
EC 2201
(3)
ECE
(45)
EDC
(1)
EEE
(34)
EIE
(63)
Electrical
(35)
Electronics
(43)
Electroplating
(2)
Emacs
(1)
Embedded basics
(19)
Embedded C Programming
(19)
Embedded Linux
(5)
Embedded System
(22)
Engineering basics
(15)
Environmental Science
(1)
Fibre Optics
(1)
Filters
(2)
FPGA
(1)
GATE
(3)
General
(7)
GNU
(4)
Handwritten
(1)
Hobbyist
(15)
How to
(8)
HTML
(3)
Humanities
(2)
IC Engines
(7)
ICE
(5)
Industrial Electronics
(10)
Industrial Instrumentatin
(2)
industrial process
(2)
Instrumentation
(21)
IoT
(2)
IT
(2)
Laboratory Manuals
(17)
LabVIEW
(2)
Lesson notes
(2)
LIC
(2)
Links
(9)
Linux
(8)
Magnetics
(1)
Management
(1)
Mechanical
(5)
Mechatronics
(9)
Microcontrollers
(14)
Microprocessors
(9)
Microsoft
(1)
Motivation
(1)
Must Know
(11)
Networks
(1)
NuttX
(1)
Objective type
(1)
Open Source
(1)
Opportunities
(7)
Oscillators
(2)
Part Time
(1)
Physics
(1)
Post Graduation
(1)
Power Electronics
(12)
Power Plant Engineering
(2)
Power Supplies
(2)
Previous GATE Papers
(1)
Process Control
(2)
Project
(4)
Protocol
(1)
R2008
(11)
R2009
(1)
R2013
(1)
Recruitment
(2)
Research
(2)
Robotics
(9)
RTOS
(3)
Signal Processing
(8)
Signals and Systems
(4)
SMPS
(1)
Software tutorial
(4)
Stepper Motor
(2)
Syllabus
(5)
Texas Instruments
(2)
Thermodynamics
(2)
Training and Placement
(6)
Transducer Engineering
(2)
Transformer
(2)
Transmission
(1)
Tutorials
(48)
Two Marks
(26)
U-Boot
(1)
University Question Papers
(16)
Verilog
(1)
Video
(4)
Virtual Instrumentation
(3)
Visual Basic
(21)
VLSI
(11)
Web designing
(4)
Wi-Fi
(3)
Wireless
(6)




