Category Archives: AVR / Embedded

iPhone non official SDK aka ToolChain finally setup

iPhone non official SDK aka ToolChain finally setup

Woo.. after doing the process almost ten times, downloading the fullxodetools.dmg(~924mb) i finally have the iPhone toolchain working.. ihave setup the non official iPhone SDK ,, untill the official by Applecomes out in Feb'08 .
Start developing native iPhone apps today, no more web 2.0…
There are many guides out there, i am just telling my expierience, hope it works for you..
It uses the GC++, GCC compiler in linux..
I used Fedore 7 on VMware(virtual machine, you can grab both of them for free) to build the toolchain. I recomd.linux for good performance..
Content from –http://code.google.com/p/iphone-dev/wiki/Building,with my tips inBOLD.

HOWTO build the toolchain
Run terminal…

  • Ensure that you have a copy ofbisonandflexinstalled on your system. All major systems should have these tools installed or available in package management systems.Most linux flavours have the packages, you can skip this..
  • $ bison--version
    GNU
    Bisonversion1.28
    $ flex
    --version
    flex version
    2.5.4
  • Check out a copy of LLVMSVN, and build areleasebuild (as opposed to a debug one). Currently, due toIssue 70, we are limited to revision 42498.it will take some time while files are being downloaded to your PC from internet, probably no errors here
  • $ svn co http://llvm.org/svn/llvm-project/llvm/trunkllvm-svn -r 42498
    $ pushd llvm
    -svn
    $ .
    /configure --enable-optimized
    $ make ENABLE_OPTIMIZED=1
    $ sudo make install
    $ LLVMOBJDIR=`pwd`
    $ popd
  • Check out a copy of the iphone-dev SVN repository.(it will take large amount of time, the longest step of all)
  • $ svn checkout http://iphone-dev.googlecode.com/svn/trunk/iphone-dev
    $ pushd iphone
    -dev
  • Make a directory to hold the toolchain.
  • $ sudo mkdir/usr/local/arm-apple-darwin
  • Build odcctools. (you will get some error if you are using CYGWIN on windows here, refer to there site for details)
  • $ mkdir-p build/odcctools
    $ pushd build
    /odcctools
    $
    ../../odcctools/configure--target=arm-apple-darwin--disable-ld64
    $ make
    $ sudo make install
    $ popd
  • Geta copy of the iPhone root filesystem. This is usually obtained bydecrypting and extracting the iPhone restore software usingthese tools, but there are many other methods to obtain this, including simply usingscpto download all the files from the iPhone over Wi-Fi. (Scroll below for a download link of ready to use iPhone 1.0.2 image) Unpack the root filesystem somewhere, and set the environment variable$HEAVENLYto its path. (set this again if you restart system or terminal)
  • $ HEAVENLY=/usr/local/share/iphone-filesystem
  • Install the iPhone headers to the appropriate place. If you aren't on Mac OS X, replace the/Developer/SDKs/MacOSX10.4u.sdkpath with the full path to the unpacked Mac OS X 10.4 Universal SDK(ie.MacOSX10.4u.sdk). If you don't have a copy of this,scroll below..
  • $ pushd include
    $
    ./configure --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk
    $ sudo bash install
    -headers.sh
    $ popd
  • Install csu, which includescrt1.o,dylib1.o, andbundle1.o.Don't rebuild them from source, as this requires a working cross-GCC,which you don't have yet (and the build-from-source process for csu isbroken right now anyway). Binaries are provided for this reason.
  • $ mkdir-p build/csu
    $ pushd build
    /csu
    $
    ../../csu/configure--host=arm-apple-darwin
    $ sudo make install
    $ popd
  • Onlyif you are compiling onleopard10.5. This is an ugly workaround and compiling with the resulting toolchain will give you a warning.
  • $ mv llvm-gcc-4.0-iphone/configure llvm-gcc-4.0-iphone/configure.old
    $ sed
    's/^FLAGS_FOR_TARGET=$/FLAGS_FOR_TARGET=${FLAGS_FOR_TARGET-}/g'\
    llvm
    -gcc-4.0-iphone/configure.old>llvm-gcc-4.0-iphone/configure
    $
    exportFLAGS_FOR_TARGET="-mmacosx-version-min=10.1"
    $ sudo ln
    -s/usr/local/arm-apple-darwin/lib/crt1.o\
    /usr/local/arm-apple-darwin/lib/crt1.10.5.o
  • Configure and make LLVM-GCC. Make sure that$LLVMOBJDIRand$HEAVENLYare set per the instructions above.(igot the errors like error 1, error 2 more than 5 times, i solved thisproblem by changing lots of files,symlinks in /usr/lib folder of iphoneimage hence i have uploaded my modified working iphone image. see belowfor errors).
  • $ mkdir-p build/llvm-gcc-4.0-iphone
    $ pushd build
    /llvm-gcc-4.0-iphone
    $
    ../../llvm-gcc-4.0-iphone/configure--enable-llvm=`llvm-config --obj-root`\
    --enable-languages=c,c++,objc,obj-c++--target=arm-apple-darwin--enable-sjlj-exceptions\
    --with-heavenly=$HEAVENLY--with-as=/usr/local/bin/arm-apple-darwin-as\
    --with-ld=/usr/local/bin/arm-apple-darwin-ld
    $ make LLVM_VERSION_INFO
    =2.0-svn-iphone-dev-0.3-svn
    $ sudo make install
    $ popd
    $ popd

You're done. Have fun!

Gotchas

  • Makesure that there are no spaces in any of the directory names that youuse. GCC does not build if there are spaces in the directory names, andthe shell scripts will not work. This is most often a problem onWindows.
  • Make sure that/usr/local/binis in yourPATH.This is not the case out of the box on Mac OS X, although chances areif you've installed things from source before you've added it already.
  • If LLVM failed to compile because of missingbisonand/orflex(evidence that this was the case is a failed compile onutils/TableGen/FileLexer.l), you mustmake cleananddeleteutils/TableGen/FileParser.hbefore trying again withbisonandflexinstalled. LLVM'smake cleanscript does not always properly clean up after a failed build.
  • Make sure that$HEAVENLYpoints to a copy of the full iPhone root filesystem, not just theunpacked update DMG. If you get errors about being unable to find-lc, then your$HEAVENLYis set incorrectly, you mistyped the--with-heavenlyoption toconfigure, or your copy of the root partition is incomplete. Your copy of the iPhone root filesystemmustinclude ausr/lib/libc.dylibfile.

HOWTO obtain the Mac OS X headers on Linux or Windows

=Install thecpioutility using your distribution's standard package management system.All the major Linux distributions, as well as Cygwin, should have thisutility.
=No needtodownload the whole xcode tools dmg (~924mb). I extracted thepackage,uploaded it for you :), download the needed file from here-http://rapidshare.com/files/66764258/MacOSX10.4u.sdk.rar
=Extract RAR, then thepaxarchive by creating a new dir and using the following command in terminal

gunzip-c MacOSX10.4u.sdk.pax.gz|cpio-i

=FindMacOSX10.4u.sdkfolder in extracted contents and link it toolchain install procedure.

LOGIN as root to avoid weird errors, password prompts again and again..

–The envirnoment variables should be set properly to check there use this command in terminal- echo $VARIABLENAME, eg. –echo $HEAVENLYif it returns blank line set it again. the envirno. variable has aliftime till the terminal runs, if you close it, you have to set itagain

— errors i got ,when i do"make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn" its runs for a long time and then results in this error */usr/local/bin/arm-apple-darwin-ld:/home/Aakash/iphone/iphone-image/usr/lib/libc.dylib truncated ormalformed object (mach header extends past the end of the file)collect2: ld returned 1 exit status make2 [libgcc_s.dylib] Error 1make2 Leaving directory`/root/iphone-dev/build/llvm-gcc-4.0-iphone/gcc' make1 [stmp-multilib]Error 2 make1: Leaving directory`/root/iphone-dev/build/llvm-gcc-4.0-iphone/gcc' make: [all-gcc] Error 2*
i did this to get off the error"openall .dylib files (<=1 k) one by one in folder/iphone-image/usr/lib/, rename it – and for example libc.dylib showspath to libSystem and libSystem – path to libSystem.B.dylib. Just copylibSystem.B.dylib twice and rename 2 new files to libc.dylib andlibSystem.dylib. do this for all <=1kb .dylib files".
The iPhone image i uploaded here contains these changes, no need to do again.


Passwordfor all my rapidshare uploadsif neededin this post isaksblog.co.nr

Usefull links-

Post toolchain install–

Need any help, post as comment…

AVR 입문,

사용자 삽입 이미지

사용자 삽입 이미지


 

 

  후후 이제 시작이다!

이쪽은 돈이 조금(?) 많이 드는걸 빼고는 다 좋은데 ,,

돈이 문제다 ,,

 

저 위에 키트 새거로 사면 20만원이다

이런 이유때문에 포기하고있었는데

옥션에서 중고로 5만원에 팔길래 바로 질렀다 (그분 강림)

처음에는 아무거도 모르겠던데

지금도 모르겟다(조금은 알겠더라)

 

베타키트 상세스펙(지금은 단종되고 베타키트 ver2로 조금 바껴서 나온다)

 

① AT89S52와 ATmega8515는 기존의 ISP를 이용해서 다른
  장비 없이 사용자가 직접 내부 플래쉬 메모리에 프로그램을
  입력할수 있습니다.(롬 라이터 불필요)
② LED와 캐릭터 LCD ,Buzzer(피에조), 딥스위치, FND (SND3360)를
  직접제어해 볼 수 있고,외부 인터럽트 INT0, INT1 스위치로
  인터럽트 제어를 할 수 있습니다.
③ 26핀의 확장핀이 제공되기에 나중에 사용자가 직접 확장보드를
  만들어서 추가시킬 수도 있고, 마시테크에서 추가로 제공되는
  확장보드를 구매해서 또 다른 기능을 쉽게 추가시킬 수 있습니다.
④ 시리얼 포트를 통해서 시리얼 통신이 가능합니다.

 

① Size : 115 X 120 (mm)
② CPU : AT89S52, ATMEGA8515(AVR)
③ Clock : 22.1184 MHz (8051 용),16 MHz (AVR 용)
④ 스위치 & 키 : DIP 스위치 (4 sw), Reset Key, int Key x 2
⑤ 출력 장치 : 캐릭터 LCD 연결 가능, SND 3360, LED(green-3mm X 8),
   PIEZO(부저)
⑥ 시리얼 통신 : RS232 통신 케이블 사용
  (통신 속도 – 38400 bps : 기본 설정)
⑦ ISP 기능 : 자체 제작한 ISP 프로그램으로 AT89S52 및 ATMEGA8515
  라이트 가능

 

 

이게 뭐냐면

 

그냥 아주 구린 컴퓨터라 보면 되겠다

(컴퓨터다 CPU 잇고 메모리 있고 있을건 다있다)

 

어디쓰냐고?

 

글쎄 ,,