Tuesday, July 27, 2010

Linux Bash Scripts

0 comments

Saturday, July 24, 2010

GNU Make

1 comments

5.7 Recursive Use of make

Recursive use of make means using make as a command in a makefile. This technique is useful when you want separate makefiles for various subsystems that compose a larger system. For example, suppose you have a subdirectory subdir which has its own makefile, and you would like the containing directory's makefile to run make on the subdirectory. You can do it by writing this:

     subsystem:
cd subdir && $(MAKE)

or, equivalently, this (see Summary of Options):

     subsystem:
$(MAKE) -C subdir

You can write recursive make commands just by copying this example, but there are many things to know about how they work and why, and about how the sub-make relates to the top-level make. You may also find it useful to declare targets that invoke recursive make commands as `.PHONY' (for more discussion on when this is useful, see Phony Targets).

For your convenience, when GNU make starts (after it has processed any -C options) it sets the variable CURDIR to the pathname of the current working directory. This value is never touched by make again: in particular note that if you include files from other directories the value of CURDIR does not change. The value has the same precedence it would have if it were set in the makefile (by default, an environment variable CURDIR will not override this value). Note that setting this variable has no impact on the operation of make (it does not cause make to change its working directory, for example).

Thursday, July 22, 2010

PC Systems Programming Essentials

0 comments
[source: http://atrevida.comprenica.com/gameprog.html]

Sunday, July 18, 2010

Working Note

0 comments
  1. added bof_thread.h to /src/libjasper/include/jasper
  2. added bof_thread.h to libjasperinclude_HEADERS = \... in the Make file /src/libjasper/include/jasper
  3. moved #include to the jasper.h
  4. undo step 1-3, remove bof_thread.h
  5. added the linkedList struct and functions to the jas_malloc.h
  6. implemented the function body in the jas_malloc.c
  7. The imgcmp is using the jasper_seq.c as well, so if the linkedlist is available jasper.c and jasper_seq.c, it will cause the problem in compiling in the imgcmp.c, therefore, the variable and functions for the linkedlist are defined in the jasper_malloc.c which is available for both jasper.c and imgcmp.c
  8. extern for the variable
  • file A - the host, host the variable name and store its value
int global;
  • file B - the one uses the variable in file A - to read and write
extern int global;

Notes to Jasper Software

0 comments
==================
1. Linux
==================
  1. changed the -p to -pg in the CFLAG from all the Makefile from all subdirectory in the Jasper package




$ cp pnm_dec.c ../../../../
$ grep "putuint(" */*.c


$ vi +1859 pnm_dec.o //go to the line 1859 in the .o file (assembly file).





=====================================
2. Simple Scalar in cygwin
=====================================

------------------------------------------------------
2.1 Configure file configuration and command options..
------------------------------------------------------

[Bo@queen-6207ba776 ~/jasper-1.900.1-sm]$ ./configure AR=/home/nmanjiki/RESEARCH/ARCHITECTURE/SIMULATORS/SIMPLE_SCALAR/sslittle-na-sstrix/bin/ar CC=/home/nmanjiki/RESEARCH/ARCHITECTURE/SIMULATORS/SIMPLE_SCALAR/sslittle-na-sstrix/bin/gcc NM=/home/nmanjiki/RESEARCH/ARCHITECTURE/SIMULATORS/SIMPLE_SCALAR/sslittle-na-sstrix/bin/nm RANLIB=/home/nmanjiki/RESEARCH/ARCHITECTURE/SIMULATORS/SIMPLE_SCALAR/sslittle-na-sstrix/bin/ranlib


--------------------------------------------------
2.2 Generate Assembly code in SimpleScalar
--------------------------------------------------

[Bo@queen-6207ba776 ~/jasper-1.900.1-sm]$ /home/nmanjiki/RESEARCH/ARCHITECTURE/SIMULATORS/SIMPLE_SCALAR/sslittle-na-sstrix/bin/gcc -DHAVE_CONFIG_H -I.
-I. -I../../../src/libjasper/include/jasper -I../../../src/libjasper/include -g -O2 -S jas_icc.c -Wp,-MD,.deps/jas_icc.TPlo -o jas_icc.o

-S for generate the assembly code.


===================================================
3. Simulation on the Jasper by using the sim-mpfast
-------------------------------------------------------------------------
[Bo@queen-6207ba776 ~...src/appl]$ /home/nmanjiki/RESEARCH/ARCHITECTURE/SIMULATORS/SIMPLE_SCALAR/mp_simplesim/sim-mpfast ./jasper --input /home/bo/goldenears.bmp --output /home/bo/test2.jp2

......
# -config # load configuration from a file
# -dumpconfig # dump configuration to a file
# -h false # print help message
# -v false # verbose operation
# -d false # enable debug message
-seed 1 # random number generator seed (0 for timer seed)
# -q false # initialize and terminate immediately
......


=======================
4. thread in sim-mpfast
---------------------------------

  • Need this header file
"/home/nmanjiki/RESEARCH/ARCHITECTURE/SIMULATORS/SIMPLE_SCALAR/mp_simplesim/ssmp.h"
  • Need the following library
make[2]: Entering directory `/home/Bo/jasper-1.900.1-sm/src/appl'
/bin/sh ../../libtool --tag=CC --mode=link /home/nmanjiki/RESEARCH/ARCHITECTURE/SIMULATORS/SIMPLE_SCALAR/sslittle-na-sstrix/bin/gcc -g -O2 /home/nmanjiki/RESEARCH/ARCHITECTURE/SIMULATORS/SIMPLE_SCALAR
/mp_simplesim/libssmp.a
-o jasper jasper.o ../libjasper/libjasper.la
/home/nmanjiki/RESEARCH/ARCHITECTURE/SIMULATORS/SIMPLE_SCALAR/sslittle-na-sstrix/bin/gcc -g -O2 -o jasper.exe jasper.o /home/nmanjiki/RESEARCH/ARCHIT
ECTURE/SIMULATORS/SIMPLE_SCALAR/mp_simplesim/libssmp.a ../libjasper/.libs/libjasper.a
  • Changes made to the Makefile (src/appl/Makefile)
LDFLAGS = /home/nmanjiki/RESEARCH/ARCHITECTURE/SIMULATORS/SIMPLE_SCALAR/mp_simplesim/libssmp.a