Raspberry Pi 3 – A first look

Raspberry Pi 3 March 2016

Raspberry Pi 3
March 2016

7/3/2016, and this morning I received a Raspberry Pi model 3 in the post from New-IT.

It has been unintentionally far to long since I posted here on my blog and receiving the new Raspberry Pi is a great time to get going again !!!!

I have already setup the Pi-3, installing Raspbian Linux.

The first and very early impressions are very good, the boot time of the new Broadcom 64-bit quad-core ARMv8 CPU clocked at 1.2GHz is much faster than the Pi-2 although in all honesty the Pi-2’s speed was still very good.

It’s not the speed factor that attracted me to purchase the new Pi, its was the fact that the board has both Wi-Fi and Bluetooth connectivity on-board and this combined with the fact the the CPU is now 64bit offers some exciting prospects for future operating systems that will become available given time.

My main use for this board will be in connection with the Raspberry Pi Sensor hat, developing some Python and C++ applications in combination with my Pi-2 boards used to display the status of the sensors connected to the new Pi-3.

I will detail this project as it develops

Here is a list of Raspberry pi specifications since almost the lunch of the first raspberry Pi four years ago.

History of the Raspberry PI

History of the Raspberry PI

maxresdefault

Posted in Development boards, Raspberry pi | Tagged , , , , , , , | 4 Comments

Linux Software Repositories

Ubuntu Software Centre

Ubuntu Software Centre

Linux Software Repositories

Synaptic Package manager

Synaptic Package manager

One of the key strengths of Linux as an Operating system is the large amount of software that is freely available for installation, much like the Android Apps Store but with a greater history. The main difference between the Android Play store and many of the available Linux repositories is that the software within Linux is aimed at the full range of  installations from desktop to server ! .

I intend to add to this blog reviews and guides, that relate to many of the possible methods of locating and installing some great Linux software. Unlike in the long ago past, Linux now has some of the best software available, in order to build a powerful and fully functioning desktop/server installation.

Libreoffice writer 1

Linux Software has come a long way in recent years with packages such as libreoffice 5, which can stand head and shoulders with Microsoft Office for any scale of office based requirements.

Linux office software has a long history in the open systems world with applications such as ( star office and open office ) being used for many years by some of the worlds biggest commercial institutions.

Libreoffice 5Ref : 50 key places Linux is running

Number of Linux Users

2014 – 73 million, 2015 – 82 million registered Linux users, however you don’t have to register Linux to Download/install and use it! , it is also a conscious act to do so rather than just getting MS-Windows with your new PC … 

Back to Software

Versions of Linux such as Ubuntu and Fedora hold software repositories that have many thousands of packages within them, so Linux software is about much more than office and internet applications.

See : What are Repositories

Posted in Android, Linux, Linux Software Repositories, Operating systems, Software | Tagged , , , , , , , , | Leave a comment

Windows 10 on the Raspberry pi 2

Windows 10 1

Microsoft’s Windows 10 IOT core , has been available for the Raspberry pi 2 since around April to May 2015 and brings the Raspberry pi range of development boards into Microsoft “Internet of Things” arena, alongside other such development boards as the MinnowBoard Max boards along with the Intel Galileo board.

Ever since it’s release I have working on setting up and testing an installation using a Raspberry pi mode 2, so I just wanted to share my initial impressions and experiences.

Firstly I think its important to state just exactly what Windows 10 IOT core for the Raspberry pi is! and what it is not! along with firstly the current methods for project development using Linux.

Raspberry Pi development using a Linux OS

Since the very beginning of the Raspberry pi project the concept has been to produce a cheap small computer that can be used to develop electronics projects ( Such as Robotics and/or Sensor related applications ! ) that can be designed using development languages such as Python or C++. In order to achieve these aims the Raspberry Pi has used ARM core CPU’s alongside versions of the Linux Operating system. With user installed copies of Python and/or C++. As with all Open systems installations building this configuration and related projects is completely free.

This model of systems installation has provided for a completely self-contains development unit that can be controlled locally (i.e. by installing a keyboard/screen and a mouse) or remotely ( Via SSH or VNC over a network connection ! ) for all application and project development stages. The advantages to this configuration are that you are working in a standalone environment, i.e. you only need to work with your Raspberry Pi in order to develop meaningful projects !

Just what is Microsoft’s Windows 10 IOT core and the Internet of things ?

This short introduction below, is how Microsoft has chosen to introduce Window 10 IOT core to its potential users.

“Greetings, Makers!

We are excited to announce the public release of Windows 10 IoT Core for the Raspberry Pi 2 and the MinnowBoard Max. Visit the Windows IoT Dev Center to choose your target board, then walk through the steps to provision your board, acquire the tools, and get started Making. This release of Windows 10 IoT Core requires a development machine running the 7/29/2015 release of Windows 10 (Build 10240) and Visual Studio 2015.

Introduction to Windows 10 IoT Core

Windows 10 IoT Core is a new edition for Windows targeted towards small, embedded devices that may or may not have screens. For devices with screens, Windows 10 IoT Core does not have a Windows shell experience; instead you can write a Universal Windows app that is the interface and “personality” for your device. IoT core designed to have a low barrier to entry and make it easy to build professional grade devices. It’s designed to work with a variety of open source languages and works well with Visual Studio.”

Windows 10 2

So as you can read and see from the above text and image, Windows 10 IOT core, is not Windows 10 on the Raspberry pi 2 , in fact its not a standalone operating system at all !!!!!

Well isn’t that’s very interesting !!! ok lets take a quick look at what it is then !

When you have completed the installation of Windows 10 IOT core, following the setting up and getting going instructions from the link here, you are presented with a very basic screen on first boot, this shows such details as your IP address and basic system details such as installed devices.

Other available screens are a very basic training screen that provides access to the Microsoft’s IOT web site videos, along with an extra screen that shows full details of your Raspberry Pi 2.

Windows 10 3

So then , I think the picture here has becoming clearer as to what Microsoft has given the owners of supported Windows 10 IOT development Boards along what they have not !

What they have not done clearly, is to port a full or even cut down version of “Windows 10” to the ARM processor boards!

So what have they done ?

Well the Windows 10 Installation you have built on your Raspberry pi 2 system is nothing more that an application development and processing interfaces with some basic network management and web-server tools, these facilities provide for access to the board via a TCP/IP connection, wired or Wireless. Windows 10 IOT core allows for development of applications remotely on a Windows 10 based Desktop/Laptop system. It also allows these systems to Install applications for testing and final project release along with monitoring these project based application when they are running live.

As you can see from the above images, along with installing IOT core on a development board, you also install applications onto your Windows 10 Development system, these applications and network services search your local Network for any installations of “Windows 10 IOT” that happen to be broadcasting, once found they allow you to connect to these systems via Windows Powershell and/or using an internet browser.

Windows 10 4

The final element of this configuration is the inclusion of Microsoft’s Visual studio 2015, which provides for application development using its supported Languages such as C++ or C#. If your familiar with Visual studio then this is great , if not you have a bit of a learning curve to navigate around before you can just start coding. For example you will have to configure the IOT modules in Visual studio 2015 in order to manage application development and release.

Summary

So that’s what Windows 10 IOT core on the Raspberry Pi is and is not!

It’s not a small device version of Windows 10 , its not a command line version of Windows 10 and its not even a standalone operation system in the form we all know.

Windows 10 IOT core simply allows you to connect your Raspberry pi 2 to a machine running Windows 10 full! with Visual Studio installed and start developing, simple as that !

Comments

From a personal point of view , I have been left wondering what the point is ? in as much as, I am wondering why at a time when The Raspberry Pi has just been upgrade to a Quad core CPU with double the RAM offering much better performance, would you bother to install Windows 10 IOT core , which does very little with the Raspberry Pi 2 ‘s capabilities.

Well , there are some very good reasons, however they in no shape or form make the Linux operating system redundant for the Raspberry Pi project, indeed to convert the Pi project over to Windows 10 could potentially kill it altogether !!

The only reasons I can think of to use Windows 10 IOT core, is it would allow you to run a Raspberry as a Headless system with a network connection, so that you have no need to purchase a keyboard/mouse or a screen. However this is something you can easily achive anyway with a simple (SSH/TELNET or VNC) client installed under Linux!

For me then this leaves only one possible reason and this is that some project developers may not want to learn the Linux operating system and using Windows 10 IOT core with Visual Studio is a great answer for these individuals.

I personally feel that the reason that Microsoft has take this model of ( Client / Server development !) is that they want to keep developers tied into having to use a Primary Windows 10 installation with Visual Studio 2015 as a part of the equation, You also have to take into account that Microsoft no longer offers a command line ability of control for developing applications or even a text based editor such as is available if needed in Linux. The new Raspberry2 however is very capable of running development IDE’s locally such as Geany or Netbeans, x-windows based applications.

I think that all this depends on how you view your raspberry pi or other such devices, you can see them as dumb but programmable devices that sit at the end of a food chain of development and finally a live active project , such as being a device used to react to readings from a sensor and then performing localized tasks that relate to these sensor reading, or you can see them as standalone computer systems the are very capable of running, as a standalone project with all development and application processing being performed locally. The very fact Microsoft calls Windows 10 for these devices “The internet of things ” (IOT core) should be the clue here! as in they expect your development board to both be programmed and then controlled using a TCP/IP connection, thus the first perspective above.

A factor that you may need to take into account is that you may not want your controller boards like the Raspberry pi to be connected to the internet as it maybe much more secure and efficient to run standalone, in which cases using a local ( screen, keyboard and mouse ) is a better option. Also as already said , Lunix offers many ways to connect remotely such as (SSH , TELNET and VNC).

As a parting comment , I feel that Windows 10 IOT core, is just offering another possible route into developing projects based on Raspberry Pi hardware, however many will worry about seeing their open source system even having Microsoft nudging in at all. For these people however the answer is simple, you have no need to use it, Linux is doing very well in these kind of environments ( along with servers and desktops !) and will remain doing so for a very long time to come , so keep using it !!!

Posted in Linux, Operating systems, Raspberry pi, Single board computers, Windows 10 IOT core | Tagged , , , , , , , , , , | 1 Comment

Linux Configuration files and the command shell .

Linux and Unix configuration files

Linux and Unix configuration files

In one of my earlier posts I talked about Linux operating systems training and the Linux Professional Institute Study Guide (LIC-1).

This study guide is aimed at helping with taking the following Linux Exams :

LPIC-1 Linux Professional Institute Certification Study Guide: Exam 101-400 and Exam 102-400

Using this guide, in my last post I talked a little about the available command Unix and Linux shells and their history,shells used in different Linux distributions. I have also in some of my recent posts talked a little about the available text based file editors such as VI used in the UNIX/LINUX environment.

I feel however that it’s important to show just why Linux has retained a closer link to the text based command line or at least much more so than any currently supported version of the Microsoft windows operating systems.

While the Microsoft Windows operating systems have long since made an attempt to reduce the need for a text based command shell interface, transferring most if not all of the operating systems operations and configuration work into GUI based applications such as the systems control panel, Linux has evolved in such a way that easy and fast access to both a command shell approach and a GUI approach is possible.

Thus Linux/Unix takes a two pronged approach to local or remote systems administration !

One fact here that is very important and something that many desktop/laptop users my not fully appreciate is that Linux is the operating system that is largely running the Internet and Cloud , along with many of the internal computer networks within large companies around the planet, although many large institutions have out sourced their computer needs to the cloud.

See: Why Are So Many Websites Hosted On Linux?

Taking this into account its important to understand that Linux/Unix operating systems have long been divided into two main flavors ( Desktop and Server distributions ). Within the Linux server based world , many of these system are located in large isolated server rooms, that may contain many hundreds of servers running in a climate controlled environment, again this is even more so the case since many companies rent data space and processing power from the cloud these days.

Linux/Unix Internet and cloud servers clearly then make use of the Server distributions/Versions and as such they are mostly managed and configured remotely, i.e. they run in what is called a headless mode , with no keyboard or screen attached. These systems are managed using a remote log-in process such as SSH ( a service that provides a remote log-in to a system and then provides a command shell environment) . When this remote connection has been made usually from a remote desktop system you then have two options in-order to perform administrative tasks on the remote server system, you can on your desktop use an installed GUI interface to manage a admin task or you can do almost anything from the command line by editing application or system services configuration files. Linux and Unix applications and services are very likely to have been design with this double management approach in mind and can be configured with both GUI based Menus or Via editing a configuration file held in the form of a *.conf file on the system.

To show this , from a command prompt type the following :

sudo find / -name “*.conf”

# sudo is needed to give all the needed permissions to everyone of the systems folders!

This searches for any “*.conf” files within the entire disk structure of a Linux installation!

On one of my own systems this returned some 650 individual files, all of which can be edited using a text editor such as VI! or GEDIT

So taking all the above into account it may become a little clearer as to just why Linux/Unix has retained a closer link to a text based environment than say MS-windows has. The main difference between MS-windows and Linux/Unix is that Windows uses a single system wide configuration file call the “registry”, that is both used by system services and individual applications, some think this is better some not.

Many people feel that the advantages of retaining command line skills and provided service for them – is, firstly its just faster than using a GUI environment (OMG! Some many mouse clicks !!!), Linux shells with such features as command completion, a services provided by many shells that allows you to search for and quickly select intended commands along with the files names that you intend these commands to be performed on. Then Secondly a very good reason for using a text based approach to system operations and control is that it saves on network bandwidth , a text based file editor used for changing the content of a ( application or system service and users ) configuration file needs to send a lot less network traffic in the form of TCP/IP packets across the internet or local network than does a GUI based application and as such you will be able to perform an operation much faster! .

A good example of this is if you need to log-in, in order to shutdown an application/system that is taking too much of the systems CPU/processing time, sometimes there is just not enough processing power left to load up a GUI application but just enough to perform admin tasks from a text based command line in the form a shell ! .

In summary

For many people who have only ever known desktop systems, it may appear that it is so far out of date to even think of using a command shell and text based terminal, a little like going back to the early days of MS-DOS or CP/M, until you understand that not only can you do things faster but that most of the cloud and internet is being run by Linux/Unix systems that do not have a screen or keyboard attached and do not even have a GUI windows based system installed, like many of the Linux server distributions being used to run the cloud/internet today.

Learning and maintaining command line skills is still important in the IT industry and will allow you to do your job faster and in some situations it will be the only way to get many tasks performed at all !

Posted in computer fundamentals, Linux, Operating systems, Study guides and exams | Tagged , , , , , , , , , | Leave a comment

Linux command shells

Unix / Linux command shells

Unix / Linux command shells


Unix and Linux command shells

Within the Unix and Linux operating systems , a command shell is an operating system service/application that takes commands from a terminal emulator program or from a script source file and performs any given commands by making calls to the provided operating system API services.

The Linux command shell is one of the main reasons why Unix and Linux remain so favored in the IT business today. The level of control and power that can be taken over a computer system using a shell script or by just typing commands from a command terminal in Unix and Linux is very high compared to a system running MS-Windows.

Large scripts can be written that can automate the editing of system and user files, perform automatic reporting of system activities and performance measurements, perform job control, application install and updates and in fact almost any task you can think of as a systems administrator can be performed using a shell environment without ever going near a mouse.

Many Unix/Linux server systems today do not have a ( keyboard, mouse or screen ) attached and thus are controlled by remote access, using a command line shell from a remote terminal thus shell text based login is much more practical.

On most Unix/linux systems these days you can install many different shells from your operating systems online application applications repository , there are several shells available. Most available shells offer similar functionality, but each has different syntax and capabilities, they include ( sh, csh, ksh, tcsh, bash, zsh and dash ).

Today’s most popular shells include bash, zsh, ksh and dash.

The oldest of the shells are sh and csh both originating from earlier version of Unix.

You can get information on the different shells installed on your system, by looking at the details held by your installed package manager i.e. apt or synaptic package manager, under shells.

In order to select a shell as your default shell, used each time you use a command line terminal. You will need to edit your user account and add the new shell as you default shell, you must logoff and login again for this change to take place.

As shells can be used as an interpreted programming languages. To automate tasks, you may write scripts containing built-in shell commands.

When you execute a script, the shell interprets these commands as if you had entered them from the command-line terminal prompt.

Compared to compiled programs in c++ for example, shell scripts are slow but as they are mainly used for system functions, such as for file operations and not for mathematical calculation or graphics then this is less of a concern that it may appear.

UNIX shells since 1977

Looking at modern shells from 1977, when the Bourne shell was introduced.

The Bourne shell, created by Stephen Bourne at AT&T Bell Labs for V7 UNIX, remains a useful shell today (in some cases, as the default root account shell). The author developed the Bourne shell after working on an ALGOL68 compiler, so you’ll find its grammar more similar to the Algorithmic Language (ALGOL) than other shells. The source code itself, although developed in C, even made use of macros to give it an ALGOL68 flavor.

The Bourne shell had two primary goals: serve as a command interpreter to interactively execute commands for the operating system and for scripting (writing reusable scripts that could be invoked through the shell). In addition to replacing the Thompson shell, the Bourne shell offered several advantages over its predecessors.

Bourne introduced control flows, loops, and variables into scripts, providing a more functional language to interact with the operating system (both interactively and noninteractively). The shell also permitted you to use shell scripts as filters, providing integrated support for handling signals, but lacked the ability to define functions.

Finally, it incorporated a number of features we use today, including command substitution (using back quotes) and HERE documents to embed preserved string literals within a script.

The Bourne shell was not only an important step forward but also the anchor for numerous derivative shells, many of which are used today in typical Linux systems.

Figure 1 illustrates the lineage of important shells. The Bourne shell led to the development of the Korn shell (ksh), Almquist shell (ash), and the popular Bourne Again Shell (or Bash). The C shell (csh) was under development at the time the Bourne shell was being released. Figure 1 shows the primary lineage but not all influences; there was significant contribution across shells that isn’t depicted.

Linix Shell timeline

Linix Shell timeline

Basic shell architecture

The fundamental architecture of a hypothetical shell is simple (as evidenced by Bourne’s shell). As you can see in Figure 2, the basic architecture looks similar to a pipeline, where input is analyzed and parsed, symbols are expanded (using a variety of methods such as brace, tilde, variable and parameter expansion and substitution, and file name generation), and finally commands are executed (using shell built-in commands, or external commands).

figure2

Posted in computer fundamentals, Development Languages, Linux, Operating systems | Tagged , , , , , , , , , , , , , , | Leave a comment

Linux Professional Institute Study Guide (LIC-1)

LPIC-1 Study plans 1

LPIC-1 Linux Professional Institute Certification Study Guide: Exam 101-400 and Exam 102-400, 4th Edition
Christine Bresnahan, Richard Blum
ISBN: 978-1-119-02118-6

As we are now well into the month of September, the month that traditionally all students start or get back to their academic new year, with months of studying ahead of themselves, it must be time to make some of my own plans.

As the aim of this blog is to document my computer and I.T. related studies, I am returning here in order to note all the areas I will be covering and to let this blog act as an area of reference for the future.

In order to make a start, I ordered and recently received the Linux study guide below, published by SYBEC :

“LPIC-1 Linux Professional Institute Certification Study Guide: Exam 101-400 and Exam 102-400, 4th Edition
Christine Bresnahan, Richard Blum
ISBN: 978-1-119-02118-6”

This book covers the following areas as follows :

Table of Contents
Introduction xix
Assessment Test xxxvii
Answers to the Assessment Test xliv

Part I Exam 101-400 1

Chapter 1 Exploring Linux Command-Line Tools 3
Chapter 2 Managing Software 47
Chapter 3 Configuring Hardware 107
Chapter 4 Managing Files 177
Chapter 5 Booting Linux and Editing Files 233

Part II Exam 102-400 277

Chapter 6 Configuring the X Window System, Localization, and Printing 279
Chapter 7 Administering the System 343
Chapter 8 Configuring Basic Networking 407
Chapter 9 Writing Scripts, Configuring Email, and Using Databases 453
Chapter 10 Securing Your System 523

Appendix Answers 575

LPIC-1 Study plans 2

————————

My personal aims and the aims of the book are to get myself ready to take the two exams (Exam 101-400 and Exam 102-400) at LPIC-1 (level 1). I have taken such exams in the past in relation to the Sun-Solaris operating system but these two exams are in relation to Linux in general and in 2015.

Many of the following following post here will involved the areas covered above which I am studying and show how I am using different hardware and linux operating system distributions (i.e. Ububtu, Arch Linux, etc….) to help set-up and use a study environment.

The hardware I will use includes devices such as the (Radxa rock, Odriod, raspberry pi – ARM_CPU development boards along with more traditional I386 based computer hardware).

Posted in Linux, Operating systems, Study guides and exams | Tagged , , , , , , | Leave a comment

Hexadecimal file editors and viewers

Okteta and Hexedit file editing utilities

Okteta and Hexedit file editing utilities

In my last post I talked a little about the numeric base systems of (Binary, Octal, Hex-decimal and Decimal) relating them to both computer machine level instruction code and application data.

However these mathematical concepts are a little hard to become skilled in unless you have some tools at hand to help you. The Linux Operating system can provides two levels of such tools for example a text based utility (Hexedit) and (okteta) a Gui X-windows application, They both help you understand the fact that all system and user files consist simply of Binary values stored in byte’s (8 bits of 0’s or 1’s) and that the complete values they hold can be represented numerically or alphanumerically.

The two utilities I use the most are HEXEDIT – ( a console text based application) and Okteta – ( X-windows GUI application ).

Both these applications are used for editing application or data files and present the content of the files in the form of Hexadecimal and ASCII code. HEXEDIT is limited to Hexadecimal and ASCII code but Okteta can be configures to edit the open file in anyone of (Hex, Octal, Binary and ASCII code) values.

If you wanted to it would be possible to write a full machine code application using these utilities, in the very old days of computing, applications like these ones were in fact the only way of doing so. Programs where written in a computer language such as Assembly language and manually converted into Hexadecimal before being entered and then executed.

One possible use for these utilities today is for checking a file for data corruption , most likely the first few bytes of the file, these are often used to define the file to an application and if these bytes are corrupt the file will not be usable. By checking another file or a backup file used by the same application it could be possible to edit and thus make the damaged file usable once more.

I will look at and review “Okteta” in another post as its is such a powerful tool so below are some basic details on the console editor HEXEDIT…..

hexedit

HEXEDIT

Hexedit is a very powerful file editor, in that if can be used to not only edit a file on a file system at byte level (in Hexadecimal or ASCII) but if can also be used to edit the file system itself and in full – using the RAW mount point of the disk, in this way you may be able to recover date from a corrupt or deleted file system.

As such it could be a very basic part of a disk forensics kit!

The program is not standard to most versions of Linux but can be installed as follows :

sudo apt-get install hexedit

The Linux Man page is as follows :

NAME
hexedit – view and edit files in hexadecimal or in ASCII

SYNOPSIS
hexedit [-s | –sector] [-m | –maximize] [-h | –help] [filename]

DESCRIPTION
hexedit shows a file both in ASCII and in hexadecimal. The file can be a device as the file is read a piece at a time. You can modify the file and search
through it.

OPTIONS
-s, –sector
Format the display to have entire sectors.

-m, –maximize
Try to maximize the display.

-h, –help
Show the usage.

COMMANDS (quickly)
Moving
: go to start/end of the file
Right: next character
Left: previous character
Down: next line
Up: previous line
Home: beginning of line
End: end of line
PUp: page forward
PDown: page backward

Miscellaneous
F2: save
F3: load file
F1: help
Ctrl-L: redraw
Ctrl-Z: suspend
Ctrl-X: save and exit
Ctrl-C: exit without saving

Tab: toggle hex/ascii
Return: go to
Backspace: undo previous character
Ctrl-U: undo all
Ctrl-S: search forward
Ctrl-R: search backward

Cut&Paste
Ctrl-Space: set mark
Esc-W: copy
Ctrl-Y: paste
Esc-Y: paste into a file
Esc-I: fill

COMMANDS (full and detailed)
o Right-Arrow, Left-Arrow, Down-Arrow, Up-Arrow – move the cursor.
o Ctrl+F, Ctrl+B, Ctrl+N, Ctrl+P – move the cursor.
o Ctrl+Right-Arrow, Ctrl+Left-Arrow, Ctrl+Down-Arrow, Ctrl+Up-Arrow – move n times the cursor.
o Esc+Right-Arrow, Esc+Left-Arrow, Esc+Down-Arrow, Esc+Up-Arrow – move n times the cursor.
o Esc+F, Esc+B, Esc+N, Esc+P – move n times the cursor.
o Home, Ctrl+A – go the beginning of the line.
o End, Ctrl+E – go to the end of the line.
o Page up, Esc+V, F5 – go up in the file by one page.
o Page down, Ctrl+V, F6 – go down in the file by one page.
o <, Esc+, Esc+>, Esc+End – go to the end of the file (for regular files that have a size).
o Ctrl+Z – suspend hexedit.
o Ctrl+U, Ctrl+_, Ctrl+/ – undo all (forget the modifications).
o Ctrl+Q – read next input character and insert it (this is useful for inserting control characters and bound keys).
o Tab, Ctrl+T – toggle between ASCII and hexadecimal.
o /, Ctrl+S – search forward (in ASCII or in hexadecimal, use TAB to change).
o Ctrl+R – search backward.
o Ctrl+G, F4 – go to a position in the file.
o Return – go to a sector in the file if –sector is used, otherwise go to a position in the file.
o Esc+L – display the page starting at the current cursor position.
o F2, Ctrl+W – save the modifications.
o F1, Esc+H – help (show the man page).
o Ctrl+O, F3 – open another file
o Ctrl+L – redisplay (refresh) the display (useful when your terminal screws up).
o Backspace, Ctrl+H – undo the modifications made on the previous byte.
o Esc+Ctrl+H – undo the modifications made on the previous bytes.
o Ctrl+Space, F9 – set mark where cursor is.
o Esc+W, Delete, F7 – copy selected region.
o Ctrl+Y, Insert, F8 – paste (yank) previously copied region.
o Esc+Y, F11 – save previously copied region to a file.
o Esc+I, F12 – fill the selection with a string
o Esc+T – truncate the file at the current location
o Ctrl+C – unconditional quit (without saving).
o F10, Ctrl+X – quit.

For the Esc commands, it sometimes works to use Alt instead of Esc. Funny things here (especially for froggies 🙂 egrave = Alt+H , ccedilla = Alt+G, Alt+Y =
ugrave.

Modeline
At the bottom of the display you have the modeline (copied from emacs). As in emacs, you have the indications –, ** and %% meaning unmodified, modified and
read-only. Then you have the name of the file you’re currently editing. Next to it is the current position of the cursor in the file followed by the total
file size. The total file size isn’t quite correct for devices.
While in –sector mode, it shows the sector the cursor is in.

Editing
You can edit in ASCII or in hexadecimal. You can switch between the two with Tab. When the file is read-only, you can’t edit it. When trying to edit a read-
only file, a message (“File is read-only”) tells you it is non-writable.
The modifications are shown in bold until they are saved. The modeline indicates whether you have modified the file or not.
When editing in hexadecimal, only 0,1,…,9, a,b,…,f, A,B,…F are legal. Other keys are unbound. The first time you hit an unbound key, the help pops
up. It won’t pop again unless you call the help directly (with F1).
When editing in ascii, you can find it difficult to enter characters like / which are bound to a function. The solution is to use the quoted insert function
Ctrl+Q, the key after the quoted insert function is not processed by hexedit (like emacs’ quoted-insert, or like the \ character in C).

Searching
You can search for a string in ASCII or in hexadecimal. You can switch between the two with Tab. If the string is found, the cursor is moved to the begin‐
ning of the matching location. If the search failed, a message (“not found”) tells you so. You can cancel the search by pressing a key.
The search in hexadecimal is a bit confusing. You must give a hexadecimal string with an even number of characters. The search can then be done byte by
byte. If you want to search a long number (eg: a 32 bit number), you must know the internal representation of that number (little/big endian problem) and
give it the way it is in memory. For example, on an Intel processor (little endian), you must swap every bytes: 0x12345678 is written 0x78563412 in memory
and that’s the string you must give to the search engine.
Before searching you are asked if you want to save the changes, if the file is edited.

For more sophisticated search, see Volker Schatz’s patch at .

Selecting, copying, pasting, filling
First, select the part of the buffer you want to copy: start setting the mark where you want. Then go to the end of the area you want to copy (you can use
the go to function and the search functions). Then copy it. You can then paste the copied area in the current file or in another file.

You can also fill the selected area with a string or a character: start choosing the block you want to fill in (set mark then move to the end of the block),
and call the fill function (F12). hexedit ask you the string you want to fill the block with.
The code is not tuned for huge filling as it keeps the modifications in memory until you save them. That’s why hexedit will warn you if you try to fill in a
big block.

When the mark is set, the selection is shown in reverse mode.
Be aware that the copied area contains the modifications done at the time of the copy. But if you undo the modifications, it does not change the content of
the copy buffer. It seems obvious but it’s worth saying.

Scrolling
The scrolling is different whether you are in –sector mode or not. In normal mode, the scrolling is line by line. In sector mode, the scrolling is sector
by sector. In both modes, you can force the display to start at a given position using Esc+L.

SEE ALSO
od(1), hdump(1), hexdump(1), bpe(1), hexed(1), beav(1).

AUTHOR
Pixel (Pascal Rigaux) ,
Home page is .

UNRESTRICTIONS
hexedit is Open Source; anyone may redistribute copies of hexedit to anyone under the terms stated in the GNU General Public License.

You can find hexedit at
and
.

TODO
Anything you think could be nice…

LIMITATIONS
There are problems with the curses library given with Redhat 5.0 that make hexedit think the terminal is huge. The result is that hexedit is not usable.

The shortcuts work on some machines, and not on others. That’s why there are many shortcuts for each function. The Ctrl+Arrows and the Alt+. do not work
work as they should most of the time. On SUNs, you must do Ctrl+V-Ctrl+V instead of Ctrl+V (!); and the Alt key is the diamond one.

While searching, it could be interesting to know which position the search has reached. It’s always nice to see something moving to help waiting.

The hexadecimal search could be able to search modulo 4 bits instead of 8 bits. Another feature could be to complete padd odd length hexadecimal searches
with zeros.

BUGS
I have an example where the display is completely screwed up. It seems to be a bug in ncurses (or maybe in xterm and rxvt)?? Don’t know if it’s me using
ncurses badly or not… It seems to happen when hexedit leaves only one space at the end of the lines… If anyone has a (or the) solution, please tell me!

If you have any problem with the program (even a small one), please do report it to me. Remarks of any kind are also welcome.

Posted in computer fundamentals, Linux, Operating systems, Programming skills | Tagged , , , , , , , , , , , , | Leave a comment

Numeric base systems of (Binary, Octal, Hex-decimal and Decimal)

Binary numbers and computers

Binary numbers and computers

Computer related numeric systems and their written representation

In My last post I talked a little about the way computers see both their pre-defined commands in the form of machine code instructions that are grouped into applications by a programmer.

All computers represent machine code instructions and any related data into sets of binary digits(1’s and 0’s, on or off). This Binary representation is composed of bits(1 or 0), which in turn are grouped into larger sets such as bytes(8 bits, 10101010).

Returning to a single bit as a binary digit it represents one of two states. The concept of a bit can be understood as a value of either 1 or 0, on or off, yes or no, true or false, or encoded by a switch or toggle of some kind.

1and0s

While a single bit, on its own, is able to represent only two values, a string of bits may be used to represent larger values. For example, a string of three bits can represent up to eight distinct values.

A byte or eight bits is the smallest elementary grouping that a computer can use, even if the value it stores is less that the maximum value it can hold (Decimal values = 255) the full byte of storage will always be used.

As the number of bits composing a string increases, the number of possible 0 and 1 combinations increases exponentially. While a single bit allows only two value-combinations and two bits combined can make four separate values and so on. The amount of possible combinations doubles with each binary digit added as illustrated.

binary powers

Adding all the values in the byte illustrated gives a maximum range from 0 to 255 or 256 possible combinations including the value of 0.

Groupings with a specific number of bits are used to represent varying things and have specific names.

A byte is a bit string containing the number of bits needed to represent a character. On most modern computers, this is an eight bit string. Because the definition of a byte is related to the number of bits composing a character, some older computers have used a different bit length for their byte.

It is important to understand that the hardware within a computer can and does only use the binary numeric system for storing both (machine code instructions, memory addresses and numeric values). This fact is related to the actual hardware itself which can electronically only store two states of being (on or off), each memory location actually consisting of a physical micro switch that exists only within these two possible conditions.

Beyond the on or off ( 1 or 0 ) state of the binary system however, programmers have made use of or devised the numeric systems of ( Octal, Hex-decimal and Decimal ) to make the best use of computer memory for data or program storage and execution.

I don’t want to go into the full mathematical details of these numeric representation systems in this post as it would be to much here. I will however show below the way computer programmers divide storage for the purpose of processing both data and machine code instructions.

Octal

The octal numeral system, or oct for short, is the base-8 number system, and uses the digits 0 to 7. Octal numerals can be made from binary numerals by grouping consecutive binary digits into groups of three (starting from the right). For example, the binary representation for decimal 74 is 1001010, which can be grouped into (00)1 001 010 – so the octal representation is 112.

Why use Octal In computer programming ?

Octal became widely used in computing when systems such as the PDP-8, ICL 1900 and IBM mainframes employed 12-bit, 24-bit or 36-bit words. Octal was an ideal abbreviation of binary for these machines because their word size is divisible by three (each octal digit represents three binary digits). So four, eight or twelve digits could concisely display an entire machine word. It also cut costs by allowing Nixie tubes, seven-segment displays, and calculators to be used for the operator consoles, where binary displays were too complex to use, decimal displays needed complex hardware to convert radices, and hexadecimal displays needed to display more numerals.

All modern computing platforms, however, use 16-, 32-, or 64-bit words, further divided into eight-bit bytes. On such systems three octal digits per byte would be required, with the most significant octal digit representing two binary digits (plus one bit of the next significant byte, if any). Octal representation of a 16-bit word requires 6 digits, but the most significant octal digit represents (quite inelegantly) only one bit (0 or 1). This representation offers no way to easily read the most significant byte, because it’s smeared over four octal digits. Therefore, hexadecimal is more commonly used in programming languages today, since two hexadecimal digits exactly specify one byte. Some platforms with a power-of-two word size still have instruction subwords that are more easily understood if displayed in octal; this includes the PDP-11 and Motorola 68000 family. The modern-day ubiquitous x86 architecture belongs to this category as well, but octal is rarely used on this platform, although certain properties of the binary encoding of opcodes become more readily apparent when displayed in octal, e.g. the ModRM byte, which is divided into fields of 2, 3, and 3 bits, so octal can be useful in describing these encodings.

Octal is sometimes used in computing instead of hexadecimal, perhaps most often in modern times in conjunction with file permissions under Unix systems (see chmod). It has the advantage of not requiring any extra symbols as digits (the hexadecimal system is base-16 and therefore needs six additional symbols beyond 0–9). It is also used for digital displays.

Hex-decimal

In mathematics and computing, hexadecimal (also base 16, or hex) is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F (or alternatively a, b, c, d, e, f) to represent values ten to fifteen. Hexadecimal numerals are widely used by computer systems designers and programmers. Several different notations are used to represent hexadecimal constants in computing languages; the prefix “0x” is widespread due to its use in Unix and C (and related operating systems and languages). Alternatively, some authors denote hexadecimal values using a suffix or subscript. For example, one could write 0x2AF3 or 2AF316, depending on the choice of notation.

A nibble (sometimes nybble), is a number composed of four bits. Being a half-byte, the nibble was named as a play on words. A person may need several nibbles for one bite from something; similarly, a nybble is a part of a byte. Because four bits allow for sixteen values, a nibble is sometimes known as a hexadecimal digit.

As an example, the hexadecimal number 2AF316 can be converted to an equivalent decimal representation. Observe that 2AF316 is equal to a sum of (200016 + A0016 + F016 + 316), by decomposing the numeral into a series of place value terms. Converting each term to decimal, one can further write: (216 × 163) + (A16 × 162) + (F16 × 161) + (316 × 160) =
(2 × 4096) + (10 × 256) + (15 × 16) + (3 × 1) = 10995.

Each hexadecimal digit represents four binary digits (bits), and the primary use of hexadecimal notation is a human-friendly representation of binary-coded values in computing and digital electronics. One hexadecimal digit represents a nibble, which is half of an octet or byte (8 bits). For example, byte values can range from 0 to 255 (decimal), but may be more conveniently represented as two hexadecimal digits in the range 00 to FF. Hexadecimal is also commonly used to represent computer memory addresses.

Why use Hex-Decimal in computer programming ?

The main reason why we use hexadecimal numbers is because it is much easier to express binary number representations in hex than it is in any other base number system. Computers do not actually work in hex. Lets look at an example, using a byte. Bytes are typically 8 bits, and can store the values 0 – 255 (0000 0000 – 1111 1111 in binary). For people, expressing numbers in binary is not convenient. You are not going to turn around to your co-worker and tell them that my phone number is 101 101 101 001 010 001 010 for obvious reasons. Imagine having to try and work with that on a daily basis. So a more convenient expression is needed for the human.

Since a byte is 8 bits, it makes sense to divide that up into two groups, the top 4 bits and the low 4 bits. Since 4 bits gives you the possible range from 0 – 15, a base 16 system is easier to work with, especially if you are only familiar with alphanumeric characters. It’s easier to express a binary value to another person as “A” then it is to express it as “1010”. This way I can simple use 2 hex values to represent a byte and have it work cleanly.

This way if you are poor at math, you only need to memorize the multiplication tables up to 15. So if you have a hex value of CE, I can easily determine that 12 * 14 = 206 in decimal, and can easily write it out in binary as 1100 1110.

Trying to convert from binary would require me to know what each place holder represents, and add all the values together (128 + 64 + 8 + 4 + 2 = 206). It’s much easier to work with binary through hex than any other base system.

Decimal

The Decimal value system is used within computer programming to primarily represent the numeric data values that a program will (receive, store, manipulate and output ) to the end user of an application.

As an example the C++ language can represent decimal values in the following formats in the form of (Type,Typical bit Width and Typical value range)

char, 1byte, -127 to 127 or 0 to 255
unsigned char, 1byte, 0 to 255
signed char, 1byte, -127 to 127
int, 4bytes, -2147483648 to 2147483647
unsigned int, 4bytes, 0 to 4294967295
signed int, 4bytes, -2147483648 to 2147483647
short int, 2bytes, -32768 to 32767
unsigned short int, Range, 0 to 65,535
signed short int, Range, -32768 to 32767
long int, 4bytes, -2,147,483,647 to 2,147,483,647
signed long int, 4bytes, same as long int
unsigned long int, 4bytes, 0 to 4,294,967,295
float, 4bytes, +/- 3.4e +/- 38 (~7 digits)
double, 8bytes, +/- 1.7e +/- 308 (~15 digits)
long double, 8bytes, +/- 1.7e +/- 308 (~15 digits)
wchar_t, 2 or 4 bytes, 1 wide character

As you can see these decimal data types (Including character types, alphanumeric characters are given a decimal value within a character table !) exist at a higher level of representation than at a lower level of Binary code computation. These decimal data types can and do only exist within low/high level programming languages which convert their decimal values into binary values in order for any lower level binary functions to be performed on their values.

This numeric representation process is clearly also reproduced in the case of Octal and Hex-decimal values both of which can also be used to represent instructions within the CPU’s machine code instruction set.

Posted in computer fundamentals, Development Languages, Programming skills | Tagged , , , , , , , , , , , , | 1 Comment

ARM (SOC – system on a chip) CPU’s , Programming from the ground up …….

Advantages of ARM (Soc) system on a chip CPU's

Advantages of ARM (Soc) system on a chip CPU’s

Having spent the last three weeks deep in programming language study, reclaiming some C++ and Assembly language skills, I am more than overdue a post here 🙂

These three weeks however have prepared me very well to start sharing some ideas and concepts, so I feel very good about some valuable time spent !!

I do feel the need however to press the rest button a little before I share any of the above.

I just want to redefine the reasons for selecting to use ARM CPU based technology for my current studies. It would have been very easy to just download a copy of Linux (eg.. Ubuntu 14.04, I have this anyway:) ) followed by all the needed resources such as (GCC and Python Programming environments) and then just get on with coding to help me revise and regain some skills, however this process would have missed out on a huge chunk of the complete study path I want to follow.

The main reason for anyone to select a development board computer to purchase and then learn to use for coding skills and hardware project development (Such as electronics projects) is that these boards are designed and developed within the open source hardware and software(Linux) community and as such they are fully documented by their designers and manufactures from the ground up…

Why is this important ?

Well this blog and the personal project’s it relates to are based on learning how to code a computer from the very lowest level.

For all computer systems to work they follow a path of interpreting the program instructions they are given, working sometimes from a very high level programming language such as Python – down to what is called Machine code instructions. These machine code instructions are in binary code ( 1’s or 0’s ) given in a byte ( 10101010 ) of 8 bits, it is important to note that no single part of a computer system can understand anything other than instructions given in this format.

What is “Machine code” ?

If you truly want to learn computer programming from the ground up, you need to know about every possible detail of how the system you are learning on can be programmed right from its very lowest level (Machine code), basically then how it works under the hood , as it were!.

Just as a quick example the following links will allow you to download the documentation for the Radxa Rock ARM Based development board system and below this is the documentation for the Banana Pi M2, A31s ARM CPU based system:

Radxa RK3188 , Hardware Manual

Radxa rock  ARM CPU - based development board

Radxa rock
ARM CPU – based development board

Radxa Rock RK3188 CPU structure Diagram

Radxa Rock
CPU structure Diagram

Allwinner ARM – A31s CPU Manual

Banana Pi M2 ARM A31s CPU , based system

Banana Pi M2
ARM A31s CPU , based system

Allwinner A31s ARM CPU Structure Diagram

Allwinner A31s ARM CPU
Structure Diagram

Both these development boards, at their machine code level understand a built in set of instructions that fall with in the ARM CPU instruction set as detailed in the following link

ARM Instruction set

As a final point for this post , it is worth noting that a current generation of ARM CPU’s fall within a group of CPU’s called (SOC) “System on a chip” !

What is a “System on a chip” ?

This relates to the fact that the main system modules that are needed to create a fully functional computer system are fully contained within the ARM CPU itself , see the two Diagrams above. From the point of view of learning to program these systems is concerned this means that the documentation available usually relates to programming the system as a complete entity and this make life much much easier.

On many Intel and AMD 386 based systems this is not so much the case as the hardware can alter from one computer to another even with systems running the same core CPU.

So downloading Ubuntu Linux and attempting to code in Machine code or its next stop up Assembly language on a full systems hardware level is just not as simple !

Posted in Banana Pi M2, Development board hardware, Development Languages, Programming skills, Radxa rock | Tagged , , , , , , , , , , , | 1 Comment

Radxa Rock and Banana pi BPI-M2 quad core single-board computers

Banana Pi m2 and Radxa rock, Quad Core Arm based boards

Radxa rock and Bannana Pi m2
Quad Core Arm based boards

Two new Additions to my Arm processor Linux development project ……

During the last two week I have managed to add two more ARM based Development boards to my Linux OS development Project , the first being the Banana Pi M2, Quad core A31s-Cortex-A7 1Ghz processor system and the second the Radxa Rock, ARM Cortex-A9 quad core @ 1.6Ghz.

The Specifications for both the boards is as follows :

Bpi M2

Banana Pi m2 Specification

SoC – Allwinner A31s quad core Cortex A7 @ 1.0 GHz with PowerVR SGX544MP2 GPU
System Memory – 1GB DDR3
Storage – Micro SD slot up to 64GB
Connectivity – 10/100/1000 Ethernet, 802.11 b/g/n Wi-Fi (Realtek)
Video Output – HDMI, CVBS, and LVDS/RGB header
Audio Output – HDMI and 3.5mm stereo jack
Camera – CSI connector
USB – 2x USB 2.0 host ports + micro USB port (power only)
Debugging – UART pins for serial console
Expansion Header – 40-pin R-Pi “somewhat” compatible header with 2×13 UART, I2C bus, SPI bus, CAN bus, ADC, PWM, 3.3V, 5V, ground
Misc – IR Receiver, power, reboot and reset buttons.
Power Supply – 5V in via MicroUSB (DC in only)
Dimensions – 92x60mm (R-Pi B+: 85×56 mm)
Weight – 48 grams
Temperature Range – -15 to 75 C

The Main advantages of this Board over the new Raspberry Pi board the Raspberry Pi 2 ( A board I respect very highly! ) are the addition of a much more advanced CPU and GPU, The SGX544MP2 is one of the fastest graphics cores on the market for both Arm based Linux and it co- operating system of Android. The system Ram is a full speed DDR3 and the Ethernet port a full speed 1000Mbps.

The board also comes with much more advanced ports for a ( LVDS/RGB ) – LCD touch screen along with high res camera connectivity.

I have processed some benchmark tests on the Bpi M2 and on average this board runs at some 25% faster than the Raspberry Pi 2 which in itself is no slouch for this category of computer system.

Overall I am very impressed with this board as it is fast and very stable in operation, Its very fresh on the market so as yet will only run Raspbian Linux , I say only but Raspbian is a very stable and fully featured Linux implementation ! , It is fully expected that both Android and Ubuntu Linux along with Fedora Linux v21 will soon be available.

I will post a full review of this board when I have had some more time to work but as I final note here, The Allwinner A31s along with all the Allwinner Arm core CPU’s are among the fastest and best documented CPU’s around with full programming documentation being available as inline with the Open Systems methods and ethics.

Allwinner A31s

Radxa Rock

Radxa rock

Radxa Rock Specifications

SoC – Rockchip RK3188 ARM Cortex-A9 quad core @ 1.6Ghz + Mali-400 MP4 GPU
System Memory – 1GB DDR3 @ 800Mhz
Storage – micro-SD SDXC up to 128GB
Video Output – HDMI 1.4 up to 1080p@60hz, and AV output. LVDS interface.
Connectivity – 10/100M Ethernet port, WiFi 150Mbps 802.11b/g/n with antenna
Audio I/O – Audio S/PDIF, headphone jack
Camera – CSI interface
USB – 2x USB 2.0 host port, micro USB OTG
Debugging – Serial Console
Misc – IR sensor, power key, recovery key, reset key, 3 LEDs, RTC
Expansions Header – 80-pins including GPIO, I2C, SPI, Line in, USB 2.0, PWM, ADC, LCD, GPS… etc

I am very excited about receiving this Rockchip RK3188 based system and a big thank you to the American based distributes involved, who passed on a post IT show example 🙂

The specifications of this development board are as high as it gets for an ARM based computer system, it has taken many years ( Almost 30 years! ) for Arm based computers to advance to this level and future developments continue.

The areas of this board that excite me the most are , the 1.6ghz Quad core CPU that along with the 800 Mhz DDR3 RAM and L1 and L2 High spec Cache, place this system up near the 2Ghz + Intel Celeron processor specs. When you take into account that Both the Android and Linux Operating systems are vastly less demanding than MS-Windows with its Security issues – that require vast amounts of resources from a CPU and system memory along with constant disk thrashing needs, this makes the Radxa with its Quad core Cpu a very impressive computer indeed.

The areas of this board that both impress and excite me the most are the (CPU , Fast network connectivity and 80pin GPIO output) .

The fact that this system has twice as many GPIO output and input pins and the Raspberry Pi 2 and the Bannana Pi m2 is of great interest as it will be interesting to see just how these extra pins can be used during some Assembly language and Python coding projects.


The Rockchip RK3188 Cpu is documented here

Posted in Banana Pi M2, Development board hardware, Development boards, Python, Radxa rock, Single board computers | Tagged , , , , , , , , , , , , , | Leave a comment