Utopia

Tuesday, July 28, 2009

我们老了,无所谓了

昨天看网上一消息说一老者用呼死你软件呼死2000广告电话 http://news.wenxuecity.com/messages/200907/news-gb2312-893613.html。 这使我想起另一旧闻,一老者用砖头砸不良司机的车。勇者无畏,老者亦无畏。

Friday, April 06, 2007

eCOS

At Feb. 2007 I started to try eCOS for one of my job. I got all kinds of problem and found a lot of answer from Internet. One word, Internet is great.

  • On win32 (using Cygwin) build toolchain is really frustrated.
  1. insight-5.3 does not exist. So use ver 6.5 instead. And the patch still applicable to this version.
  2. cygwin should use unix style but not DOS as the instruction said else get error when make 'binutils'. It might get link error during make 'binutils' because it can not intepret ... `cat ofiles` so cpu-arm.c not linked
  3. clean the tmp build folder before configure. Don't build from src
  4. It took more than 6 hours to build GCC and finally give a "internal error: segmentation fault". I searched inet and saw another guy got the same problem but no answer how it could be fixed.
  5. So I turned to use new version binutils(2.17)/GCC(4.1)/newlib(1.15). There is no patch needed for binutils. Patch for GCC must manually to be put in, include the big-endian patch. A knowing issue for the newlib as described here: http://sourceware.org/ml/newlib/2006/msg00472.html
    What I did is: change line 282 of newlib/Makefile.in to:
    "CFLAGS_FOR_TARGET=$(strip $(CFLAGS_FOR_TARGET))" \
    After that newlib still raise make problem: no rule for all
  6. So I back to use newlib 1.11 with a litte more handy works: fix two compiler error for "switch{... default:}" (label at end error). And the build take about 15 hours. The big endian patch is copied here(t-arm-elf).
  7. Once the build successed the ecos configtools setting needs some change: build path: C:\cygwin\gnutools; replace "-mno-short-load-words" that deprecated aliases for `-mno-alignment-traps' (http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01187.html, -mno-alignment-traps is no needed for ARM V4 and newer, and it is not support since GCC4); remove "-finit-priority" that not supported in GCC 4.1.1(it is forced enabled internally. Refer to http://sources.redhat.com/ml/ecos-devel/2003-10/msg00061.html). Optionally remove 'fvtable-gc' as it is not supported after GCC 3.3.6.
  8. Build under linux is fine by follow the ecos instruction and with the original source
  9. multi-ice-server-gdb must build on win32/cygwin because it need talk to win32 ARM multi-ice-server application. There also error while make.
  • there are two config tools: 1.3.net(or 1.3.1) and ecos2.0.
  1. The ecos2.0 is new using (wxGTK/wxMSW) and under new license but lack memory layout feature. The ver1.3 has memory layout feature but only works with win32/MFC. And some hack is needed.
  2. Ver1.3 is under RHEPL. Use CVS to get it as: cvs -z3 -d :pserver:anoncvs@ecos.sourceware.org:/cvs/ecos co -r last-rhepl -P ecos ref to: http://ecos.sourceware.org/ecos/anoncvs.html
  3. Some hack needed to build it. Refer to follow two: http://sourceware.org/ml/ecos-discuss/2001-05/msg00260.html http://dsl.ee.unsw.edu.au/dsl-cdrom///unsw/projects/ecos/ecos/host/libcdl/cdl.dsp The 2nd link is an instance with the fix.
  4. carefully when using CVS: cygwin must be in DOS style else VC won't accept the dsw and dsp files. So for the cdl.dsp file from above link, it need to be merged with the one provided by ecos.
  5. cygwin make_3.8.1 will report "*** multiple target patterns". Need roll back to 3.8.0 (just extract the make.exe is good enough)
  6. Another TCL need to be installed but not cygwin/tcl. Else need add c:\cygwin\bin to VC exec path and set TCLHOME=c:\cygwin\bin in system env and modify the cdl.dsp to add with_tcl_header as it is different from with_tcl. The relative path should be ../include. But with this hack it will looking for types.h from cygwin. That will report a lot of syntex errors. With TCL8.4 though I can build TCL from source but build ecos tools will generate some other errors. So we'd better keep with a old version like TCL8.2. This time fortunately there is a install package ready as ver8.2.3. Now only need less works: a) change cdl.dsp a little: cygtsh80=>tsh (still using cygwin tsh). b) set TCLHOME=>x\tcl (not bin) c) add exec path=c:\cygwin\bin to VC IDE.
  7. more need attention is the CVS might miss some file to sync. Need repeat CVS to make sure get all files needed.
  8. built ecosconfig is a little easy. Just need to add tcl include and lib to VC IDE.
  9. for configuretool since I can not find ecos.hhp anywhere just delete the custom build part. Also as mentioned in above link platform SDK is needed for the . After installed WinXP_SP2 Platform SDK and set include in VC IDE there still problem for DWORD_PTR. Just move the define out of "#if _MSC_VER <>
  10. Now it turn out to be VC6 does not work with later Platform SDK. As others mentioned the latest PSDK works with VC6++ is released in Feb, 2003. Here is a link for download the SDK: http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm Now it can compiled. The hack of still needed but no need to link bufferoverflowU.lib.
  • Load GCC ELF with ARM AXD
  1. ARM AXD does not understand debug info in GCC ELF. Though AXD AXF and GCC elf are both ELF Dwarf II. Here is reference link: http://www.epitools.com/support/jeeni_other.php#differences http://www.arm.com/pdfs/DUI0064D_ADS1_2_GettingStarted.pdf As 2-16 of above 2nd link it mentioned: "AXD can now load and, with limitations, debug ELF/DWARF images built with the GNU toolchain. The following restrictions apply to using AXD with gcc 2.95.2 and binutils 2.10: ..."
  2. use elfdump to compare the diff
  3. Use arm-elf-objcopy -S to strip out symbol and relocation info then it could be loaded by AXD
  4. Or use arm-elf-objcopy -g to strip out debug symbol. This is much more better.
  5. After removed GDB_STUB the AXD can directly load the test: basic ELF file. But still can not load other tests.
  6. @Mar7. As http://gcc.gnu.org/ml/gcc-prs/2002-06/msg00327.html described if both .debug_info and .debug_line then AXD has no problem to load the elf. To remove, execute this: arm-elf-objcopy -R .debug_info -R .debug_line elf_in_file elf_out_file. Quote from http://sources.redhat.com/ml/crossgcc/2003-07/msg00094.html: If you see a section called .stab then the format is stabs. If you see a section called .debug then the format is dwarf1. If you see a section called .debug_line then the format is dwarf2. If -o2 is change to -o0 for minimal build some of tests could be recognized by AXD. Some AXD return an error: DBT Warning 00056: Debug table format error at offset 0x2ac in area .debug_info
  7. use command: readelf --debug-dump intr can dump all detail from intr.
  8. DIE: stand for Debug-Info-Entry, CU: stand for Compilation-Unit
  • Build/run ecos with UBUNTO or other that has GCC version 4.0 and above
  1. There would be error when build cross GCC: "gcc-3.2.3/gcc/read-rtl.c:662: error: invalid lvalue in increment".Current version Cygwin is using GCC 3.4.4 and it is ok
  2. Run configtool needs libgtk-1.2-s0.0 and libgdk-1.2-so.0. Can not use libg?k-x11-2.0 else might get error or can not find symbol.
  • Good news is seems OpenOCD is working with Wiggler. Need a little change of configure file: such as bigendian, reset etc. Link and toolchain instruction is here: http://www.yagarto.de/source/index.html
It include patch for GCC 4.1.1 and Insight 6.5.50 and build scripts.

  • @March 5: Now there are two issue blocks the work to continue
1) Can not use Axd to load and debug. -O0 not always help. The solution could be: a) Try ARM's solution to remove $a. But I still want the debug symbol else there is no sense; b) write an ELF utility to remove or convert ARM unwant info. It's hard c) trace Axd error. Also time consuming d) Use multi-ice-gdb-server or openOcd. Might need put in gdb-stub. Not sure gdb 'remote load' command work or not. For using multi-ice-gdb-server might use Axd to loadimage(filtered out debug info by arm-elf-objcopy) and use gdb load the original elf file from host. e) Updated multi-ice to 2.2.6. Need to verify once get hardware platform. f)alternatively use Axd load the test by strip out debug and utilize the diagnost print to debug. g) Build ecos as lib without debug symbol and build test by ARM tools with debug enable
2) Undefined function. This could be a porting task. Need more reading of ecos documents.