Jul 12, 2010

an overview of arm board with mini2440

Mini2440 uses the samsung processor S3C2440 (arm7tdmi) from samsung. 

Processor S3C2440

Flash: 2MB NOR or 64MB(128, 256) NAND. Selected using S2 switch.

SDRAM: 2 Nos - 32MB each So total 64MB. Which has a 32 bit data bus width for maximum speed. Chip select nGCS6 places the SDRAM in 0 x 3000 0000.

Use JTAG Interface to program NOR flash with supervivi bios.

Features of my interest....

Jul 8, 2010

CPU digest.


DMA Controller: It contains source address, destination address and the count of words going to transfer between source and destination. One problem that can occur due to this is cache coherency.


Intel C8237 is a DMA chip.

Jul 1, 2010

Java Com API settings. ( access comm port through java )

Get comm.jar, win32com.dll, javax.comm.properties files.
Then follow the steps.
  1. copy comm.jar to jre/bin
  2. copy win32comm.dll to jre/bin
  3. copy javax.comm.properties to jre/lib
So that is it.... It is tea time... bye....

Jun 25, 2010

htc hero on android. (configure for ubuntu )

For to progam each android phone we need to define rules. the rules files are in
  • /etc/udev/rules.d/
For HTC Hero to work with android ubuntu.  First get android tools, eclipse, adt-plugin and bla blas required....( that is a common procedure ).

Jun 23, 2010

square of numbers near to the base



Square of 104 ( faster way.. )


     Answer will have  _ _ _ _ _  .That is five digits.

  1. add the 4 to the entire number that is 104+4 = 108_ _. so we got first 3 digits. we are adding 4 as the distance of the number from base is 4.
  2. remaining two digits.(two more digits are there because base is 100, which contains two zeros). 
  3. That is square of 4 ie 16 ( bcoz 104 is 4 number away from base ).
  4. So answer is 10816
Base means 100,1000,10000.. etc....

Basically what happened is, I have taken the base as 100. Now 104 is 4 more than the base. So immediately add that 4 to the entire number. That is 108 which is the first three digit of our answer. Now since base is 100 and it has two zeros. So now two more digits to go. So there comes square of 4 which is 16.

another example :
square of 112.
  1. 112 + 12 is 124.
  2. As base is 100 which contains two zeros we require two more digits.
  3. 12 square is 144 so answer is
  • 1 2 4
  •       1 4 4
  • That is 12544.
Analyse the number 1 under 4. How and Why :) ?

Another example 
square of 96
  1. 96 is 100 - 4 . here also base is 100 but our number is four less than the base.
  2. so we will subtract that 4 from our number 96 - 4 = 92
  3. now 2 more digits ( as base is 100 )
  4. now 4 square is 16 ( bcoz 96 is 4 number away from base )
  5. so answer is 9216
this is well explained in this video.


May 24, 2010

gnuarm and qemu

This tutorial explains compiling arm programs with gnuarm and porting it into qemu emulator.

Requirements: ( ubuntu linux )
  1. gnuarm toolchain ( www.gnuarm.com )
  2. qemu emulator ( sudo apt-get install qemu )
okie.. so here is the step

save the code in add.s
------------------------------------------
.text

start:
mov r0, #5 @r0 <----- 5
mov r1, #4 @r0 <----- 4
add r2, r1, r0
stop:
b stop @infinite loop to stop execution
------------------------------------------

.text is an assembler directive which says that the following section have to be assembled into the code section, rather than the .data section. So what is sections ?

So next is compiling the code with gnuarm toolchain.

arm-elf-as -o add.o add.s
this will assemble the code into an outputfile

arm-elf-ld -Ttext=0x0 -o add.elf add.o
-Ttext=0x0, specified that address should be assigned to the labels, such that the instructions were starting from address 0x0

arm-elf-nm add.elf
To view the address assigned for various labels.

The output file created by ld is in elf format. there are various formats available for storing executable code.
The elf format works fine when you have the os around.
Here we are going to run the program on a bare metal, we have to convert it into a simple binary format.

arm-elf-objcopy -O binary add.elf add.bin
to convert elf to binary format

ls -al add.bin
-rwxr-xr-x 1 akku akku 16 2010-05-24 10:17 add.bin
check the size it is 16bytes, 4 instructions ---> 4bytes ( 32 bit ) each

So we got the simple binary file which has to be flashed into the board.

So next is porting the binary file into qemu arm emulator

ARM processor on reset it will start executing from 0x0 ( whatever there is.. ram, rom, flash ).
On connex board 16MB flash is located at that address. So ARM executes instructions from 0x0 of the flash.
So we need a flash to use with qemu. For that we create a flash file and load it with full of zeros first.

dd if=/dev/zero of=flash.bin bs=4096 count=4096

add.bin file is copied into the beginning of this flash file
dd if=add.bin of=flash.bin bs=4096 conv=notrunc
this is equivalent of programming the bin file onto the flash memory.

Next start qemu
qemu-system-arm -M connex -pflash flash.bin -nographic -serial /dev/null

-M connex : specifies the machine connex to be emulated
-pflash : specifies that flash.bin represents the flash memory
-nographic : specifies that simulation of a graphic display is not required.
-serial /dev/null : specifies that serial port of the connex board is to be connected to /dev/null, so that the serial port data is discarded.

(qemu) info registers

check register R02 it will be 00000009

Referance:

May 11, 2010

living with ax4510 Board....

The board is based on the processor S3C4510B (ARM7TDMI).. So development requires 2 things...
  1. Toolchain: to compile the code
  2. Uploader: to upload the code
Toolchain: a collection of tools which produce end binary to run on a particular board.
cpp ----> gcc ----> as ----> ld
( cpp, gcc ) : Partially generated and downloaded source is compiled into executables

( as, ld ) : Existing executables are directly used (eg for ld:glibc/newlib ). May be h/w stds and std files for a board.

---------------------------------------------------
Two are required for porting other than u r C code.
  1. Startup code : assembler code which does low-level hardware initialization and sets up such things as stack.
  2. linker script : which will tell to the linker where to put which sections of your complied code
The function of the assembler startup file is to run the C program.The linker script explains to the linker where in the memory to put what.

Linker Script contains:
ENTRY : ENTRY( _startup ) means _startup as entry point, which is defined in the startup file and which is visible to linker as it is declared as global.

MEMORY:
MEMORY
{
RAM (rw) : ORIGIN = 0x40000200, LENGTH = (0x00002000 - 0x00000200 - 0x20 - 0x100)
}
RAM as Read/Write region of memory with origin and length of different sections.

SECTIONS:
.text
.rodata
for read-only data
.data read or write data
.bss
for zero-initialized statically allocated variables.


References:
http://only.mawhrin.net/~alexey/prg/lpc2103/tutorial-hello/
http://www.cse.iitb.ac.in/~uday/courses/cs715-09/gcc-code-view.pdf

For Web Developer

  open -a "Google Chrome" --args --disable-web-security