Template Information

Trang

Chủ đề

BSP (44) Device Drivers (43) WinCE (38) WINDOWS DRIVER (19) Linux Device Drivers (18) ARM (17) Android tools and tips (17) DRIVER FILES (16) Windows Device Driver (16) AUDIO DRIVER (12) 8051 (8) OMAP (7) PRINTER DRIVER FILES (7) C Programming (6) ASUS MOTHERBOARD (5) Interfacing (5) NETWORK ADAPTER (5) VIDEO DRIVER (5) CANON (3) Device Driver Downloads (3) MOBILE PHONE (3) Asus Driver (2) EPSON (2) Epson Printer Driver (2) HP LAPTOP DRIVER (2) LAPTOP DRIVER FILES (2) Logitech Driver (2) NETWORK ADAPTOR (2) OMAP 4430 (2) drivers download (2) ACER (1) ACER TABLET (1) ALL IN ONE DRIVER (1) Acer Aspire 5738 Drivers (1) Analog-to-Digital (1) Asus Drivers (1) Asus Motherboard Drivers (1) Chip Architecture (1) DELL (1) Dell D610 Drivers (1) Dell Drivers (1) Device Drivers Download (1) Device drivers interview questions (1) Display Driver (1) Drivers Download for Windows 7 (1) EEPROMs (1) Free Asus Motherboard Drivers (1) Free Drivers Download for Windows 7 (1) GRAPHIC DRIVER (1) HP Driver (1) Hardware (1) Intel Drivers (1) Intel P35 (1) Intel P35 chipset drivers (1) I²C (1) LAPTOP SERVICE MANUAL (1) LCD (1) Logitech Mouse Driver (1) Logitech webcam driver (1) MODEM DRIVER (1) Motherboard Drivers for Windows 7 (1) PARALLEL PORT (1) Pc Driver (1) RTOS (1) Real Time Clock (1) Sensors (1) USB CABLE DRIVER (1) WEBCAM DRIVER (1) WIRELESS ADAPTOR (1) Windows 7 Drivers (1) Windows Mobile (1) acer driver (1) acer driver downloads (1) acer laptop driver (1) chipset drivers (1) network card driver (1) network driver download (1) sdcc (1)

Bài viết ngẫu nhiên

Xem phim HD Online

Số lượt views

Download Acer Aspire 5738 Drivers to inspire your Laptop Work Well

Thứ Bảy, 30 tháng 7, 2011 / 00:22


How fond are you of your Acer Aspire 5738? Couldn’t hear, speak a little louder! What did you say? It is your life and you just can’t depart from it. Wow, that sounds interesting! Then it might be in real good condition with no trouble at all, isn’t it? What, you are facing some sort of arcane troubles? Now that is as arcane as the trouble that you are facing!

Acer Driver Downloads

Have you checked out your Acer Aspire 5738 drivers? Yes, they can be behind all your troubles that are baffling you. Some people simply rush to the service centers to get their Acer laptop checked out and spend lot of bucks only to realize that the drivers were creating all the troubles whereas they were checking out other things.

So how come your Acer Aspire 5738 drivers behind all your troubles? Well, driver, as the name suggests, is a driving force that makes all the distinct devices on your laptop work properly. It explains its respective device the work it needs to do. So whatever you ask a certain device to do is first interpreted by its driver only then does the device get to know how it has to execute a certain piece of work. Now when it fails to understand what you are saying and can’t interpret it for the device, all your commands go vain.

But why would a driver stop working? Well, it is just a piece of software and like any other software, it can develop working issues. It can undergo some kind of conflict with some other software on your system leading to utter confusion of your system and thus both the software stops working. There is again a possibility that some virus attacks it but you save it out, however in the process some of the files go missing and it simply stops responding to your commands, or perhaps the virus completely damages the driver and it is no more able to support the device it is meant for. Again, you yourself may delete the Acer Aspire 5738 drivers mistakenly and the then the devices stop working all of a sudden.

So if any of the above things happens, you’ll find your laptop not responding when you try using some of the devices. Bluetooth, or the card reader for transferring stuffs, or the Wi-Fi connectivity for internet access, or simply the graphics and sound of your laptop stop behaving the way they behave otherwise.

And as such, all you need is to remove the damaged drivers (if they have got damaged), and re-install them. This needs you to hit the internet and go to any safe and secure site offering Acer Aspire 5738 Laptop Drivers and have them downloaded and installed there upon. This will make your laptop happy again!
Thứ Bảy, 30 tháng 7, 2011 00:22 Đọc tiếp >>

How to write U-Boot (Bootloader) - 2nd part

Thứ Tư, 20 tháng 7, 2011 / 22:05

1.1.3 U-Boot Linux boot process
U-Boot using the tag list (tagged list) to the Linux way of passing parameters. The data structure is marked tag, in the U-Boot source directory include / asm-arm / setup.h defined as follows:

struct tag_header {

u32 size; / * said the joint u tag data structure in real terms the size of the data stored in * /

u32 tag; / * that the type of tag * /

};

struct tag {

struct tag_header hdr;

union {

struct tag_core core;

struct tag_mem32 mem;

struct tag_videotext videotext;

struct tag_ramdisk ramdisk;

struct tag_initrd initrd;

struct tag_serialnr serialnr;

struct tag_revision revision;

struct tag_videolfb videolfb;

struct tag_cmdline cmdline;

/ *

* Acorn specific

* /

struct tag_acorn acorn;

/ *

* DC21285 specific

* /

struct tag_memclk memclk;

} U;

};
U-Boot to boot using the command bootm already loaded into memory in the kernel. The bootm command actually invokes a do_bootm function. For the Linux kernel, do_bootm function call function to set the mark do_bootm_linux list and start the kernel. do_bootm_linux function lib_arm / bootm.c defined as follows:

59 int do_bootm_linux (int flag, int argc, char * argv [], bootm_headers_t * images)

60 {

61 bd_t * bd = gd-> bd;

62 char * s;

63 int machid = bd-> bi_arch_number;

64 void (* theKernel) (int zero, int arch, uint params);

65

66 # ifdef CONFIG_CMDLINE_TAG

67 char * commandline = getenv ("bootargs"); / * U-Boot environment variables bootargs * /

68 # endif

... ...

73 theKernel = (void (*) (int, int, uint)) images-> ep; / * get kernel entry address * /

... ...

86 # if defined (CONFIG_SETUP_MEMORY_TAGS) | | \

87 defined (CONFIG_CMDLINE_TAG) | | \

88 defined (CONFIG_INITRD_TAG) | | \

89 defined (CONFIG_SERIAL_TAG) | | \

90 defined (CONFIG_REVISION_TAG) | | \

91 defined (CONFIG_LCD) | | \

92 defined (CONFIG_VFD)

93 setup_start_tag (bd); / * set ATAG_CORE flag * /

... ...

100 # ifdef CONFIG_SETUP_MEMORY_TAGS

101 setup_memory_tags (bd); / * set the memory to be marked * /

102 # endif

103 # ifdef CONFIG_CMDLINE_TAG

104 setup_commandline_tag (bd, commandline); / * set the command-line flags * /

105 # endif

... ...

113 setup_end_tag ​​(bd); / * set ATAG_NONE flags * /

114 # endif

115

116 / * we assume that the kernel is in place * /

117 printf ("\ nStarting kernel ... \ n \ n");

... ...

126 cleanup_before_linux (); / * start the kernel before the final setting of the CPU * /

127

128 theKernel (0, machid, bd-> bi_boot_params); / * call kernel * /

129 / * does not return * /

130

131 return 1;

132}

Which setup_start_tag, setup_memory_tags, setup_end_tag ​​function lib_arm / bootm.c defined as follows:

(1) setup_start_tag function

static void setup_start_tag (bd_t * bd)

{

params = (struct tag *) bd-> bi_boot_params; / * start address of kernel parameters * /

params-> hdr.tag = ATAG_CORE;

params-> hdr.size = tag_size (tag_core);

params-> u.core.flags = 0;

params-> u.core.pagesize = 0;

params-> u.core.rootdev = 0;

params = tag_next (params);

}

Tag list must ATAG_CORE start, setup_start_tag function parameters in the kernel set the start address of a ATAG_CORE tag.

(2) setup_memory_tags function

static void setup_memory_tags (bd_t * bd)

{

int i;

/ * Set a memory tag * /

for (i = 0; i
params-> hdr.tag = ATAG_MEM;

params-> hdr.size = tag_size (tag_mem32);

params-> u.mem.start = bd-> bi_dram [i]. start;

params-> u.mem.size = bd-> bi_dram [i]. size;

params = tag_next (params);

}

}

setup_memory_tags function sets a ATAG_MEM tag that contains the starting memory address, memory size, these two parameters.

(3) setup_end_tag ​​function

static void setup_end_tag ​​(bd_t * bd)

{

params-> hdr.tag = ATAG_NONE;

params-> hdr.size = 0;

}

Marked the end of the list must be marked ATAG_NONE, setup_end_tag ​​function sets a ATAG_NONE tag that marks the end of the list.

U-Boot after the set list will mark a call to the kernel. But before calling the kernel, CPU must meet the following conditions:

(1) CPU register settings
r0 = 0
r1 = machine code
r2 = kernel parameter marker list start address in RAM

(2) CPU operating modes
Disable IRQ and FIQ interrupts
CPU model for the SVC

(3) the failure of Data Cache and Instruction Cache

do_bootm_linux called cleanup_before_linux function in the complete prohibition and make the Cache fail interrupt function. cleanup_before_linux function cpu/arm920t/cpu. the definition:

int cleanup_before_linux (void)

{

/ *

* This function is called just before we call linux

* It prepares the processor for linux

*

* We turn off caches etc ...

* /

disable_interrupts (); / * prohibit FIQ / IRQ interrupt * /

/ * Turn off I / D-cache * /

icache_disable (); / * Instruction Cache failure to make * /

dcache_disable (); / * Cache the data fail * /

/ * Flush I / D-cache * /

cache_flush (); / * Refresh Cache * /

return 0;

}

As the U-Boot has been working since the start in the SVC mode, the CPU operating mode no need to set up.

do_bootm_linux in:

64 void (* theKernel) (int zero, int arch, uint params);

... ...

73 theKernel = (void (*) (int, int, uint)) images-> ep;

... ...

128 theKernel (0, machid, bd-> bi_boot_params);

73 lines of code to the kernel entry address ï ¿ ½ images-> epï ¿ ½ cast a function pointer. According ATPCS rules, functions, number of parameters more than 4, the use of r0 ~ r3 four registers to pass parameters. So the first line of the function call 128 to 0 will be placed in r0, into machine code machid r1, kernel parameters address bd-> bi_boot_params into r2, thus completing the register set, and finally to the kernel entry address.

Here, U-Boot's work is over, the system jumps to the Linux kernel code execution.
1.1.4 U-Boot command to add the method and process of U-Boot command

The following command to add a menu (Start menu) as an example to explain U-Boot to add commands.

(1) establishing common / cmd_menu.c

General command on the source code used on common directory, and the development board proprietary source code is placed on the command board / directory, and accustomed to "cmd_ . C" for the file name.

(2) defines "menu" command

In cmd_menu.c use the following code defines "menu" command:

_BOOT_CMD (

menu, 3, 0, do_menu,

"Menu - display a menu, to select the items to do something \ n",

"- Display a menu, to select the items to do something"

);

One U_BOOT_CMD command format is as follows:

U_BOOT_CMD (name, maxargs, rep, cmd, usage, help)

The significance of each parameter as follows:

name: command name, not a string, but in U_BOOT_CMD using "#" symbol into a string

maxargs: command the largest number of parameters

rep: whether to automatically repeat (press Enter key to whether it will repeat)

cmd: The command corresponding to the response function

usage: the use of a short description (string)

help: the use of a more detailed description (string)

Save command in the memory field will help take some of the memory, by configuring U-Boot can choose whether to help save the field. If include / configs / mini2440.h CONFIG_SYS_LONGHELP defined macro, then use U-Boot to a command, help command will display help information when the contents of the field usage and help, otherwise only shows usage field content.

U_BOOT_CMD macro in include / command.h defined:

# Define U_BOOT_CMD (name, maxargs, rep, cmd, usage, help) \

cmd_tbl_t __u_boot_cmd_ # # name Struct_Section = {# name, maxargs, rep, cmd, usage, help}

"# #" And "#" are pre-compiled a string concatenation operator ,"##" function, "#" followed by that followed a string.

Which cmd_tbl_t in include / command.h defined as follows:

struct cmd_tbl_s {

char * name; / * command name * /

int maxargs; / * maximum number of arguments * /

int repeatable; / * whether to automatically repeat * /

int (* cmd) (struct cmd_tbl_s *, int, int, char *[]); / * response function * /

char * usage; / * short help * /

# Ifdef CONFIG_SYS_LONGHELP

char * help; / * more detailed help information * /

# Endif

# Ifdef CONFIG_AUTO_COMPLETE

/ * The auto completion function * /

int (* complete) (int argc, char * argv [], char last_char, int maxv, char * cmdv []);

# Endif

};

typedef struct cmd_tbl_s cmd_tbl_t;

A cmd_tbl_t structure variable contains a command called the information they need.

Which Struct_Section in include / command.h defined as follows:

# Define Struct_Section __attribute__ ((unused, section (". U_boot_cmd")))

All with __attribute__ ((unused, section (". U_boot_cmd")) attributes declared variables will be stored in ". U_boot_cmd" section, and even if the variables are not explicit in the code using the compiler does not generate warning message.

Connect the U-Boot script u-boot.lds defined ". U_boot_cmd" section:

. =.;

__u_boot_cmd_start =.; / * will __u_boot_cmd_start designated as the current address * /

. U_boot_cmd: {* (. U_boot_cmd)}

__u_boot_cmd_end =.; / * will __u_boot_cmd_end specified as the current address * /

This indicates that with the ï ¿ ½. U_boot_cmdï ¿ ½ declare a function or variable will be stored in the ï ¿ ½ u_boot_cmdï ¿ ½ segments. So long as the U-Boot command corresponding cmd_tbl_t all variables with ï ¿ ½. U_boot_cmdï ¿ ½ statement, the compiler will automatically be placed in ï ¿ ½ u_boot_cmdï ¿ ½ section to find cmd_tbl_t variable between as long as __u_boot_cmd_start and __u_boot_cmd_end find it.

Therefore ï ¿ ½ menuï ¿ ½ macro command after the commencement of the definition is as follows:

cmd_tbl_t __u_boot_cmd_menu __attribute__ ((unused, section (". u_boot_cmd"))) = {menu, 3, 0, do_menu, "menu - display a menu, to select the items to do something \ n", "- display a menu, to select the items to do something "}

In essence, is to use the information U_BOOT_CMD macro constructs a cmd_tbl_t type of structure. Compiler structure on the ï ¿ ½ u_boot_cmdï ¿ ½ segment, execute the command you can ï ¿ ½ u_boot_cmdï ¿ ½ segment to the corresponding cmd_tbl_t find the type of structure.

(3) to achieve a function of command

Add ï ¿in cmd_menu.c ½ menuï ¿ ½ order response function implementation. Specific implementation code slightly:

int do_menu (cmd_tbl_t * cmdtp, int flag, int argc, char * argv [])

{

/ * Implement the code slightly * /

}

(4) common / cmd_menu.c compiled u-boot.bin

In common / Makefile add the following code:

COBJS-$ (CONFIG_BOOT_MENU) + = cmd_menu.o

In include/configs/mini2440.h participate in such a code:

# Define CONFIG_BOOT_MENU 1

Download U-Boot to recompile, you can use menu commands

(5) menu command in the process

Enter the U-Boot ï ¿ ½ menuï ¿ ½ command is executed, U-Boot to receive input string ï ¿ ½ menuï ¿ ½, passed to run_command function. run_command function call common / command.c implemented find_cmd function __u_boot_cmd_start and __u_boot_cmd_end between the find command, and returns the menu command cmd_tbl_t structure. Then run_command function uses the return cmd_tbl_t structure function pointer call menu command response function do_menu, thus completing the execution of the command.

Author: heaad

http://www.cnblogs.com/heaad/

E-mail: prabhat.b@gracelabs.com
Thứ Tư, 20 tháng 7, 2011 22:05 Đọc tiếp >>

How to write U-Boot (Bootloader)

Thứ Ba, 19 tháng 7, 2011 / 23:54

1.1 U-Boot working process

U-Boot to boot the kernel of the process can be divided into two stages, two stages of the following functions:

(1) The first stage from
Hardware initialization
Load U-Boot code to RAM space for the second stage
Set stack
Jump to the entrance of the second phase of the code

(2) The second phase of the function
Initialize the hardware devices used at this stage
Testing the system memory map
Read the kernel from Flash to RAM,
Set boot parameters for the kernel
Call kernel
1.1.1 U-Boot start the first stage of code analysis

The first phase of the corresponding file is cpu/arm920t/start.S and board/samsung/mini2440/lowlevel_init.S.

U-Boot start the first stage of the process is as follows:

Figure 2.1 U-Boot start the first stage of the process

According cpu/arm920t/u-boot.lds connection specified:

ENTRY (_start)

SECTIONS

{

. = 0×00000000;

. = ALIGN (4);

. Text:

{

cpu/arm920t/start.o (. text)

board/samsung/mini2440/lowlevel_init.o (. text)

board/samsung/mini2440/nand_read.o (. text)

* (. Text)

}

… …

}

The first link is cpu/arm920t/start.o, so u-boot.bin code cpu/arm920t/start.o entry, its source code in the cpu/arm920t/start.S. Here we analyze the cpu/arm920t/start.S implementation.
1. Hardware device initialization

(1) set an exception vector

cpu/arm920t/start.S at the beginning of the following code:

. Globl _start

_start: b start_code / * reset * /

ldr pc, _undefined_instruction / * undefined instruction vector * /

ldr pc, _software_interrupt / * software interrupt vector * /

ldr pc, _prefetch_abort / * Prefetch instruction exception vector * /

ldr pc, _data_abort / * exception vector data manipulation * /

ldr pc, _not_used / * not used * /

ldr pc, _irq / * irq interrupt vector * /

ldr pc, _fiq / * fiq interrupt vector * /

/ * Interrupt vector table entry address * /

_undefined_instruction:. word undefined_instruction

_software_interrupt:. word software_interrupt

_prefetch_abort:. word prefetch_abort

_data_abort:. word data_abort

_not_used:. word not_used

_irq:. word irq

_fiq:. word fiq

. Balignl 16,0 xdeadbeef

The above code sets the ARM exception vector table, each exception vector described below:

Table 2.1 ARM exception vector table
Address
Abnormal
Entry mode
Description

0×00000000
Reset
Management
Valid reset level, reset exception, the program jumps to the reset process at the implementation

0×00000004
Undefined instruction
Undefined mode
Instruction could not have handled, resulting in an undefined instruction exception

0×00000008
Software interrupt
Management
SWI instruction execution generated for user mode operation instruction program calls the privileged

0x0000000c
Stored instructions
Abort mode
Address of the instruction prefetch the processor does not exist, or the address is not allowed to access the current instruction to generate instruction prefetch abort exception

0×00000010
Data Manipulation
Abort mode
Address of the instruction processor data access does not exist or access the address is not allowed when the current instruction to generate the data abort exception

0×00000014
Unused
Unused
Unused

0×00000018
IRQ
IRQ
External interrupt request is valid, and I bit in the CPSR is 0, a IRQ exception

0x0000001c
FIQ
FIQ
Fast interrupt request pin is active, and the F bit in the CPSR is 0, generate FIQ exception


There are these exceptions in the cpu/arm920t/start.S corresponding exception handler. When an exception is generated, CPU exception number according to the scale anomaly found in the corresponding exception vector, and then run at the jump instruction exception vector, CPU to jump to the corresponding exception handler execution.
 Reset exception vector in which the instruction "b start_code" determine the U-Boot boot will automatically jump to the label "start_code" at the execution.

(2) CPU into the SVC mode

start_code:

/ *

* Set the cpu to SVC32 mode

* /

mrs r0, cpsr

bic r0, r0, # 0x1f / * mode bits cleared * /

orr r0, r0, # 0xd3 / * mode bit is set to "10011" (management), and interrupt and fast interrupt prohibition against bit position 1 * /

msr cpsr, r0

The above code will set the CPU mode bit of work to management, and interrupt and fast interrupt prohibition against bit position one, thus shielding the IRQ and FIQ interrupts.
(3) Set the control register address

# If defined (CONFIG_S3C2400)

# Define pWTCON 0×15300000

# Define INTMSK 0×14400008

# Define CLKDIVN 0×14800014

# Else / * s3c2410 s3c2440 the following four registers with the same address * /

# Define pWTCON 0×53000000 / * WATCHDOG control register address * /

# Define INTMSK 0x4A000008 / * INTMSK register address * /

# Define INTSUBMSK 0x4A00001C / * INTSUBMSK register address * /

# Define CLKDIVN 0x4C000014 / * CLKDIVN register address * /

# Endif

S3c2440 on the development board with the above code to complete the WATCHDOG, INTMSK, INTSUBMSK, CLKDIVN four register address setting. Each register address see references [4].
(4) Close Watchdog

ldr r0, = pWTCON

mov r1, # 0×0

str r1, [r0] / * watchdog controller, the lowest level is 0, the watchdog reset signal is not output * /

The above code is written to the Watchdog control register 0, the watchdog off. Otherwise, the U-Boot startup, CPU will continue to reboot.

(5) maskable interrupt

/ *

* Mask all IRQs by setting all bits in the INTMR – default

* /

mov r1, # 0xffffffff / * someone is set to a corresponding interrupt mask * /

ldr r0, = INTMSK

str r1, [r0]

INTMSK is the main interrupt mask register, each corresponding to SRCPND (interrupt pin register) in the one, that SRCPND the appropriate representatives of the CPU interrupt request is being processed.

According to Reference 4, INTMSK register is a 32-bit registers, each corresponding to an interrupt, write to them all the location 0xffffffff will INTMSK a register to mask the corresponding interrupt.

# If defined (CONFIG_S3C2440)

ldr r1, = 0x7fff

ldr r0, = INTSUBMSK

str r1, [r0]

# Endif

INTSUBMSK SUBSRCPND in each one corresponding to that SUBSRCPND the appropriate representatives of the CPU interrupt request is being processed.

According to Reference 4, INTSUBMSK register is a 32 bit register, but only a low 15. To write to 0x7fff is to INTSUBMSK register all valid bit (low 15) set a to mask the corresponding interrupt.
(6) set MPLLCON, UPLLCON, CLKDIVN

# If defined (CONFIG_S3C2440)

# Define MPLLCON 0x4C000004

# Define UPLLCON 0x4C000008

ldr r0, = CLKDIVN

mov r1, # 5

str r1, [r0]

ldr r0, = MPLLCON

ldr r1, = 0x7F021

str r1, [r0]

ldr r0, = UPLLCON

ldr r1, = 0×38022

str r1, [r0]

# Else

/ * FCLK: HCLK: PCLK = 1:2:4 * /

/ * Default FCLK is 120 MHz! * /

ldr r0, = CLKDIVN

mov r1, # 3

str r1, [r0]

# Endif

CPU power on a few milliseconds, the crystal output stability, FCLK = Fin (crystal frequency), CPU to execute instructions. But in fact, FCLK can be higher than Fin, to improve the system clock, the software needed to enable the PLL. This requires setting CLKDIVN, MPLLCON, UPLLCON the three registers.

CLKDIVN register sets FCLK, HCLK, PCLK ratio among the three can be set according to Table 2.2.

Table 2.2 S3C2440's CLKDIVN Register format
CLKDIVN
Bit
Help
Initial value

HDIVN
[2:1]
00: HCLK = FCLK / 1.

01: HCLK = FCLK / 2.

10: HCLK = FCLK / 4 (when CAMDIVN [9] = 0 pm)

HCLK = FCLK / 8 (when CAMDIVN [9] = 1 pm)

11: HCLK = FCLK / 3 (when CAMDIVN [8] = 0 pm)

HCLK = FCLK / 6 (when CAMDIVN [8] = 1 pm)
00

PDIVN
[0]
0: PCLK = HCLK / 1 1: PCLK = HCLK / 2
0


Set CLKDIVN to 5, will HDIVN set to binary 10, the CAMDIVN [9] has not been changed, the default is 0, so HCLK = FCLK / 4. PDIVN is set to 1, so PCLK = HCLK / 2. So divider FCLK: HCLK: PCLK = 1:4:8.

MPLLCON register used to set multiple FCLK and Fin. MPLLCON bits [19:12] called MDIV, bits [9:4] is called PDIV, bits [1:0] is called SDIV.

For S3C2440, FCLK relationship with Fin as the following formula:

MPLL (FCLK) = (2 � m � Fin) / (p � 14 2 s'>)

Where: m = MDIC +8, p = PDIV +2, s = SDIV

MPLLCON and UPLLCON can reference the value of 4 "PLL VALUE SELECTION TABLE" setting. Part of the table are summarized as follows:

Table 2.3 PLL value recommendation
Input Frequency
Output frequency
MDIV
PDIV
SDIV

12.0000MHz
48.00 MHz
56 (0×38)
2
2

12.0000MHz
405.00 MHz
127 (0x7f)
2
1


When mini2440 system frequency is set to 405MHZ, USB clock frequency is set to 48MHZ, the system can be stabilized to run, so set MPLLCON and UPLLCON as:

MPLLCON = (0x7f <<12) | (0×02 <<4) | (0×01) = 0x7f021

UPLLCON = (0×38 <<12) | (0×02 <<4) | (0×02) = 0×38022

 (7) Close the MMU, cache

Read on:

# Ifndef CONFIG_SKIP_LOWLEVEL_INIT

bl cpu_init_crit

# Endif

cpu_init_crit this code in the U-Boot starts normally only need to do that if U-Boot from RAM to start, you should comment out the code.

The following analysis of what to do about cpu_init_crit in the end:

320 # ifndef CONFIG_SKIP_LOWLEVEL_INIT

321 cpu_init_crit:

322 / *

323 * the data cache and instruction cache is invalid * /

324 * /

325 mov r0, # 0

326 mcr p15, 0, r0, c7, c7, 0 / * write 0 to the c7 will ICache and DCache void * /

327 mcr p15, 0, r0, c8, c7, 0 / * write 0 to c8 TLB will fail * /

328

329 / *

330 * disable MMU stuff and caches

331 * /

332 mrc p15, 0, r0, c1, c0, 0 / * read control register to r0 in the * /

333 bic r0, r0, # 0×00002300 @ clear bits 13, 9:8 (- V– RS)

334 bic r0, r0, # 0×00000087 @ clear bits 7, 2:0 (B —-CAM)

335 orr r0, r0, # 0×00000002 @ set bit 2 (A) Align

336 orr r0, r0, # 0×00001000 @ set bit 12 (I) I-Cache

337 mcr p15, 0, r0, c1, c0, 0 / * Save r0 to the control register * /

338

339 / *

340 * before relocating, we have to setup RAM timing

341 * because memory timing is board-dependend, you will

342 * find a lowlevel_init.S in your board directory.

343 * /

344 mov ip, lr

345

346 bl lowlevel_init

347

348 mov lr, ip

349 mov pc, lr

350 # endif / * CONFIG_SKIP_LOWLEVEL_INIT * /

Code c0, c1, c7, c8 are the ARM920T coprocessor CP15 registers. Where c7 is the cache control register, c8 is the TLB control register. 325 ~ 327 lines of code to 0 written c7, c8, the Cache, TLB void.

332 ~ 337 lines of code to turn off the MMU. This is by modifying the c1 CP15 registers to achieve, look at the c1 CP15 register format (only the bits used in the code listed):
Table 2.3 CP15 of c1 register format (Part I)
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0

.
.
V
I
.
.
R
S
B
.
.
.
.
C
A
M


The significance of each bit is as follows:

V: express exception to the location scale, 0: exception vector at 0×00000000; 1: exception vector in 0xFFFF0000
I: 0: off ICaches; 1: Open ICaches
R, S: used in conjunction with page table descriptors to identify memory access with
B: 0: CPU is little endian; 1: CPU is big endian
C: 0: off DCaches; 1: Open DCaches
A: 0: data access alignment checking when no address; 1: data access address when alignment checking
M: 0: off MMU; 1: Open the MMU

332 ~ 337 lines of code to the M c1 position zero, closed the MMU.

(8) RAM control register initialization

Which lowlevel_init memory initialization is complete the work, because the memory initialization is dependent on the development board, so lowlevel_init generic code on the board following the appropriate directory. For mini2440, lowlevel_init defined in board/samsung/mini2440/lowlevel_init.S as follows:

45 # define BWSCON 0×48000000 / * 13 more storage start address * /

… …

129 _TEXT_BASE:

130. Word TEXT_BASE

131

132. Globl lowlevel_init

133 lowlevel_init:

134 / * memory control configuration * /

135 / * make r0 relative the current location so that it * /

136 / * reads SMRDATA out of FLASH rather than memory! * /

137 ldr r0, = SMRDATA

138 ldr r1, _TEXT_BASE

139 sub r0, r0, r1 / * SMRDATA by _TEXT_BASE is offset register 13 * /

140 ldr r1, = BWSCON / * Bus Width Status Controller * /

141 add r2, r0, # 13 * 4

1420:

143 ldr r3, [r0], # 4 / * register values ​​to each of the 13 assigned to the corresponding register * /

144 str r3, [r1], # 4

145 cmp r2, r0

146 bne 0b

147

148 / * everything is fine now * /

149 mov pc, lr

150

151. Ltorg

152 / * the literal pools origin * /

153

154 SMRDATA: / * The following are the 13 register values ​​* /

155. Word … …

156. Word … …

… …
 lowlevel_init initialization register 13 to achieve the RAM clock initialization. lowlevel_init function for U-Boot from NAND Flash or NOR Flash boot situation are valid.

U-Boot.lds link script with the following code:

. Text:

{

cpu/arm920t/start.o (. text)

board/samsung/mini2440/lowlevel_init.o (. text)

board/samsung/mini2440/nand_read.o (. text)

… …

}

board/samsung/mini2440/lowlevel_init.o will be linked to cpu/arm920t/start.o back, so board / samsung/mini2440/lowlevel_init.o U-Boot is also the first 4KB of code.

U-Boot in the NAND Flash start, lowlevel_init.o will automatically be read to the CPU internal 4KB of internal RAM. So the first 137 to 146 lines of code copied from the CPU registers internal RAM to the appropriate register values.

For the U-Boot boot in the case of NOR Flash, as determined when U-Boot connected U-Boot address is the address in memory, at which point U-Boot NOR Flash is still, so still need to read in the NOR Flash get data to the RAM.

NOR Flash as the start address is 0, and U-Boot to load into memory the starting address is TEXT_BASE, SMRDATA the address label is in the Flash SMRDATA-TEXT_BASE.

In summary, lowlevel_init role is to start the 13 SMRDATA copies the value of start address [BWSCON] 13 registers, thus completing the storage controller settings.

(9) Copy the second phase of U-Boot code to RAM

cpu/arm920t/start.S the original code is only support boot from NOR Flash, and a modified U-Boot is now in the NOR Flash and NAND Flash started on both realize the idea is this:

bl bBootFrmNORFlash / * determine the U-Boot in NAND Flash or NOR Flash boot * /

cmp r0, # 0 / * r0 storage bBootFrmNORFlash function return value, return 0 if the NAND Flash start, or that start in the NOR Flash * /

beq nand_boot / * Jump to NAND Flash boot code * /

/ * NOR Flash boot code * /

b stack_setup / * skip start code * NAND Flash /

nand_boot:

/ * NAND Flash boot code * /

stack_setup:

/ * Other code * /
Role is to determine the function of which bBootFrmNORFlash U-Boot in NAND Flash or NOR Flash boot boot boot NOR Flash if it returns 1, otherwise it returns 0. According to ATPCS rules, the function return value will be stored in r0 register, so after the function call bBootFrmNORFlash according able to judge the value of r0 U-Boot in the NAND Flash or NOR Flash boot start. bBootFrmNORFlash function is defined in the board/samsung/mini2440/nand_read.c as follows:

int bBootFrmNORFlash (void)

{

volatile unsigned int * pdw = (volatile unsigned int *) 0;

unsigned int dwVal;

dwVal = * pdw; / * first record the original data * /

* Pdw = 0×12345678;

if (* pdw! = 0×12345678) / * write fails, start in the NOR Flash * /

{

return 1;

}

else / * write success that started in the NAND Flash * /

{

* Pdw = dwVal; / * restore original data * /

return 0;

}

}

Either from the NAND Flash NOR Flash or from the start, the address 0 for the U-Boot for the first instruction "b start_code".

For the situation from the NAND Flash start, it starts 4KB of code will be automatically copied to the internal 4K memory, CPU, so you can modify the direct assignment method.

For the situation from the start NOR Flash, NOR Flash is the beginning of the address 0, must pass a certain sequence of commands to write data to NOR Flash, so can this difference to distinguish from the NAND Flash or NOR Flash boot: to address 0 to write a data, and then read out, if we find that the failure to write NOR Flash, otherwise NAND Flash.

NOR Flash started to analyze the following part of the code:

208 adr r0, _start / * r0 <- current position of code * /

209 ldr r1, _TEXT_BASE / * test if we run from flash or RAM * /

/ * U-Boot to determine whether it is downloaded to the RAM to run, and if so, no longer copied to the RAM in, and this usually happens only when debugging U-Boot * /

210 cmp r0, r1 / * _start equal _TEXT_BASE that is downloaded to the RAM to run * /

211 beq stack_setup

212 / * The following front label until nand_boot are NOR Flash boot code * /

213 ldr r2, _armboot_start

214 ldr r3, _bss_start

215 sub r2, r3, r2 / * r2 <- size of armboot * /

216 add r2, r0, r2 / * r2 <- source end address * /

217 / * move to the U-Boot itself in RAM * /

218 copy_loop:
 219 ldmia r0!, {R3-r10} / * from the address [r0] the NOR Flash 8 characters read into the data * /

220 stmia r1!, {R3-r10} / * r3 to r10 registers the data replication to address [r1] memory * /

221 cmp r0, r2 / * until source end addreee [r2] * /

222 ble copy_loop

223 b stack_setup / * skip start code * NAND Flash /

NAND Flash start again following analysis of part of the code:

nand_boot:

mov r1, # NAND_CTL_BASE

ldr r2, = ((7 <<12) | (7 <<8) | (7 <<4) | (0 <<0))

str r2, [r1, # oNFCONF] / * set NFCONF register * /

/ * Set NFCONT, initialize the ECC encoder / decoder, prohibiting NAND Flash Chip Select * /

ldr r2, = ((1 <<4) | (0 <<1) | (1 <<0))

str r2, [r1, # oNFCONT]

ldr r2, = (0×6) / * set NFSTAT * /

str r2, [r1, # oNFSTAT]

/ * Reset command before the first use of NAND Flash Reset * /

mov r2, # 0xff

strb r2, [r1, # oNFCMD]

mov r3, # 0

/ * Call the C function nand_read_ll ready for the stack * /

ldr sp, DW_STACK_START

mov fp, # 0

/ * The following first set r0 to r2, and then call the function U-Boot nand_read_ll read RAM * /

ldr r0, = TEXT_BASE / * destination address: U-Boot start address in RAM * /

mov r1, # 0×0 / * Source Address: U-Boot in the NAND Flash in the beginning of the address * /

mov r2, # 0×30000 / * copy the size of the file must be large compared with u-boot.bin, and the NAND Flash block size must be an integer multiple of, where is set to 0×30000 (192KB) * /

bl nand_read_ll / * jump to nand_read_ll function, U-Boot to start copying RAM * /

tst r0, # 0×0 / * check the return value is correct * /

beq stack_setup

bad_nand_read:

loop2: b loop2 / / infinite loop

. Align 2

DW_STACK_START:. Word STACK_BASE + STACK_SIZE-4

One NAND_CTL_BASE, oNFCONF other in include/configs/mini2440.h defined as follows:

# Define NAND_CTL_BASE 0x4E000000 / / NAND Flash control register base address

# Define STACK_BASE 0x33F00000 / / base address of stack

# Define STACK_SIZE 0×8000 / / size of stack

# Define oNFCONF 0×00 / * NFCONF NAND_CTL_BASE offset relative to the address * /

# Define oNFCONT 0×04 / * NFCONT NAND_CTL_BASE offset relative to the address * /

# Define oNFADDR 0x0c / * NFADDR NAND_CTL_BASE offset relative to the address * /

# Define oNFDATA 0×10 / * NFDATA NAND_CTL_BASE offset relative to the address * /

# Define oNFCMD 0×08 / * NFCMD NAND_CTL_BASE offset relative to the address * /

# Define oNFSTAT 0×20 / * NFSTAT NAND_CTL_BASE offset relative to the address * /

# Define oNFECC 0x2c / * NFECC NAND_CTL_BASE offset relative to the address * /

NAND Flash control register set of each data sheet in the S3C2440 is described in detail here not introduced.

Code nand_read_ll function in the NAND Flash in handling U-Boot to RAM, the function is defined in the board/samsung/mini2440/nand_read.c.

According to the size of NAND Flash page can be divided into two kinds: 512B/page and 2048B/page's. The two NAND Flash read operation is different. Hence the need for U-Boot to identify the type of NAND Flash, and then use the appropriate read, that can automatically adapt to nand_read_ll function of two NAND Flash.

Reference data sheet S3C2440 can know: According to the NFCONF register Bit3 (AdvFlash (Read only)) and Bit2 (PageSize (Read only)) can determine the type of NAND Flash. Bit2, Bit3 and NAND Flash's block type of relationship as follows:
Table 2.4 NFCONF the Bit3, Bit2 relationship with NAND Flash
Bit2 Bit3
0
1

0
256 B / page
512 B / page

1
1024 B / page
2048 B / page


As the NAND Flash only 512B/page and 2048 B / page two, so register under NFCONF Bit3 NAND Flash can be a distinction between the two.

See the complete code in nand_read_ll board/samsung/mini2440/nand_read.c function, here are a pseudo-code:

int nand_read_ll (unsigned char * buf, unsigned long start_addr, int size)

{

/ / Register under NFCONF Bit3 to distinguish two kinds of NAND Flash

if (NFCONF & 0×8) / * Bit is 1, that is 2KB/page the NAND Flash * /

{

////////////////////////////////////

2K block of the NAND Flash Read

////////////////////////////////////

}

else / * Bit is 0, that is 512B/page the NAND Flash * /

{

/////////////////////////////////////

Read 512B block of the NAND Flash

/////////////////////////////////////

}

return 0;

}

(10) set the stack

/ * Set the stack * /

stack_setup:

ldr r0, _TEXT_BASE / * upper 128 KiB: relocated uboot * /

sub r0, r0, # CONFIG_SYS_MALLOC_LEN / * malloc area * /

sub r0, r0, # CONFIG_SYS_GBL_DATA_SIZE / * Skip the global data area * /

# Ifdef CONFIG_USE_IRQ

sub r0, r0, # (CONFIG_STACKSIZE_IRQ + CONFIG_STACKSIZE_FIQ)

# Endif

sub sp, r0, # 12 / * leave 3 words for abort-stack * /

As long as the sp has not been used a pointer to the memory set to complete the stack. According to the above code to know U-Boot memory usage, and as shown below:


Figure 2.2 U-Boot memory usage

(11) Clear BSS section

clear_bss:

ldr r0, _bss_start / * BSS segment start address specified in the u-boot.lds * /

ldr r1, _bss_end / * BSS segment end address, specified in the u-boot.lds * /

mov r2, # 0×00000000

clbss_l: str r2, [r0] / * clear the bss segment * /

add r0, r0, # 4

cmp r0, r1

ble clbss_l
 The initial value is 0, no initial value of global variables, static variables will be automatically placed in BSS segment. These variables should be assigned the initial value is 0, otherwise the initial value of these variables will be a random value, if some programs do not directly use the uninitialized variable will cause unknown consequences.

(12) jump to the entrance of the second phase of the code

ldr pc, _start_armboot

_start_armboot:. word start_armboot

Jump to the second phase of the code at the entrance start_armboot.
1.1.2 U-Boot start the second stage of code analysis

start_armboot function lib_arm / board.c defined, is the U-Boot code for the second phase of the entrance. U-Boot start the second phase of the process is as follows:

Figure 2.3 U-Boot the second phase of the implementation process

Start_armboot function before the analysis to look at some important data structures:

(1) gd_t structure

U-Boot uses a structure gd_t global data area to store the data, the structure in include / asm-arm / global_data.h defined as follows:

typedef struct global_data {

bd_t * bd;

unsigned long flags;

unsigned long baudrate;

unsigned long have_console; / * serial_init () was called * /

unsigned long env_addr; / * Address of Environment struct * /

unsigned long env_valid; / * Checksum of Environment valid? * /

unsigned long fb_base; / * base address of frame buffer * /

void ** jt; / * jump table * /

} Gd_t;

U-Boot uses a pointer stored in the register to record the global data area gd address:

# Define DECLARE_GLOBAL_DATA_PTR register volatile gd_t * gd asm ("r8")

DECLARE_GLOBAL_DATA_PTR gd_t global data structure to define a pointer, the pointer stored in the specified register r8. The statement also avoid compiler r8 assigned to other variables. Anyone who wants to access the global data area code, as long as the code at the beginning of accession "DECLARE_GLOBAL_DATA_PTR" line of code, and then you can use to access the global data pointer gd zone.

According to U-Boot memory map can be calculated using the gd value:

gd = TEXT_BASE-CONFIG_SYS_MALLOC_LEN – sizeof (gd_t)

(2) bd_t structure

bd_t in include / asm-arm.u / u-boot.h defined as follows:

typedef struct bd_info {

int bi_baudrate; / * Serial communication baud rate * /

unsigned long bi_ip_addr; / * IP address * /

struct environment_s * bi_env; / * start address of environment variables * /

ulong bi_arch_number; / * native code development board * /

ulong bi_boot_params; / * start address of kernel parameters * /

struct / * RAM configuration information * /

{
ulong start;

ulong size;

} Bi_dram [CONFIG_NR_DRAM_BANKS];

} Bd_t;

When U-Boot to boot the kernel to pass parameters to give the kernel, then we should use gd_t, bd_t structure the information to set the mark list.

(3) init_sequence array

U-Boot to use an array to store init_sequence development board for most every function of the implementation of the initialization function pointer. init_sequence array has more compiler options, remove the compiler option init_sequence array as follows:

typedef int (init_fnc_t) (void);

init_fnc_t * init_sequence [] = {

board_init, / * development board specific configuration –board/samsung/mini2440/mini2440.c * /

timer_init, / * clock initialization – cpu/arm920t/s3c24x0/timer.c * /

env_init, / * initialize the environment variable –common/env_flash.c or common / env_nand.c * /

init_baudrate, / * initialize the baud rate – lib_arm / board.c * /

serial_init, / * Serial initialization – drivers/serial/serial_s3c24x0.c * /

console_init_f, / * control communications platform initialization phase 1 – common / console.c * /

display_banner, / * print the U-Boot version, compile time – gedit lib_arm / board.c * /

dram_init, / * allocation of available RAM – board/samsung/mini2440/mini2440.c * /

display_dram_config, / * display RAM size – lib_arm / board.c * /

NULL,

};

Board/samsung/mini2440/mini2440.c which board_init defined function, the function sets the MPLLCOM, UPLLCON, and some GPIO register values, also set the U-Boot and kernel boot parameters of the machine code address:

/ * MINI2440 development board of the machine code * /

gd-> bd-> bi_arch_number = MACH_TYPE_MINI2440;

/ * The kernel boot parameter address * /

gd-> bd-> bi_boot_params = 0×30000100;

Which dram_init function board/samsung/mini2440/mini2440.c defined as follows:

int dram_init (void)

{

/ * The mini2440 only * /

gd-> bd-> bi_dram [0]. start = PHYS_SDRAM_1;

gd-> bd-> bi_dram [0]. size = PHYS_SDRAM_1_SIZE;

return 0;

}

mini2440 32MB of SDRAM using two components of the 64MB of memory, connected to the memory controller BANK6, address space is 0×30000000 ~ 0×34000000.

In include/configs/mini2440.h in PHYS_SDRAM_1 and PHYS_SDRAM_1_SIZE were defined as a 0×30000000 and 0×04000000 (64M).

After analyzing the above data structure, to analyze the start_armboot following functions:

void start_armboot (void)

{

init_fnc_t ** init_fnc_ptr;

char * s;

… …

/ * Calculate the address of global data structures gd * /

gd = (gd_t *) (_armboot_start – CONFIG_SYS_MALLOC_LEN – sizeof (gd_t));

… …
 memset ((void *) gd, 0, sizeof (gd_t));

gd-> bd = (bd_t *) ((char *) gd – sizeof (bd_t));

memset (gd-> bd, 0, sizeof (bd_t));

gd-> flags | = GD_FLG_RELOC;

monitor_flash_len = _bss_start – _armboot_start;

/ * One by one call init_sequence array initialization function * /

for (init_fnc_ptr = init_sequence; * init_fnc_ptr; + + init_fnc_ptr) {

if ((* init_fnc_ptr) ()! = 0) {

hang ();

}

}

/ * Armboot_start in cpu/arm920t/start.S be initialized to u-boot.lds connection script _start * /

mem_malloc_init (_armboot_start – CONFIG_SYS_MALLOC_LEN,

CONFIG_SYS_MALLOC_LEN);

/ * NOR Flash initialization * /

# Ifndef CONFIG_SYS_NO_FLASH

/ * Configure available FLASH banks * /

display_flash_config (flash_init ());

# Endif / * CONFIG_SYS_NO_FLASH * /

… …

/ * NAND Flash initialization * /

# If defined (CONFIG_CMD_NAND)

puts ("NAND:");

nand_init (); / * go init the NAND * /

# Endif

… …

/ * Configure the environment variables and re-position * /

env_relocate ();

… …

/ * Get from the IP address of environment variables * /

gd-> bd-> bi_ip_addr = getenv_IPaddr ("ipaddr");

stdio_init (); / * get the devices list going. * /

jumptable_init ();

… …

console_init_r (); / * fully init console as a device * /

… …

/ * Enable exceptions * /

enable_interrupts ();

# Ifdef CONFIG_USB_DEVICE

usb_init_slave ();

# Endif

/ * Initialize from environment * /

if ((s = getenv ("loadaddr"))! = NULL) {

load_addr = simple_strtoul (s, NULL, 16);

}
# If defined (CONFIG_CMD_NET)

if ((s = getenv ("bootfile"))! = NULL) {

copy_filename (BootFile, s, sizeof (BootFile));

}

# Endif

… …

/ * Initialize adapter * /

# If defined (CONFIG_CMD_NET)

# If defined (CONFIG_NET_MULTI)

puts ("Net:");

# Endif

eth_initialize (gd-> bd);

… …

# Endif

/ * Main_loop () can return to retry autoboot, if so just run it again. * /

for (;;) {

main_loop ();

}

/ * NOTREACHED – no way out of command loop except booting * /

}

main_loop function in common / main.c defined. Under normal circumstances, a number of seconds into the main_loop not function

















Thứ Ba, 19 tháng 7, 2011 23:54 Đọc tiếp >>

Android's Bluetooth Support on BeagleBoard

Thứ Hai, 18 tháng 7, 2011 / 21:37

Android

Android is a software stack for mobile devices that includes an operating system, middleware and key applications.

Android and Bluetooth




Modificatation on android source to support Bluetooth

Add 'BOARD_HAVE_BLUETOOTH :=true'
in the file 'ANDROIDSOURCE/build/target/board/generic/BoardConfig.mk'


Android uses 3.36 Bluez Package

Android's Bluetooth stack uses BlueZ version 3.36 for GAP, SDP, and RFCOMM profiles, and is a SIG-qualified Bluetooth 2.0 host stack.
Bluez is GPL licensed, so the Android framework interacts with userspace bluez code through D-BUS IPC to avoid proprietary code.
Headset and Handsfree (v1.5) profiles are implemented in the Android framework and are both tightly coupled with the Phone App. These profiles are also SIG qualified.

BlueZ provides a rich set of command line tools for debugging and interacting with the Bluetooth sub-system, including:
hciconfig
hcitool
hcidump
sdptool
dbus-send
dbus-monitor

Using OBEX via bluetooth in Android

OBEX (abbreviation of OBject EXchange) is a communications protocol that facilitates the exchange of binary objects between devices
Openobex
The Openobex library provide free and open source impementation of Object Exchange protocol. OBEX is a session protocol and can be best described as a binary HTTP protocol .And the library can help you to transfer all kind of objects like files,pictures,calender entries vCal and business card vCard
obexpushd
It is used to receive files with Obex protocol.
obexftp
ObexFTP is a library bundling everything needed for OBEX transfers and exposing it via a simple interface. There is a sample command line client "obexftp" and a server "obexftpd" included. Besides FTP the ObexFTP library provides access to the PUSH, GOEP and SYNCH services.

Download "obexftp","obexpushd","openobex" packages at below given link...
"http://gitorious.org/android-obex"

Copy the extracted packages to path: 'ANDROIDSOURCE/external'

hciconfig
hciconfig is the equivalent of ifconfig for Bluetooth devices. This is the output of hciconfig on the board.

hci0:
Type: USB
BD Address: 00:E0:98:85:2C:70 ACL MTU: 192:8 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN
RX bytes:99 acl:0 sco:0 events:13 errors:0
TX bytes:296 acl:0 sco:0 commands:12 errors:0

If the device is down you can start it with
hciconfig hci0 up


Starting Receive
obexpushd -n -d &

When it launchs an OBEX data server in Android, it would broadcast “OBEX Object Push” service from SDP server. If you use other BT devices to search OBEX service, it can discover Android Dev phone. Once you make a paired connection, you can send files to Android Dev phone via bluetooth. It will automatically store files to sdcard.

Now it's time to discover your mobile phone's bluetooth hardware address. Run:

hcitool scan

Scanning ...
00:80:37:FE:5F:72 MobilePhone

Testing Ping through bluetooth devices can be acheived by.this is similar to the ping command we use in ethernet

l2ping 00:80:37:FE:5F:72

File Transfers can be acheived by

obexftpd -d android.jpg 00:80:37:FE:5F:72 // kumar check ..


Bluetooth Applications ?

Bluetooth FAQ
ttp://sites.google.com/a/android.com/opensource/projects/bluetooth-faq
Thứ Hai, 18 tháng 7, 2011 21:37 Đọc tiếp >>

Porting of Android On Beagle board

Porting of Android On Beagle board.

1.Overview
2.Hardware requirement.
3.Software requirement.
4.Beagle board.
5.Setup.
6.Building Kernel Image.
7.Building Android File system.
8.Building Linux file system with Android file system.
9.Setting Up The Boot Parameters and Booting the Linux kernel
10.Script file to start android services.
11.Flashing the NAND
12.Testing.





1.Overview

Android is a software stack for mobile devices that includes an operating system, middleware and key applications. To learn more about android check the below link http://developer.android.com/guide/basics/what-is-android.html. Android stack
uses Linux-2.6 kernel. Since this project is porting Android on Beagle board, the linux-2.6 kernel added a full support for Beagle board and its peripherals and android specific subsystems.

2.Hardware requirement

1. Beagle Board Rev-B6.
2. Null Modem Serial Cable.
3. S-video cable.
4. Mini-B to A USB cable.
5. SD/MMC card.
6. SD/MMC card Reader.
7. Monitor with S-video support.(Or TV tuner card with S-video support).

3.Software requirement

1. Linux kernel 2.6.22.18-TIomap3 (2.6_kernel_revb-v2.tar.gz -
Beagle board based).
2. Android Patch – Patching above kernel to get android specific supports.
3. Linux File System – ramdisk image (ALSA-FS).
4. Android file system. Extracted form emulator discussed below.
5. Arm Toolchain – cross compiler(arm-2007q3-51-arm-none-linux-
gnueabi-i686-pc-linux-gnu.tar.bz2).
6. Script file to start android services.



4.Beagle Board

BeagleBoard, a low cost OMAP3530 based board. POP (Package on Package) is a technique where the memory, NAND and SDRAM, are mounted on top of the OMAP3530. The different peripheral support the following


o Microprocessor unit (MPU) subsystem based on the ARM Cortex-A8™ processor.
o POP Memory interface
o 1Gb MDDR (128Mbytes)
o 2Gb NAND Flash (256 Mbytes)
o 24 Bit RGB Display interface (DSS)
o SD/MMC interface (The connector can supports 7 different types of card)
o USB OTG interface
o NTSC/PAL/S-Video output
o Power management
o Serial interface
o I2C interface
o I2S Audio interface (McBSP2)
o Expansion McBSP1
o JTAG debugging interface

More about Beagle board can get from http://beagleboard.org/ and http://elinux.org/BeagleBoard . Documents also available over this link. Source code for beagle board, booting procedure and compiling procedure can be found in http://code.google.com/p/beagleboard/

Boot Sequence:
Reset Button:
When pressed and released, causes a full power on reset of the BeagleBoard. It should be noted that currently, the reset will not work when the Linux kernel is running. To reset the board from the kernel operation, a power cycle is required.

User/Boot Button:
A button is provided on the BeagleBoard to provide two functions:
• Force a change in the boot sequence of the OMAP3530.
• Used as an application button that can be used by SW as needed.
When used in conjunction with the RESET button, it will force a change
to the order in which boot sources are checked as viable boot sources.
If the button is pressed while the RESET button is released, the sequence becomes:
o USB
o UART
o MMC1
o NAND
Even though the NAND may have a program in it, if a card is placed in the MMC slot, it will try to boot from it first. If it is not there, it will boot from NAND. There is also the option to have a serial download application that will program the NAND if connected to the serial or USB ports. In this scenario the internal ROM will stop on either the serial or USB port and start the download process from there. It does require an application to be run on the host PC in order to perform this function.
If the user button is not pressed at reset, the sequence in which the internal ROM looks for viable boot sources is as follows:
o NAND
o USB
o UART3
o MMC1
In this case, NAND overrides every option and will always boot from NAND if there is data in the NAND. If the NAND is empty, then the other sources are available to be used based on the boot order.

5.Setup

1. Make sure Beagle power is in OFF state by removing the 5V
supply and the USB host connection.
2. Connect the IDC UART cable the Beagle Board and using a Null-
Modem serial cable connect it to a UART port on a Linux
machine.
3. Have terminal program, such as Minicom running on the host
machine.
4. Configure the terminal program for (BAUD RATE - 115200, DATA- 8 bit,
PARITY- none, STOP - 1bit, FLOW CONTROL – none).
5. Insert the MMC/SD card (that is prepared as described above) into MMC/SD slot on Beagle Board.
6. Connect a TV (NTSC-M) to S-video port. Power ON TV.
7. Make three partitions over the SD card. One should be VFAT filesystem while
other two with EXT2 filesystem.
a) mmcblk0p1 – first partition – filesystem vfat – keep uImage
b) mmcblk0p2 – second partition – filesystem ext2 – keep linux with
android filesystem
c) mmcblk0p3 – third partition – filesystem ext2 – keep android
filesystem
6.Building Kernel Image

1. Configure Linux-2.6 kernel mentioned above with full beagleboard and
android support.

make ARCH=arm CROSS_COMPILE=$(Path of tool chain)/bin/arm-eabi- menuconfig

By default the kernel will have video output LCD. Change it to TV rather
than LCD. File to be change can be found in Linux-kernel/arch/arm/plot- omap-display.c

2. Compile kernel by fallowing command.
make ARCH=arm CROSS_COMPILE=$(Path of tool chain)/bin/arm-eabi- uImage

3. Copy uImage from Linux-kernel/arch/arch/boot folder to SD/MMC card with the following command to vfat partition,
mount /dev/sdxx /mnt.
cp arch/arm/boot/uImage /mnt.
umount /mnt





8. Building Android Filesystem

Extract the data.tar system.tar ramdisk.img with following commands. Which forms Android filesystem.

a) Download android SDK android-sdk-linux_x86-1.0_r1.zip and setup the path in
/root/.bash_profile

b) steps for extracting system and data from emulator...

source :................
http://wiki.kldp.org/wiki.php/AndroidPortingOnRealTarget
http://discuz-android.blogspot.com/2008/01/extract-google-android-file-system.html

c) step by step extracting system and data from emulator...
now get inside tools directory

1) mksdcard card 100M card.img // create an empty card image.
2) emulator -sdcard card.img // starting emulator.
Note: Download busybox binary for android.
3) adb -d 1 push busybox /system/bin/busybox // push busybox into emulator
4) adb shell
5) chmod +x /busybox
6) busybox tar -c /data.tar /data
7) busybox tar -c /system.tar /system
8) mount -o loop card.img mnt/
9) adb pull /data.tar . // extracting data
8) adb pull /system.tar . // extracting system

d) Get the ramdisk.img from SDK_PATH/tools/lib/images/ramdisk.img

steps for extracting ramdisk.img ..........

1) cp ramdisk.img ramdisk.gz
2) gunzip ramdisk.gz
3) cd target_fs
4) cpio -iv < ../ramdisk

e) Now Android file system is ready. Which means it should have

directories : system and data etc sys dev sbin
files : init init.rc


7.Building Linux filesystem with Android filesystem

Linux Filesystem used is rd-ext2-8M.bin (With Stream video support)
Source Link : http://code.google.com/p/beagleboard/downloads/list

a) gunzip -d < rd-ext2-8M.bin > ramdisk
b) mkdir linux-fs
c) mount -o loop ramdisk linux-fs/

d) cd linux-fs/
e) mkdir android – keep android file system extracted as per above, in this android directory.
f)copy linux file system with Android support to mmcblkp2 of sd card.
mount /dev/sdx2 /mnt
cp -av linux-fs/* /mnt/
umount /mnt

9)Setting Up The Boot Parameters and Booting the Linux kernel

In order to boot the Linux Kernel, kernel parameters need to be placed in Flash. This section describes the commands to boot the kernel up.

Steps for loading Kernel and File system images from SD card

a) mmcinit; // initialize mmc card.
b) fatload mmc 0:1 0x80300000 uImage // kernel image
c) fatload mmc 0:1 0x81600000 initrd.bin // file system ramdisk_image

Steps for loading Kernel and File System images serially

a) Boot the beagle board and type the following command at shell

command : loady ram_address Image.

b) Now open Minicom with 115200 baud Rate.
c) press ctrl A+Z , you will get menu in that select 'S' to send Image
and now select 'ymodem' protocol then press enter.
d) Now use space bar to select the intended file to send and press enter.
Which opens a dialog box showing file sending process sectors by sectors.

Prerequisites : MMC card should have 3 partitions.

a) First partition (EXT2) to have only android file system.
b) Second Partition (EXT2) to have Linux and android file system in a
separate directory.
c) This is of vfat type partition to have initrd.bin image and uImage files.

Steps for Android Booting in Beagle board :

a) Directly boot from Android Kernel into the android file system. i.e let the
android kernel directly start /init from android file system.

1. Setup the bootargs.
setenv bootargs console=ttyS2,115200n8,n8 noinitrd root=/dev/mmcblk0p1
rw rootfstype=ext2 init=/init nohz=off

2. Run these commands in Flash, type :
saveenv // to save
printenv // to display

3. Type the following command next: // if MMC card Present
mmcinit; // initialize mmc card.
fatload mmc 0:1 0x80300000 uImage; copy image to certain location.
4. bootm 0x80300000; // booting the kernel

b) Manually booting to android file system from normal linux file system.
Note:Disable autostart in /etc/init.rc for dbus-daemon, app_process and runtime.

1. Setup the bootargs.
setenv bootargs console=ttyS2,115200n8 noinitrd root=/dev/mmcblk0p2
rootfstype=ext2 rw rootdelay=1 init=/linuxrc nohz=off
2. Run these commands in Flash, type :
saveenv // to save
printenv // to display
3. Type the following command next: // if MMC card Present
mmcinit; // initialize mmc card.
fatload mmc 0:1 0x80300000 uImage; copy image to certain location.
4. bootm 0x80300000; // booting the kernel

Steps for Normal Bootup of Beagle board with Linux kernel and ramdisk image:

1. Setup the bootargs.
setenv bootargs console=ttyS2,115200n8 ro rootfstype=ext2 rootdelay=1
ramdisk_size=32768 init=/linuxrc root=/dev/console initrd=0x81600000,60M
nohz=off
2. Run these commands in Flash, type :
saveenv // to save
printenv // to display
3. Type the following command next: // if MMC card Present
mmcinit; // initialize mmc card.
fatload mmc 0:1 0x80300000 uImage;
fatload mmc 0:1 0x81600000 initrd.bin
4. bootm 0x80300000; // booting the kernel




10.Create a Script file to start android services(android_start.sh) using vi editor

#!/bin/sh
ln -s /android/system /system
ln -s /android/data /data

#copy all android etc file
cp /android/etc/* /etc -R

export PATH=/sbin:/system/sbin:/system/bin:$PATH
export LD_LIBRARY_PATH=/system/lib
export ANDROID_ROOT=/system
export ANDROID_ASSETS=/system/app
export ANDROID_DATA=/data
export EXTERNAL_STORAGE=/sdcard
export DRM_CONTENT=/data/drm/content

/bin/chmod -R a+rw /data /tmp
/bin/chmod -R a+rw /dev/binder

chroot /android /init

/system/bin/app_process -Xzygote /system/bin --zygote &
/system/bin/dbus-daemon --system &
runtime &




11.Flashing the Nand

Prerequisites:

1) MMC card to be formated with single partition as vfat.
2) Need device to host converter cable.
3) Need UART serial cable.
4) Need to download source files.
Note:
Source Link : http://code.google.com/p/beagleboard/wiki/BeagleSourceCode



Steps to perform Flashing from u-boot using SD/MMC card.

1) Make sure that all below mentioned files are ready.
x-load.bin.ift
MLO
u-boot.bin
kernel-image(uImage)
ramdisk.bin(file system)
2) copy the files into MMC card as with name given below in a order.
x-load.bin.ift for Nand as x-load.bin.ift
MLO as MLO
u-boot to flash onto Nand as flash-uboot.bin
u-boot.bin for MMC boot as u-boot.bin
ramdisk Image as rd-ext2.bin
Kernel(uImage) as uImage
3) Then insert the MMC card into slot and power up while pressing User button.
Commands to write into Nand Memory
mmcinit;
X-load
fatload mmc 0 0x80200000 x-load.bin.ift;
(fatload mmc partition:partition number ram_adress image)
nand unlock;
nand ecc hw;
nand erase 0 80000;
(nand erase offset size)
nand write 0x80200000 0 80000;
(nand write address offset size)
nand lock

Flash-u-boot
fatload mmc 0 0x80200000 flash-uboot.bin;
nand unlock;
nand ecc sw; nand erase 80000 0x1e0000;
nand write 0x80200000 80000 0x1e0000; nand lock;
Kernel
fatload mmc 0 0x80300000 uImage;nand unlock nand ecc hw nand erase 0x280000 0x500000 nand write 0x80300000 0x280000 0x1e0000 ( nand write address offset kernel_size )
nand lock
File_System
nand unlock
nand ecc hw
nand erase 0x780000 0xf88000
nand write 0x81600000 0x780000 0x400000
(nand write address offset File_System_size)
nand lock
4) Now reboot the board and press reset button.
Steps to perform Flashing from Serial cable.

1) Download beagle_recover.tar.bz2
Source Link: http://groups.google.com/group/beagleboard/files
2) Extract the contents. And setup the connection using serial cable and
Beagle board and power it up.
3) Get inside the beagle_recover directory and run
$./recover_beagle.sh ttyS0
4) Which flashes contents x-load.bin.ift and u-boot.bin into NAND memeory.


Table of Memory Partitioning :

Ram_address Nand Flash offset Size
Start End
X-Loader 0x80200000 0x000000 - 0x80000 0x0080000
U-boot 0x 80200000 0x080000 - 0x260000 0x01e0000
Boot Env-Nand 0x80200000 0x260000 - 0x00280000 0x0020000
Kernel offset 0x80300000 0x280000 - 0x00780000 0x0500000
File System Offset 0x81600000 0x780000 - 0x10000000 0x0f88000





12.Testing

TARGET:
1.Boot with kernel on beagle-board.

HOST:
1.Run the script file.
./android_start.sh


Thứ Hai, 18 tháng 7, 2011 04:17 Đọc tiếp >>

Extract google android file system image

Thứ Năm, 14 tháng 7, 2011 / 02:36


To run google android on the truely hardware, you may need the google android file system image.

Google android file system consists of two parts: system and data.
You can find the google android file system image on benno's website: Android filesystem images

You can also extract the google android file system by yourself from the android emulator by the following way:
1. download the google android sdk and extract onto your platform
2. start up the google android emulator
3. upload a busybox tool to the google android emulator, you can find a busybox binary on benno's website: busybox for android, you can also find the cross-compiler (select ARM GNU/Linux, and IA32 GNU/Linux) and create a busybox tool by yourself.
4. to upload files to the google android emulator, run the following command:
# adb push filename /target_folder/filename
the target_folder is the folder on the file system of google android emulator. e.g. /system/bin/
put the busybox to /system/bin, so you can see busybox tool in the extracted file system.
5. open a google android shell command window:
# adb shell
6. change the busybox mode to 555:
# chmod 555 /system/bin/busybox
7. create the tarball for /system and /data:
# busybox tar cvf /system.tar /system
# busybox tar cvf /data.tar /data
8. pull the tarball file from the google android emulator:
# adb pull system.tar /system.tar
# adb pull data.tar /data.tar

a note: when you want run google android on your truely hardware, the data.tar is not a must.
Thứ Năm, 14 tháng 7, 2011 02:36 Đọc tiếp >>

Customize google android system.img for emulator


The google android emulator included in the google android sdk is limited. Although you can use 'adb push' to upload more tools, but one has to do it again next time. Follow the steps to create a enhanced system.img:

1. system.img is yaffs2 flash file system, so firstly you need the mkfs.yaffs2 tool, download it in the following link: Release Android Yaffs2 Tool (Both X86 And ARM). One has to be a registered user to download the tools.
2. use the 'adb push' to upload tools to android emulator, executables in /system/bin/, libraries in /system/lib, one can also create folder. One need change the file mode necessary.
3. upload the ARM mkfs.yaffs2 tool, use the following command to create system.img: # mkfs.yaffs2 /system /system.img
4. download the system.img to local with command 'adb pull', replace the system.img in your emulator folder/tools/lib/images/
Thứ Năm, 14 tháng 7, 2011 02:35 Đọc tiếp >>

Step by step to create/modify ramdisk.img


Benno's blog has an article to change the ramdisk image, I tried it and give more details here.

ramdisk.img is included in the google android sdk, it exists in folder $SDK_ROOT/tools/lib/images/ramdisk.img. The ramdisk.img included in the google android sdk is a gzipped ramdisk.cpio file.

Here is the steps:

1. Upload the ramdisk.img to your linux machine
2. Change the ramdisk.img name to ramdisk.cpio.gz, and extract it by: # gzip -d ramdisk.cpio.gz
3. Create a temporary folder, say tmp, copy ramdisk.cpio to tmp folder
4. Extract the ramdisk.cpio in the tmp folder with command: # cpio -i -F ramdisk.cpio
5. Remove the ramdisk.cpio in the tmp folder, and make any changes you want to the extracted ramdisk.cpio in tmp folder
6. Recreate the ramdisk.cpio with command: # cpio -i -t -F ../ramdisk.cpio | cpio -o -H newc -O ../ramdisk_new.cpio

Some notes:

1. I change ramdisk.img to ramdisk.cpio.gz, and unzip it. It is because I find the -z parameter is not supported with my cpio. I tried the latest cpio (2.9), it doesn't work too.
2. Check cpio version by # cpio --version. I'm using cpio version 2.4.
3. Find the latest cpio (v 2.9) on site: gnu cpio
4. Notice that in step 6, the command includes two O's. First o is lower-case, second is up-case.
5. Notice in step 6, please remain ramdisk.cpio in up folder of tmp folder. The command need it there.
Thứ Năm, 14 tháng 7, 2011 02:35 Đọc tiếp >>

Can't execute native command on google android emulator

I created hello.c, compiled successfully with the cross compiler.
But I failed to run it on the target google android emulator. The error is: xxx: not found.
I checked the compiled file, it looks just fine. It really puzzled me.

At last, I got hints that it is because of there is no base libraries necessary on the google android emulator. For example, there is no /usr/lib directory, which should contain many .so files.

Simply re-create your native command with '-static' parameter, and try again.
Check your compiled file with the following command to ensure:
# file a.out
possible output looks like:
a.out: ELF 32-bit LSB executable, ARM, version 1 (SYSV), for GNU/Linux 2.6.14, statically linked, not stripped
Thứ Năm, 14 tháng 7, 2011 02:34 Đọc tiếp >>

Create google android strace tool

Prerequisite, you already have the cross compiler downloaded from download GNU toolchain site, make sure you select ARM GNU/Linux, and IA32 GNU/Linux.

1. Download the strace source distribution from SourceForge strace project
2. Extract the strace package on your linux machine
3. Set your cross compiler information with command: # export CC=your_cross_compiler_folder/bin/arm-none-linux-gnueabi-gcc
4. Add your_cross_compiler_folder/bin into your $PATH for path searching
5. Change your current folder to strace package extract folder, use command: # ./configure -host=arm-linux
6. You have the Makefile generated, edit it, append -static after CFLAGS variable in Makefile
7. Compile it with simple command: # make
8. You have the strace now, verify it with command: # file strace, you shall see "strace: ELF 32-bit LSB executable, ARM, version 1 (SYSV), for GNU/Linux 2.6.14, statically linked, not stripped"

Done, you have another powerful tool for your android
Thứ Năm, 14 tháng 7, 2011 02:33 Đọc tiếp >>

trying building shared library for google android

There is an article Shared library "Hello World!" for Android, describes how to create a simple shared library for google android, and shows how to link with the shared library to create a dynamic linked executable. The steps are correct, but it is not easy to create a shared library for google android with an existing linux distribution open source software.

Here is some findings when I tried to create a shared library for google android with a open source software:
1. pthread related functions are implemented in google android libc.so
2. no stderr, stdin, stdout definition are found in google android
3. some function mangling is different, such as strtod, strtol, isspace, and etc. Some can be fixed with some MACRO variable, such as __NO_INLINE__. Need to identify one by one, read the include head files in CROSS_COMPILE_FOLDER /arm-none-linux-gnueabi/libc/usr/include/
4. no mkstemp64, open64, and other xxx64 functions found

Following are the pthread found in google android /system/lib/libc.so:
42: 0000a41c 32 FUNC GLOBAL DEFAULT 7 pthread_cond_signal
61: 0000a26c 56 FUNC GLOBAL DEFAULT 7 pthread_mutexattr_gettype
64: 0000a510 32 FUNC GLOBAL DEFAULT 7 pthread_attr_destroy
69: 0000a144 16 FUNC GLOBAL DEFAULT 7 pthread_attr_getstacksize
71: 0000afa0 620 FUNC GLOBAL DEFAULT 7 pthread_create
75: 0000a3a8 28 FUNC GLOBAL DEFAULT 7 pthread_getspecific
86: 0000a050 72 FUNC GLOBAL DEFAULT 7 pthread_attr_init
92: 0000ad60 304 FUNC GLOBAL DEFAULT 7 pthread_exit
119: 0000a1b0 24 FUNC GLOBAL DEFAULT 7 pthread_attr_getstack
165: 0000a15c 24 FUNC GLOBAL DEFAULT 7 pthread_attr_getstackaddr
177: 0000a8c8 228 FUNC GLOBAL DEFAULT 7 pthread_key_delete
202: 0000a254 24 FUNC GLOBAL DEFAULT 7 pthread_mutexattr_destroy
208: 0000a22c 16 FUNC GLOBAL DEFAULT 7 pthread_equal
265: 0000a1ec 16 FUNC GLOBAL DEFAULT 7 pthread_attr_getguardsize
299: 0000aad8 188 FUNC GLOBAL DEFAULT 7 pthread_cond_timedwait_mo
340: 0000ac58 176 FUNC GLOBAL DEFAULT 7 pthread_detach
352: 0000a0f0 16 FUNC GLOBAL DEFAULT 7 pthread_attr_getschedpoli
368: 0000a154 8 FUNC GLOBAL DEFAULT 7 pthread_attr_setstackaddr
387: 0000a4b0 96 FUNC GLOBAL DEFAULT 7 pthread_getschedparam
441: 0000a43c 32 FUNC GLOBAL DEFAULT 7 pthread_cond_broadcast
459: 0000a45c 84 FUNC GLOBAL DEFAULT 7 pthread_setschedparam
471: 0000a9ac 176 FUNC GLOBAL DEFAULT 7 pthread_key_create
499: 0000a3cc 80 FUNC GLOBAL DEFAULT 7 pthread_kill
505: 0000aa5c 124 FUNC GLOBAL DEFAULT 7 pthread_cond_timeout_np
512: 0000a1fc 44 FUNC GLOBAL DEFAULT 7 pthread_getattr_np
514: 0000a120 36 FUNC GLOBAL DEFAULT 7 pthread_attr_setstacksize
546: 0000a3c4 8 FUNC GLOBAL DEFAULT 7 pthread_sigmask
559: 0000a35c 16 FUNC GLOBAL DEFAULT 7 pthread_cond_init
643: 0000a174 60 FUNC GLOBAL DEFAULT 7 pthread_attr_setstack
647: 0000a2a4 64 FUNC GLOBAL DEFAULT 7 pthread_mutexattr_settype
681: 0000a0d0 20 FUNC GLOBAL DEFAULT 7 pthread_attr_getdetachsta
694: 0000a690 180 FUNC GLOBAL DEFAULT 7 pthread_mutex_unlock
772: 0000a228 4 FUNC GLOBAL DEFAULT 7 pthread_self
778: 0000a23c 24 FUNC GLOBAL DEFAULT 7 pthread_mutexattr_init
788: 00009630 0 FUNC GLOBAL DEFAULT 7 __pthread_clone
818: 0000a344 24 FUNC GLOBAL DEFAULT 7 pthread_mutex_destroy
826: 0000a744 388 FUNC GLOBAL DEFAULT 7 pthread_mutex_lock
831: 0000ac50 8 FUNC GLOBAL DEFAULT 7 pthread_cond_wait
845: 0000a1c8 36 FUNC GLOBAL DEFAULT 7 pthread_attr_setguardsize
858: 0000a55c 308 FUNC GLOBAL DEFAULT 7 pthread_mutex_trylock
869: 0000a36c 24 FUNC GLOBAL DEFAULT 7 pthread_cond_destroy
874: 0000a0e4 12 FUNC GLOBAL DEFAULT 7 pthread_attr_setschedpoli
886: 0000a2e4 96 FUNC GLOBAL DEFAULT 7 pthread_mutex_init
920: 0000a100 16 FUNC GLOBAL DEFAULT 7 pthread_attr_setschedpara
936: 0000a098 56 FUNC GLOBAL DEFAULT 7 pthread_attr_setdetachsta
942: 0000ad08 88 FUNC GLOBAL DEFAULT 7 pthread_join
952: 0000ab94 188 FUNC GLOBAL DEFAULT 7 pthread_cond_timedwait
963: 0000a110 16 FUNC GLOBAL DEFAULT 7 pthread_attr_getschedpara
967: 0000a384 36 FUNC GLOBAL DEFAULT 7 pthread_setspecific
Thứ Năm, 14 tháng 7, 2011 02:32 Đọc tiếp >>

Using busybox for google android

Busybox is a very good tool. Here is some tips to make your android developing life easier:

1. busybox telnetd -l /sbin/sh, this is to start telnetd so you can telnet to the android
2. busybox ftpget/ftpput, this is a ftp tool to download/upload files to/from android
3. busybox telnet, telnet tool
4. busybox tftp, tftp tool
5. busybox wget, wget tool
6. more ...
Thứ Năm, 14 tháng 7, 2011 02:31 Đọc tiếp >>

UI/Application Exerciser Monkey

The Monkey is a program that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. You can use the Monkey to stress-test applications that you are developing, in a random yet repeatable manner.
Basic usage of monkey:

usage: monkey [-p ALLOWED_PACKAGE [-p ALLOWED_PACKAGE] ...]
[-c MAIN_CATEGORY [-c MAIN_CATEGORY] ...]
[--ignore-crashes] [--ignore-timeouts]
[--ignore-security-exceptions] [--monitor-native-crashes]
[--kill-process-after-error] [--hprof]
[--pct-touch PERCENT] [--pct-motion PERCENT]
[--pct-trackball PERCENT] [--pct-syskeys PERCENT]
[--pct-nav PERCENT] [--pct-majornav PERCENT]
[--pct-appswitch PERCENT] [--pct-anyevent PERCENT]
[--wait-dbg] [--dbg-no-events]
[-s SEED] [-v [-v] ...] [--throttle MILLISEC]
COUNT

Example: adb shell monkey 1000
#send 1000 events to all applications
Thứ Năm, 14 tháng 7, 2011 02:30 Đọc tiếp >>

Tools to monitor your android system memory and performance

Tools to monitor your android/linux system memory and performance:

* ps -x
* top
* cat /proc/meminfo
* dumpsys meminfo proc-id
* procrank
* DDMS (Android SDK tool)
* time command-line
* vmstat
Thứ Năm, 14 tháng 7, 2011 02:29 Đọc tiếp >>

patch the kernel image boot.img

Tools list:

1. split_bootimg.pl
2. mkbootimg
3. mkbootfs

boot.img contains the linux kernel and the ramdisk, while the default.prop in ramdisk can enable/disable the adb root permission. following is the default.prop contents for a droid product device:

* ro.secure=1
* ro.allow.mock.location=0
* ro.debuggable=0
* persist.service.adb.enable=0

droid product device with above default.prop has no adb root permissions if the device is not hacked. the default.prop with the following contents has the adb root permissions by default:

* ro.secure=0
* ro.allow.mock.location=0
* ro.debuggable=1
* persist.service.adb.enable=1

to create a boot.img with such default.prop, here is the steps:

1. split the boot.img: split_bootimg.pl boot.img, after running the command, two files are generated: boot.img-kernel and boot.img-ramdisk.gz.
2. create a temp folder (e.g. ramdisk), change to that folder, run the following command to extract the boot.img-ramdisk.gz: cat ../boot.img-ramdisk.gz | gzip -d | cpio -idm.
3. make the changes to the ramdisk file system in ramdisk folder, e.g. change the default.prop file to get adb root permissions.
4. return the parent folder, and run the following command to recreate the ramdisk package: mkbootfs ./ramdisk | gzip > ramdisk-new.gz
5. recreate the boot image: mkbootimg --kernel boot.img-kernel --ramdisk ramdisk-new.gz -o boot-new.img

done. flash the boot-new.img to the device with fastboot.
more things can be done with the above steps, such as change the boot up sequence by modify the init.rc.
Thứ Năm, 14 tháng 7, 2011 02:28 Đọc tiếp >>

unyaffs the android image

unyaffs is a tool to extract files from a yaffs file system image. It supports extract images created by mkyaffs2image. It is useful to patch the system.img and re-generate the system.img.
How to get it:

1. download a pre-build binary for linux: http://unyaffs.googlecode.com/files/unyaffs
2. download the source and compile with gcc -o unyaffs unyaffs.c:

* http://unyaffs.googlecode.com/files/unyaffs.c
* http://unyaffs.googlecode.com/files/unyaffs.h
Thứ Năm, 14 tháng 7, 2011 02:28 Đọc tiếp >>

Extract google android file system image

To run google android on the truely hardware, you may need the google android file system image.

Google android file system consists of two parts: system and data.
You can find the google android file system image on benno's website: Android filesystem images

You can also extract the google android file system by yourself from the android emulator by the following way:
1. download the google android sdk and extract onto your platform
2. start up the google android emulator
3. upload a busybox tool to the google android emulator, you can find a busybox binary on benno's website: busybox for android, you can also find the cross-compiler (select ARM GNU/Linux, and IA32 GNU/Linux) and create a busybox tool by yourself.
4. to upload files to the google android emulator, run the following command:
# adb push filename /target_folder/filename
the target_folder is the folder on the file system of google android emulator. e.g. /system/bin/
put the busybox to /system/bin, so you can see busybox tool in the extracted file system.
5. open a google android shell command window:
# adb shell
6. change the busybox mode to 555:
# chmod 555 /system/bin/busybox
7. create the tarball for /system and /data:
# busybox tar cvf /system.tar /system
# busybox tar cvf /data.tar /data
8. pull the tarball file from the google android emulator:
# adb pull system.tar /system.tar
# adb pull data.tar /data.tar

a note: when you want run google android on your truely hardware, the data.tar is not a must.
Thứ Năm, 14 tháng 7, 2011 02:26 Đọc tiếp >>

How to run Qemu emulator

Thứ Năm, 7 tháng 7, 2011 / 22:36

Adding Two Numbers:
.text
start: @ Label, not really required
mov r0, #5 @ Load register r0 with the value 5
mov r1, #4 @ Load register r1 with the value 4
add r2, r1, r0 @ Add r0 and r1 and store in r2

stop: b stop @ Infinite loop to stop execution


Building the Binary:


Save the program in a file say add.s. To assemble the file, invoke the GNU Toolchain’s assembler as, as shown in the following command.
$ arm-none-eabi-as -o add.o add.s

The -o option specifies the output filename.



To generate the executable file, invoke the GNU Toolchain’s linker ld, as shown in the following command.
$ arm-none-eabi-ld -Ttext=0x0 -o add.elf add.o

Here again, the -o option specifies the output filename. The -Ttext=0x0, specifies that addresses should be assigned to the labels, such that the instructions were starting from address 0x0. To view the address assignment for various labels, the nm command can be used as shown below.
$ arm-none-eabi-nm add.elf
... clip ...
00000000 t start
0000000c t stop

Note the address assignment for the labels start and stop. The address assigned for start is 0x0. Since it is the label of the first instruction. The label stop is after 3 instructions. Each instructions is 4 bytes. Hence stop is assigned an address 12 (0xC).

Linking with a different base address for the instructions will result in a different set of addresses being assigned to the labels.
$ arm-none-eabi-ld -Ttext=0x20000000 -o add.elf add.o
$ arm-none-eabi-nm add.elf
... clip ...
20000000 t start
2000000c t stop

The output file created by ld is in a format called ELF. Various file formats are available for storing executable code. The ELF format works fine when you have an OS around, but since we are going to run the program on bare metal, we will have to convert it to a simpler file format called the binary format.

A file in binary format contains consecutive bytes from a specific memory address. No other additional information is stored in the file. This is convenient for Flash programming tools, since all that has to be done when programming is to copy each byte in the file, to consecutive address starting from a specified base address in memory.

The GNU toolchain’s objcopy command can be used to convert between different object file formats. A common usage of the command is given below.
objcopy -O


To convert add.elf to binary format the following command can be used.
$ arm-none-eabi-objcopy -O binary add.elf add.bin

Check the size of the file. The file will be exactly 16 bytes. Since there are 4 instructions and each instruction occupies 4 bytes.


Executing in Qemu

When the ARM processor is reset, it starts executing from address 0x0. On the connex board a 16MB Flash is located at address 0x0. The instructions present in the beginning of the Flash will be executed.

When qemu emulates the connex board, a file has to be specified which will be treated file as Flash memory. The Flash file format is very simple. To get the byte from address X in the Flash, qemu reads the byte from offset X in the file. In fact, this is the same as the binary file format.

To test the program, on the emulated Gumstix connex board, we first create a 16MB file representing the Flash. We use the dd command to copy 16MB of zeroes from /dev/zero to the file flash.bin. The data is copied in 4K blocks.
$ dd if=/dev/zero of=flash.bin bs=4096 count=4096

add.bin file is then copied into the beginning of the Flash, using the following command.
$ dd if=add.bin of=flash.bin bs=4096 conv=notrunc

This is the equivalent of programming the bin file on to the Flash memory.

After reset, the processor will start executing from address 0x0, and the instructions from the program will get executed. The command to invoke qemu is given below.
$ qemu-system-arm -M connex -pflash flash.bin -nographic -serial /dev/null

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

The system executes the instructions and after completion, keeps looping infinitely in the stop: b stop instruction. To view the contents of the registers, the monitor interface of qemu can be used. The monitor interface is a command line interface, through which the emulated system can be controlled and the status of the system can be viewed. When qemu is started with the above mentioned command, the monitor interface is provided in the standard I/O of qemu.

To view the contents of the registers the info registers monitor command can be used.
(qemu) info registers
R00=00000005 R01=00000004 R02=00000009 R03=00000000
R04=00000000 R05=00000000 R06=00000000 R07=00000000
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00000000 R13=00000000 R14=00000000 R15=0000000c
PSR=400001d3 -Z-- A svc32

Note the value in register R02. The register contains the result of the addition and should match with the expected value of 9.


Thứ Năm, 7 tháng 7, 2011 22:36 Đọc tiếp >>

Download HP Laptop Driver for Making your Laptop Work Smartly

Thứ Ba, 5 tháng 7, 2011 / 00:19

Your entire day revolves round your HP laptop. It is your work mate from 9 to 5 while you are at work and then it becomes your most important friend entertaining you in all possible ways all through the evening after 5 O’clock. Any idea what is the most essential thing behind the wonderful working of your laptop devices? Well, it is the HP laptop driver to which you hardly pay any attention.

So the wonderful graphics that you get to enjoy while playing your favorite video games or while watching some cool movie with lots of great cinematography, the enthralling sound effects during those games and the thrillers and the melodious other worldly feeling that you get from your favorite music track, all this is possible because of the HP laptop driver that makes better display and sound possible for you.

But if the driver shows some complication you will find your Bluetooth showing connectivity issues or you may find your webcam showing errors, or some other issues bothering you, which will make it quite miserable for you to work on your laptop.

Drivers are the main working forces behind all your devices. Without them the devices are almost dead and even if they are alive they work as weirdly as some zombie that is half dead and half alive! This happens because the way a device has to work; the way it has to take on all the commands is told to them only by the drivers.

Hence, when they stop responding, your devices stop working the way they work otherwise. But why do they stop responding? This may happen if you carelessly delete them away. This may again happen when the company upgrades its driver and you do not update it from time to time and thus it becomes outdated over the time and stops working. Again, there are chances that it gets corrupt over the time perhaps because of some virus or malware or some other interfering software.

Now if your Laptop Driver has gone outdated, you’ll simply have to update it from the HP’s official site but if it has developed some trouble, you’ll be required to delete it away and go for a fresh download. And if it is missing from your laptop, it is sure that you have mistakenly deleted it and in this case also, you’ll have to go for a fresh download.

So you just need to go to internet and land on the HP’s official site or some other trustworthy third party site where you can download HP laptop driver and have the download done and have your laptop work well.
Thứ Ba, 5 tháng 7, 2011 00:19 Đọc tiếp >>