Friday, September 28, 2012

Writing Your First PyQt4 OpenGL Program

1 Introduction

In this tutorial, we are going to have a glimpse of OpenGL programming in Python. I will introduce several simple Qt GUI applications and show you basic OpenGL programs.
Python is a programming language that lets you work more quickly and integrate your systems more effectively. PyQt is a Python wrapper for the C++ GUI framework Qt. Qt is a framework that uses the native widgets to draw its user interfaces.
PyOpenGL is a cross-platform open source Python binding to the standard OpenGL API. OpenGL is an application program interface that is used to define 2D and 3D computer graphics.
The article is written under Debian Linux. Packages that are required will be installed using powerful APT tool. If you are not a Linux user, however, don't worry. Since Python is a cross-platform language, Qt is a cross-platform framework, OpenGL is also a cross-platform interface, all the programs in this article also work for you. Just 'translate' the package installations according to your system and have fun.

Thursday, December 29, 2011

GDB Debugging ARM U-Boot on QEMU

1 Introduction


QEMU is a generic and open source machine emulator and virtualizer. In this article, we will use it as a machine emulator and run the U-Boot on top of it. It will also be demonstrated about how to debug U-Boot with GDB.

Wednesday, April 6, 2011

MIPS Exceptions Initialization and Handling on Linux

Exceptions and interrupts are un-expected events that disrupt the normal flow of execution. Interrupts are unexpected events from outside the CPU core. Exceptions are from within the CPU, including memory translation exceptions, cache misses, unusual program conditions such as unaligned loads, system calls and traps, and so on.

MIPS architecture adopts precise exception mechanisms, and make it easy for the software to deal with the exceptions. After any exception, CP0 EPC register points to the correct place to restart execution after the exception is dealt with.

Friday, March 4, 2011

Learning the Linux Boot Memory Allocator (MIPS)

Do you ever look at the report of 'cat /proc/meminfo' and wonder why the reported MemTotal is not equal to the amount of memory you have for the system? The followed is an example report from one of my systems. It shows the total memory is 60860kB (59.4MB) from line 2:

1 # cat /proc/meminfo
2 MemTotal:          60860 kB
3 MemFree:           47448 kB
4 Buffers:               0 kB
5 Cached:             7180 kB
6 SwapCached:            0 kB
7 ... 

which is different from the amount of memory that bootloader gave to kernel, 64MB.
1 ...
2 ## Transferring control to Linux (at address 800042f0) ...
3 ## Giving linux memsize in MB, 64 

Monday, June 21, 2010

Step by step to MIPS assembly

In this article, I am going to introduce how to write MIPS assembly. All the examples introduced will able to be assembled or compiled into actual executable programs. They can be executed on a MIPS machine running Linux. So, let's forget the simulator and come to real world :-P. The first is the most simple program.

Friday, December 4, 2009

MIPS calling convention with GCC

In this article, we are going to learn MIPS calling conventions by examples. And we will focus on the one used by GCC. All the examples will be compiled with GCC flag -mno-abicalls not generating SVR4-style position-independent code. Normally -mabicalls should be used, we disable it for the simplification of assembly codes.

Thursday, November 19, 2009

C99 Features

Here is a simple example demonstrating some of the C99 features. It is a test program I wrote for learning from C99 standard. Although it doesn't cover all the new features for C99, I think it is at least a start for people who are not familiar to C99 like me.

Click HERE to download c99.c.

Monday, November 16, 2009

Learning x86 Calling Conventions by Examples

The x86 architecture features many different calling conventions. There are three major calling conventions in use: __cdecl, __stdcall, and __fastcall. We are going to force the compiler to generate assembly with different calling conventions in order to see how they work.

Sunday, November 8, 2009

Understand Weak Symbols by Examples

Wikipedia defines the weak symbols: "In computing, a weak symbol is a symbol definition in an object file or dynamic library that may be overridden by other symbol definitions, its value will be zero if no definition found by loader." In other words, we can define a symbol that doesn't need to be resolved at link time. It is a very well-known feature and used a lot in Linux Kernel, Glibc, and so on.