Wednesday, November 20, 2013

[debian] Install sogou pinyin on wheezy

This post is written on Nov 20, 2013.

Sogou pinyin can not be installed on default wheezy, since it depends on fcitx-bin (>=4.2.6). Only 4.2.4 is provided in the default apt source on wheezy. However the version on wheezy-backports is 4.2.8, so it's possible to use the fcitx-bin for sogou pinyin.

Here're the steps:
1. Get the latest release of sogou deb file from the following url:
http://packages.linuxdeepin.com/deepin/pool/non-free/f/fcitx-sogoupinyin-release/
2. Add following line in your sources.list


deb http://YOURMIRROR.debian.org/debian wheezy-backports main


3. Run "aptitude update"
4. Install fcitx-bin from backports:
 
aptitude -t wheezy-backports install fcitx-bin

5. Install the deb file of sogou pinyin, simply right click on the deb file and choose "Open with Software Installer"
6. On finished, restart X to activate it.
7. Right click on the fcitx icon at the right-bottom, choose "configure".
8. Add "Sogou Pinyin" to "Input Method", close the dialog windows.

And it's done. Have fun.

Reference:
1. http://backports.debian.org/Instructions/
2. http://backports.debian.org/Instructions/#index3h2

Thursday, August 15, 2013

[DS5] c源文件访问scatter file中定义的变量

问题如下:

Scatter file内容部分:

#define MY_REGION_START 0x100
#define MY_REGION_END 0x200

现在需要在工程的c源文件中访问MY_REGION_START和MY_REGION_END.

方法如下
1. Scatter file修改为:
#define MY_REGION_START 0x100
#define MY_REGION_END 0x200

....
#定义一个新的段名字为 MY_REGION
  MY_REGION MY_REGION_START
  {
        * (MY_REGION_START)
  }

  MY_REGION MY_REGION_END
 
        * (MY_REGION_END)
  }

2. 在需要访问的c源文件头上定义extern变量如下:

extern unsigned int Image$$MY_REGION$$ZI$$Base;  // 对应MY_REGION_START
extern unsigned int Image$$MY_REGION$$ZI$$Limit:  // 对应MY_REGION_END

或者
extern char Image$$MY_REGION$$ZI$$Base[];
extern char Image$$MY_REGION$$ZI$$Limit[];
两者区别:
如果声明的symbol是int型, 那在访问的时候需要用&(取址符).
例如:
printf("start: 0x%X, end 0x%X\n", (unsigned int) &Image$$MY_REGION$$ZI$$Base,Image$$MY_REGION$$ZI$$Limit);


参考文档:
1. Image$$ execution region symbols
2. Importing linker-defined symbols in C and C++

Wednesday, August 07, 2013

[IAR] Use Gvim as External Editor of IAR

Type: Command Line
Editor: browse to your gvim
Arguments: 
      --remote-tab-silent $FILE_PATH$
Or 
      --remote-silent $FILE_PATH$

     # if you have MiniBufExplorer installed for vim.

Thursday, May 17, 2012

LVM随手记



当初安装maverick的时候就选择了lvm, 目的就是为了今后有可能的分区大小调整. 今天就遇到了. android这样的大家伙最好还是能在服务器上搞, 不然一个2.3和一个ics直接吃掉40G(是编译之后的大小). 分区大小吃紧, lvm派上用场了.

当初分区的时候特意给lvm多分了一些空间, 安排好了opt, var, home, usr, 和srv之后还剩下些50G左右的未使用空间. 当时也不知道哪个分区或许分小了.

调整分区大小步骤:
1. 查看pv信息, 年纪大了记性很差, 刚刚发生的事情都可能会忘, 反正我是不记得当初vg的name是什么了
# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda4
  VG Name               vg
  PV Size               205.57 GiB / not usable 3.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              52624
  Free PE               2256
  Allocated PE          50368
  PV UUID               WcBMwo-Vcel-ZSAO-Aeil-iCdG-NTIe-glNUPX
2. 确定需要调整的lv, 就是直接去看一下/dev/VGNAME/ 下面那个设备是需要调整大小的.
# ls /dev/vg/

3. 调整分区(其实叫逻辑卷更加确切一些,lv嘛)大小

# lvextend -L+50G /dev/vg/home

  Extending logical volume home to 106.56 GiB
  Logical volume home successfully resized

4. 调整的文件系统, 我的是reiserfs, online和offline都可以直接调正,很方便.
online:

# resize_reiserfs -f /dev/vg/home

resize_reiserfs 3.6.21 (2009 www.namesys.com)
resize_reiserfs: On-line resizing finished successfully.

参考链接:
http://tldp.org/HOWTO/LVM-HOWTO/index.html


Wednesday, October 19, 2011