User Tools

Site Tools


how_to_use_xcode2_as_ide_on_a_mac

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
how_to_use_xcode2_as_ide_on_a_mac [2007/01/31 01:09]
audiocommander
how_to_use_xcode2_as_ide_on_a_mac [2011/07/22 14:51] (current)
digineural removed spam
Line 13: Line 13:
 Now, let's go on to real cool stuff and switch to Xcode. Now, let's go on to real cool stuff and switch to Xcode.
  
-I presume, you have downloaded the MIOS-C-Skeleton,​ unpacked it in an appropriate folder and you're ready to start coding your own cheezy ​MIOS-App.+I presume, you have **[[http://​www.ucapps.de/​mios_download.html|downloaded the MIOS-C-Skeleton]]**, unpacked it in an appropriate folder and you're ready to start coding your own nifty MIOS-App.
  
  
 \\ \\
 +
 +====== About Targets and Makefiles ======
 +
 +Okay, if you're a pro, you can skip this, else some words for the basic understanding.
 +
 +To generate the myapplication.syx file that we can upload to the Core, a process of different steps has to be processed. This process is normally handled by a script called "​Makefile":​
 +  * (SDCC) Preprocess the sources (=> main.c & otherfiles.c) ​
 +  * (SDCC) Compile the sources (=> output/​*.asm)
 +  * (SDCC) Assemble to objects (=> output/*.o)
 +  * (GAPSM / GPLINK) Link objects to executeable (=> *.hex)
 +  * (hex2syx.pl) Convert to SysEx (=> *.syx)
 +
 +If you're using the [[ACSim]], you need a different script; now the GCC compiler is used instead of SDCC because the executeable should run on the Macintosh and not on the box, so the process above would look like this:
 +  * (GCC) Preprocess the sources (=> main.c & otherfiles.c)
 +  * (GCC) Compile the sources (=> build/​myApp.build/​*.asm)
 +  * (GCC) Assemble to objects (=> build/​myApp.build/​*.o)
 +  * Link objects to binary executeable (=> build/​Debug/​*.bin)
 +
 +Okay, now you could either sit down and write your own Makefile (uuhh, that's for the real nerds only), or you do it the easy way by calling some scripts! In Xcode (and any other IDE) you can compile/​assemble/​link as many executeables out of your sources as you like, by setting up different targets for each application. So once you've set up a target it can easily be selected by a drop-down menu. Don't forget to choose the right target before compiling your sources ;)
 +
 +But targets aren't only useful to generate executeables,​ they can also be used to generate the Makefile!
 +
 +As you can see, the Makefile invokes several installed applications,​ which makes the file not cross-platform compliant. So before we can compile the real application,​ we need to generate our own Makefile, which can be easily done by adapting the included MAKEFILE.SPEC and setting up an extra target.
 +
 +This is what we will need to do:
 +  * Create a new project
 +  * Set up a new target: Makefile (run once and whenever you add more object sources to the MAKEFILE.SPEC)
 +  * Set up a new target: Application.syx
 +  * Set up a new target: Application_debug (optional if [[ACSim]] is used)
 +
 +
 +
 +\\
 +
 ====== Creating a new project ====== ====== Creating a new project ======
  
Line 46: Line 80:
  
 PATH=/​usr/​local/​bin:​$PATH PATH=/​usr/​local/​bin:​$PATH
 +cd "​$SRCROOT"​
 +./​tools/​mkmk.pl "​$SRCROOT/​MAKEFILE.SPEC"​
 +echo Makefile replaced.
  
-cd $SRCROOT/​tools +exit 0 
-./mkmk.pl $SRCROOT/MAKEFILE.SPEC+</code>
  
 +for Xcode 3 you need to strip the quotes:
 +<code bash>
 +# shell script goes here
 +
 +PATH=/​usr/​local/​bin:​$PATH
 +cd $SRCROOT/​tools
 +./mkmk.pl "​$SRCROOT/​MAKEFILE.SPEC"​
 echo Makefile replaced. echo Makefile replaced.
-echo Success. 
  
 exit 0 exit 0
 +</​code>​
 +
 +If you get an error like "line x: ./mkmk.pl: Permission denied",​ you need to give the perl script execute rights. Easiest way to do this is open your favorite FTP program and set "​Executeable"​ or use the Terminal:
 +<​code>​
 +chmod 750 <drag mkmk.pl in terminal window, path should appear)
 </​code>​ </​code>​
  
Line 69: Line 117:
  
 Now this is basically the same as before. Now this is basically the same as before.
-Repeat the steps above, but call your target like your application. The bash script would look like this in the "Run Script":​+Repeat the steps above, but name your target like your application. The bash script would look like this in the "Run Script":​
  
 <code bash> <code bash>
Line 76: Line 124:
 PATH=/​usr/​local/​bin:​$PATH PATH=/​usr/​local/​bin:​$PATH
  
-cd $SRCROOT+cd "$SRCROOT"
 make make
  
 exit 0 exit 0
 </​code>​ </​code>​
 +
 +For XCode 3.0 (under Leopard) do not forget to remove the quotes around the $SRCROOT (the variable points to your project directory).
  
 As you see, the only trick is, to invoke the makefile. As you see, the only trick is, to invoke the makefile.
Line 107: Line 157:
  
 If you have questions, feel free to post them here: http://​www.midibox.org/​forum/​index.php?​topic=6527.0 If you have questions, feel free to post them here: http://​www.midibox.org/​forum/​index.php?​topic=6527.0
 +
 +
how_to_use_xcode2_as_ide_on_a_mac.1170205746.txt.gz · Last modified: 2007/09/08 22:18 (external edit)