2010년 9월 30일 목요일

ADC2USB diagram


created by google's docs

2010년 9월 26일 일요일

Working note to replace booting logo of android

At init.c under system/core/init

* remove text logo

#if BOOTLOGO
if( logo_565rle_image(INIT_IMAGE_FILE) ) {
#endif
+#if 0
fd = open("/dev/tty0", O_WRONLY);
if (fd >= 0) {
#if 1 /* 0xlab flavor */
#include "text_0xlab.h"
#else
const char *msg;
msg = "\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n" // consol is 40 cols x 30 lines
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
" ANDROID ";
#endif
write(fd, msg, strlen(msg));
close(fd);
}
+#endif

* create new boot logo image with "rle" extension; means run length encoding
create new "bmp" image file with 24bits true color
convert "bmp" file using "rgb2565" under "out/host/linux-x86/bin"; #./rgb2565 -rle < "bmp" > initlogo.rle
replace initlogo.rle under "vender/0xlab/devkit8000/initlogo.rle"

Useful commands or tools in linux system

1. goto 'n' line in vi command mode; 'n' G
2. using grep , find text 'string' recursively under 'directory'; grep -r 'string' 'directory'
3. find file named "wannabe" under "directory"; find "directory" -name "wannabe" -print

2010년 9월 20일 월요일

internal flash write (stm32f103)

#define FLASH_PAGE_SIZE ((uint16_t)0x400)
//#define BANK1_WRITE_START_ADDR ((uint32_t)0x08008000)
//#define BANK1_WRITE_END_ADDR ((uint32_t)0x0800C000)

// Middle density
// Page 127 (0x0801FC00 ~ 0x0801FFFF : 1kbyte)
#define PAGE_START_ADDR ((uint32_t)0x0801FC00)
#define PAGE_END_ADDR ((uint32_t)0x08020000)

#if 0
// High density
// Page 127 (0x0803F800 ~ 0x0802FFFF : 2kbyte)
#define PAGE_START_ADDR ((uint32_t)0x0803F800)
#define PAGE_END_ADDR ((uint32_t)0x08030000)
#endif

void save_env(void)
{
   uint32_t Address = 0x00;
   uint32_t Data = 0x3210ABCD;
   volatile FLASH_Status FLASHStatus = FLASH_COMPLETE;

   /* Porgram FLASH Bank1 ********************************************************/
   /* Unlock the Flash Bank1 Program Erase controller */
   FLASH_UnlockBank1();

   /* Clear All pending flags */
   FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR);

   /* Erase the FLASH pages */
   FLASHStatus = FLASH_ErasePage(PAGE_START_ADDR);
   if (FLASHStatus != FLASH_COMPLETE) return;

   /* Program Flash Bank1 */
   Address = PAGE_START_ADDR;
   while ((Address < PAGE_END_ADDR) && (FLASHStatus == FLASH_COMPLETE)) {
      FLASHStatus = FLASH_ProgramWord(Address, Data);
      Address = Address + 4;
   }

   FLASH_LockBank1();
}

template of assembly function for cortex M3 (thumb2)

/*;*******************************************************************************
;* Function Name : void c_func(void *out, void *in, uint16_t n)
;* Description : linkable function with C language
;* Input : - R0 = out:
;* - R1 = in:
;* - R2 = n:
;* Output : None
;* Return : None
;********************************************************************************/

.cpu cortex-m3
.fpu softvfp
.syntax unified
.thumb
.text

.global c_func

;* #define N 64

.equ N, 64

.thumb_func
c_func:

STMFD SP!, {R4-R11, LR}
;* operation
LDRSR rx, [ry, #+0]
SUBS rx, ry, #+1 /* decrement */
MUL rz, rx, ry
MLA r4, r5, r4, r6
;* end of operation
LDMFD SP!, {R4-R11, PC}
BX LR /* return */
.end

2010년 9월 13일 월요일