| 1 |
Welcome |
|---|
| 2 |
======= |
|---|
| 3 |
|
|---|
| 4 |
To build the cc3 system, you need GNU Make and a version of GCC. The |
|---|
| 5 |
system is split into 2 main parts, "hal" and "projects". |
|---|
| 6 |
|
|---|
| 7 |
Inside the hal directory are more directories, one each for a |
|---|
| 8 |
particular kind of hardware. |
|---|
| 9 |
|
|---|
| 10 |
Currently, there is only one hal, "lpc2106-cmucam3". |
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
Compiler |
|---|
| 14 |
======== |
|---|
| 15 |
|
|---|
| 16 |
The compiler choice is left up to the hal. This allows different hardware |
|---|
| 17 |
platforms to use different compilers. |
|---|
| 18 |
|
|---|
| 19 |
The normal CMUcam3 hal is "lpc2106-cmucam3", which uses a |
|---|
| 20 |
version of GCC optimized for the ARM processor. To build using this |
|---|
| 21 |
hal, you'll need the arm-none-eabi-* style GCC tools from |
|---|
| 22 |
CodeSourcery. These can be acquired here: |
|---|
| 23 |
|
|---|
| 24 |
http://www.codesourcery.com/gnu_toolchains/arm/download.html |
|---|
| 25 |
|
|---|
| 26 |
Get the "EABI" or "Bare Metal" target. |
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
If you feel like using a different compiler, simply change the |
|---|
| 30 |
variables in hal/lpc2106-cmucam3/defs.mk to something else. A popular |
|---|
| 31 |
thing to change is COMPILER_PREFIX, in case you have a custom compiler |
|---|
| 32 |
built under a different name. |
|---|
| 33 |
|
|---|
| 34 |
If you would like to try to use the "virtual-cam" hal, which allows for |
|---|
| 35 |
prototyping on your PC either add "hal=virtual-cam" at the top of /include/common.mk or type "make hal=virtual-cam" whenever you build (including in the project directories). |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
Building |
|---|
| 39 |
======== |
|---|
| 40 |
|
|---|
| 41 |
Once you have the compiler, you need to build the system. From the top |
|---|
| 42 |
level, invoking make will build all the hal libraries, and will build |
|---|
| 43 |
a subset of items in the "projects" directory. |
|---|
| 44 |
|
|---|
| 45 |
Make sure you've built a hal before trying to build any projects! |
|---|
| 46 |
|
|---|
| 47 |
Changing SUBDIRS in projects/Makefile will change which projects are |
|---|
| 48 |
built. Changing SUBDIRS in hal/Makefile will change which hals are |
|---|
| 49 |
built. |
|---|
| 50 |
|
|---|
| 51 |
Invoking make directly from a particular project or hal directory will |
|---|
| 52 |
build that directory, regardless of SUBDIRS. |
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
Projects |
|---|
| 56 |
======== |
|---|
| 57 |
|
|---|
| 58 |
There are a few projects in the projects directory to get you started. |
|---|
| 59 |
The "hello_world" project should be a nice introduction to LEDs, MMC access, |
|---|
| 60 |
servos, camera use, and serial communication. |
|---|
| 61 |
|
|---|
| 62 |
If you want to create a project, duplicate the hello_world directory, |
|---|
| 63 |
change the PROJECT variable in Makefile, and start editing code! |
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
Makefiles in Projects |
|---|
| 67 |
===================== |
|---|
| 68 |
|
|---|
| 69 |
When using the cc3 build system, you'll be using a Makefile in your |
|---|
| 70 |
project directory. See projects/hello_world/Makefile for a description |
|---|
| 71 |
of how to use the file for your own projects. |
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
Hal vs. Projects |
|---|
| 75 |
================ |
|---|
| 76 |
|
|---|
| 77 |
Generally, you will not need to make any changes to anything in hal, unless |
|---|
| 78 |
you modify or create new hardware, or if the hal you are using is missing |
|---|
| 79 |
some important functionality. |
|---|
| 80 |
|
|---|
| 81 |
Make sure you've built a hal before trying to build any projects! If you |
|---|
| 82 |
are inside the projects directory, make does not know how to go up |
|---|
| 83 |
and build the hals. Otherwise, you will get an error like this: |
|---|
| 84 |
|
|---|
| 85 |
No rule to make target `../../hal/lpc2106-cmucam3/libhal-lpc2106-cmucam3.a' |
|---|
| 86 |
|
|---|
| 87 |
If this happens, go into the hal directory and run make. |
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
Environment |
|---|
| 91 |
=========== |
|---|
| 92 |
|
|---|
| 93 |
The cc3 system is build upon a standard C99 environment. For the |
|---|
| 94 |
lpc2106-cmucam3 hal, we use Newlib. Information about Newlib is here: |
|---|
| 95 |
|
|---|
| 96 |
http://sources.redhat.com/newlib/ |
|---|
| 97 |
|
|---|
| 98 |
Newlib provides all the features a C programmer expects: malloc, free, |
|---|
| 99 |
printf, scanf, open, close, read, write, and friends. |
|---|