Cookies disallowed, click button to change.
Cookies allowed, click button to disallow.
Pre-built MinGW version of the latest Clang compiler has been recently released as part of the LLVM version 3.2 release. Despite being labeled as the experimental release it is quite usable and can be easily installed in the MinGW/MSYS environment.
The first step is to either install MinGW/MSYS or verify that the installed version is up do date. For this particular release Clang has been build on a Windows 7 system with fresh installation of MinGW/MSYS which was installed using automated installer "mingw-get-inst-20120426.exe". See this page HOWTO Install the MinGW (GCC) Compiler Suite for details on how to install MinGW/MSYS environment.
Once MinGW/MSYS is installed it is time to download Clang 3.2 binaries from the llvm.org website download page link. The file name is "clang+llvm-3.2-x86-mingw32-EXPERIMENTAL.tar.gz" and it is a gziped tar archive that needs to be uncompressed. The easiest way would be to use MSYS tar command or a GUI based program like 7-zip, other archivers can be use provided that the "tar" format and links are supported.
Here is how to download and install binaries using MSYS command line assuming MinGW is installed in "/c/mingw" directory.
Open MSYS command line and type:
cd /c/mingw
mkdir tmp
cd tmp
wget http://llvm.org/releases/3.2/clang+llvm-3.2-x86-mingw32-EXPERIMENTAL.tar.gz
cd ..
tar -zxf tmp/clang+llvm-3.2-x86-mingw32-EXPERIMENTAL.tar.gz
and the actual session:
Pawel@Pawel-Pc /c/mingw/tmp
$ wget http://llvm.org/releases/3.2/clang+llvm-3.2-x86-mingw32-EXPERIMENTAL.ta>
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = c:\32bitmicro\win32/etc/wgetrc
--2012-12-23 18:05:07-- http://llvm.org/releases/3.2/clang+llvm-3.2-x86-mingw32
-EXPERIMENTAL.tar.gz
Resolving llvm.org... 128.174.246.134
Connecting to llvm.org|128.174.246.134|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 90244786 (86M) [application/x-gzip]
Saving to: `clang+llvm-3.2-x86-mingw32-EXPERIMENTAL.tar.gz'
100%[======================================>] 90,244,786 189K/s in 11m 25s
2012-12-23 18:16:32 (129 KB/s) - `clang+llvm-3.2-x86-mingw32-EXPERIMENTAL.tar.gz
' saved [90244786/90244786]
Pawel@Pawel-Pc /c/mingw/tmp
$ cd ..
Pawel@Pawel-Pc /c/mingw
$ tar -zxf tmp/clang+llvm-3.2-x86-mingw32-EXPERIMENTAL.tar.gz
This is it! Clang 3.2 is now installed in "/c/mingw/clang+llvm-3.2-x86-mingw32-EXPERIMENTAL/".
To quickly test let's compile classic "K&R C" style Hello world program from the "Programming in C: A Tutorial". In the command line window change directory back the "/c/mingw/tmp" and create "hello.c" file by typing this one line version of the original hello world. Back quotes before quotes are necessary due to the way the command line shell works.
cd tmp
echo "main() { printf(\"hello, world\");}" > hello.c
now compile it:
/c/mingw/clang+llvm-3.2-x86-mingw32-EXPERIMENTAL/bin/clang hello.c
actual session:
Pawel@Pawel-Pc /c/mingw
$ cd tmp
Pawel@Pawel-Pc /c/mingw/tmp
$ echo "main() { printf(\"hello, world\");}" > hello.c
Pawel@Pawel-Pc /c/mingw/tmp
$ /c/mingw/clang+llvm-3.2-x86-mingw32-EXPERIMENTAL/bin/clang hello.c
hello.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main() { printf("hello, world");}
^~~~
hello.c:1:10: warning: implicitly declaring library function 'printf' with type
'int (const char *, ...)'
main() { printf("hello, world");}
^
hello.c:1:10: note: please include the header <stdio.h> or explicitly provide a
declaration for 'printf'
2 warnings generated.
Pawel@Pawel-Pc /c/mingw/tmp
$ a.out
hello, world
Pawel@Pawel-Pc /c/mingw/tmp
Surprisingly this code still compiles and runs! However, with modern compiler like clang it produces number of warnings, which is why were are using it in a first place.
or "How to shrink a 30ft base-station into a three-inch Raspberry Pi"
"Overcoming some seriously complex obstacles along the way, we successfully managed to route voice and SMS traffic through the computer – as well as implement the GSM mobile phone standard. If you are developing your entry into the competition and are looking for inspiration – or are just interested in what can be done with this exciting new technology – please watch our video."
"The Raspberry Pi was used to set up three pieces of software:
OpenBTS – this implements the GSM mobile phone standard
FreeSWITCH – this routes calls in a similar way to Skype
our own python features – a programming script that assigns telephone numbers to colleagues."
It's a good day in the neighborhood both LLVM and Clang 3.2 have been released. You can read Chris's announcement here- web page link
There are many interesting goodies in this release so start your day by reading some Release Notes :-)
"Preface
The LLVM Compiler Infrastructure provides a versatile structure for creating new backends. Creating a new backend should not be too difficult once you familiarize yourself with this structure. However, the available backend documentation is fairly high level and leaves out many details. This tutorial will provide step-by-step instructions to write a new backend for a new target architecture from scratch.
We will use the Cpu0 architecture as an example to build our new backend. Cpu0 is a simple RISC architecture that has been designed for educational purposes. More information about Cpu0, including its instruction set, is available here. The Cpu0 example code referenced in this book can be found here. As you progress from one chapter to the next, you will incrementally build the backend’s functionality"
"Pure virtual functions provide a way to avoid defining base class member functions that have no meaningful implementation. "
"As in my prior articles, my sample classes represent an assortment of two-dimensional geometric shapes such as circle, rectangle, and triangle, all derived from a common base class called shape. The type hierarchy looks like: "
Object-oriented C is simple: Blog page link
"Although most C programmers aren't proficient in C++, they can still use simple object-oriented practices. Here's part one in a series of blogs presenting simple ways to mimic object-oriented practices in C.
I'm a strong proponent of using C++ to write embedded systems firmware. The facilities C++ brings to bear enables developers to create highly-portable object-oriented code. One of the great benefits of C++ is that it enforces rules that require the writer to navigate in object-oriented channels of thought and action. Without the use of object-oriented (OO) practices, over time you will lose clear lines of independent behavior. The result will be hidden interdependencies of subsystems that should only be known to one another through defined public interfaces.
So what about C? You can use C in ways that mimic C++'s principles and to some degree enforce OO constructs. In C, you don't have the protection of the compiler. To use OO practices in C, therefore, you need to create a set of rules and play by them. Choose your rules carefully--the rules you follow can make your job harder or easier, especially when debugging. Unlike some rules that require a bit of detective work, a violation of the rules I present here will be as clear as day to spot even for the casual observer of the source."
Object-oriented C is simple: Part 2 - Blog page link
"The motion-sensing sensors typically incorporated into consumer products include a 3-axis gyroscope, a 3-axis accelerometer, and a 3-axis geomagnetic sensor. Each of these sensors exhibits inherent strengths and weaknesses with respect to motion-tracking and absolute orientation. Recently, sensor “fusion” has found its way into consumer products as a method of overcoming the weaknesses of individual sensors. Sensor fusion is a sophisticated type of software that combines inputs from various sensors to yield a more accurate motion sensing result, typically involving complex algorithms that can take into account well over several hundred variables if implemented properly."
"Altera Corporation (NASDAQ: ALTR) today announced the first shipments of its 28 nm SoC devices, which combine a dual-core ARM® Cortex™-A9 processor system with FPGA logic on a single device. "
"The first devices Altera is shipping are low-power, low-cost Cyclone® V SoCs. " - press release web page link
"The digital revolution has been characterized by an explosion of new applications that take advantage of today’s high-speed broadband architecture. These include applications such as HD video streaming, gaming, VPN, social media, cloud computing and storage, and machine-to-machine (M2M) communications between embedded devices across both wired and wireless networks. Productivity and consumer entertainment has never been higher with these new applications, but this era has brought with it an increased risk of security compromises including piracy, IP theft and espionage, credit fraud and identity theft, and homeland security breaches, to name a few. Security has therefore come to the forefront of embedded system design.
Static-based approaches for embedded system security which define secure and non-secure zones by partitioning separate hardware subsystems for each zone have been effective so far. However, more scalable and cost-effective approaches are required to address the needs of newer devices running multiple applications over several secure zones. This paper examines the use of virtualization for creating the requisite scalable trusted execution environment for secure embedded systems. It also provides an overview of MIPS’ existing and forthcoming solutions for virtualization-based security."