how_to_use_xcode2_as_ide_on_a_mac
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
how_to_use_xcode2_as_ide_on_a_mac [2006/07/13 19:25] – audiocommander | how_to_use_xcode2_as_ide_on_a_mac [2011/07/22 14:51] (current) – removed spam digineural | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Installing GPUTILS & SDCC ===== | + | ====== |
While you probably need a PC to burn the MBHP-Loader into the PIC, you can stick to your beloved Macintosh while coding your C-Applications! | While you probably need a PC to burn the MBHP-Loader into the PIC, you can stick to your beloved Macintosh while coding your C-Applications! | ||
And more than that: you are able to use Apple' | And more than that: you are able to use Apple' | ||
- | Wer're starting with SDCC-Installation, then we'll setup a new Xcode2 project: | + | First, go and install [[installing gputils and sdcc on osx|GPUUTILS and SDCC]] on your mac if not already done! |
- | The first step in this process is to install SDCC. If you have already SDCC running and calling "sdcc -v" in terminal gives you the info you're running 2.5. or higher, you have the most complicated step already completed! | + | If you have already SDCC running and calling "sdcc -v" in terminal gives you the info you're running 2.5. or higher, you have the most complicated step already completed! |
- | ==== How to install a library from the terminal ==== | ||
- | If you've never installed *nix libs or codes, don't worry: | ||
- | Either you can fetch a binary (that' | ||
- | The " | + | \\ |
+ | Now, let's go on to real cool stuff and switch to Xcode. | ||
- | Open the Terminal and type " | + | I presume, you have **[[http:// |
- | Now you have to type three commands: | ||
- | * ./config | ||
- | * make | ||
- | * make install | ||
- | sometimes you have to call these with " | ||
- | If you have problems compiling and installing SDCC, you might lack a library. | + | \\ |
- | Here is what you should have installed (in this particularly order) | + | ====== About Targets and Makefiles ====== |
- | ==== 1. GPUTILS ==== | + | Okay, if you' |
- | [[http:// | + | |
- | ==== 2. SDCC ==== | + | 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 " |
- | The SDCC sourcecode is available here: http://sdcc.sourceforge.net/index.php# | + | * (SDCC) Preprocess the sources (=> main.c & otherfiles.c) |
+ | * (SDCC) Compile the sources (=> output/ | ||
+ | * (SDCC) Assemble to objects (=> output/*.o) | ||
+ | * (GAPSM | ||
+ | * (hex2syx.pl) Convert to SysEx (=> *.syx) | ||
- | If you have trouble compiling | + | 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: |
- | Now, is that cool? 8-) | + | * (GCC) Preprocess the sources (=> main.c & otherfiles.c) |
+ | * (GCC) Compile the sources (=> build/myApp.build/*.asm) | ||
+ | * (GCC) Assemble to objects (=> build/ | ||
+ | * Link objects to binary executeable (=> build/ | ||
- | A test in the terminal with "sdcc -v" should | + | 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 ;) |
- | <code bash> | + | |
- | mymac:~ user$ sdcc -v | + | |
- | SDCC : mcs51/gbz80/z80/ | + | |
- | </ | + | |
- | If you get instead a return " | + | But targets aren't only useful |
- | <code bash> | + | |
- | mymac:~ user$ echo $PATH | + | |
- | </ | + | |
- | now you should something like this: "/ | + | As you can see, the Makefile invokes several installed applications, |
- | copy this line (the output from your terminal window, not the one above). now type & paste: | + | This is what we will need to do: |
- | <code bash> | + | * Create a new project |
- | mymac:~ user$ PATH=:< | + | * Set up a new target: Makefile |
- | </ | + | * Set up a new target: Application.syx |
+ | * Set up a new target: Application_debug (optional if [[ACSim]] is used) | ||
- | ==== 3. If there are errors ==== | ||
- | You might need additional libraries. | ||
- | Go and load [[http:// | ||
- | Then open FinkCommander and install these libraries: | ||
- | -> gettext-0.14.5, | ||
- | And don't blame me or anyone else if this breaks up something. It's your own responsibility! | ||
- | If you have trouble installing SDCC on your mac, post your questions/ | + | \\ |
- | ===== Let's open Xcode2 ===== | + | ====== Creating a new project |
- | + | ||
- | That was pretty easy, wasn't it? | + | |
- | + | ||
- | Now, let's go on to real cool stuff and switch to Xcode. | + | |
- | + | ||
- | I presume, you have downloaded the MIOS-C-Skeleton, | + | |
- | + | ||
- | + | ||
- | ==== Creating a new project ==== | + | |
Create a new, empty project from the File-Menu. Select your MIOS-application folder. | Create a new, empty project from the File-Menu. Select your MIOS-application folder. | ||
Line 80: | Line 59: | ||
Edit the file " | Edit the file " | ||
- | ==== Setting up the make target ==== | + | \\ |
+ | |||
+ | ====== Setting up the make target | ||
Because things change a lot, we're making it easy: we set up a " | Because things change a lot, we're making it easy: we set up a " | ||
Line 99: | Line 80: | ||
PATH=/ | PATH=/ | ||
+ | cd " | ||
+ | ./ | ||
+ | echo Makefile replaced. | ||
- | cd $SRCROOT/ | + | exit 0 |
- | ./mkmk.pl $SRCROOT/MAKEFILE.SPEC | + | </code> |
- | rm Makefile.bat | + | for Xcode 3 you need to strip the quotes: |
- | echo Makefile.bat deleted \(blame Windows®\). | + | <code bash> |
- | mv -f Makefile | + | # shell script goes here |
+ | |||
+ | PATH=/ | ||
+ | cd $SRCROOT/ | ||
+ | ./mkmk.pl " | ||
echo Makefile replaced. | echo Makefile replaced. | ||
- | echo Success. | ||
exit 0 | exit 0 | ||
+ | </ | ||
+ | |||
+ | If you get an error like "line x: ./mkmk.pl: Permission denied", | ||
+ | < | ||
+ | chmod 750 <drag mkmk.pl in terminal window, path should appear) | ||
</ | </ | ||
Line 120: | Line 112: | ||
If you want to, you can now add " | If you want to, you can now add " | ||
- | ==== Setting up the primary application target ==== | + | \\ |
+ | |||
+ | ====== Setting up the primary application target | ||
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 130: | Line 124: | ||
PATH=/ | PATH=/ | ||
- | cd $SRCROOT | + | cd "$SRCROOT" |
make | make | ||
exit 0 | exit 0 | ||
</ | </ | ||
+ | |||
+ | 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 142: | Line 138: | ||
Easy, isn't it? | Easy, isn't it? | ||
- | ===== Debugging with Xcode ===== | ||
- | go to the [[mios_c_simulator_-_debugger]] page and grab the debug sources. Note, that these are far from being complete. If you add functions in your own project, please update the files here in the wiki! | + | \\ |
+ | |||
+ | ====== Debugging with Xcode ====== | ||
+ | |||
+ | go to the [[mios_c_simulator_-_debugger|ACSim]] page and grab the debug sources. Note, that these are far from being complete. If you add functions in your own project, please update the files here in the wiki! | ||
Add the debug-files to your Xcode project, and adapt what needs to be adapted (defines, includes etc...). | Add the debug-files to your Xcode project, and adapt what needs to be adapted (defines, includes etc...). | ||
Line 152: | Line 151: | ||
Now you have to add the Carbon Framework (Right Mouse on the Folder " | Now you have to add the Carbon Framework (Right Mouse on the Folder " | ||
- | At this point you just have to make sure, that "debug.c" | + | At this point you just have to make sure, that "ACSim_console.c", " |
**Important: | **Important: | ||
Line 158: | Line 157: | ||
If you have questions, feel free to post them here: http:// | If you have questions, feel free to post them here: http:// | ||
+ | |||
+ |
how_to_use_xcode2_as_ide_on_a_mac.1152818734.txt.gz · Last modified: 2006/10/15 09:35 (external edit)