| 1 |
Sample project to test CppUTest for Keil MDK-ARM toolchain and AT91SAM7A3 chip. |
| 2 |
|
| 3 |
Requirements: |
| 4 |
1. CYGWIN (rm.exe, mkdir.exe, make.exe) |
| 5 |
|
| 6 |
2. Keil MDK-ARM |
| 7 |
|
| 8 |
3. JLink Flash (for programming chip) |
| 9 |
|
| 10 |
4. serial connection to DBGU interface |
| 11 |
|
| 12 |
5. 4 MHz quartz. If else, need to be adjusted in |
| 13 |
$(CPPUTEST_HOME)/platforms_startup/armcc/AT91SAM7A3/SAM7A3.asm |
| 14 |
(for setup PLL and change core clock from IRC to PLL) |
| 15 |
and |
| 16 |
$(CPPUTEST_HOME)/platforms_startup/armcc/AT91SAM7A3/Retarget.c |
| 17 |
(for _clock_init() function working correctly) |
| 18 |
|
| 19 |
6. eclipse + gdb server from JLink + arm-none-eabi-gdb from GNU ARM Tools Embedded |
| 20 |
For debug only. |
| 21 |
|
| 22 |
First, you need to compile CppUTest and target startup library: |
| 23 |
make -C ../../../platforms/armcc |
| 24 |
make -C ../../../platforms_startup/armcc/AT91SAM7A3 |
| 25 |
|
| 26 |
Second, you need to write tests. As example, I use |
| 27 |
$(CPPUTEST_HOME)/examples/AllTests/CircularBufferTest.cpp. |
| 28 |
All test from $(CPPUTEST_HOME)/examples/AllTests/ needs to many |
| 29 |
RAM (chip does not have such). |
| 30 |
|
| 31 |
Third, you need to make executable: |
| 32 |
make all |
| 33 |
|
| 34 |
Fourth, you need to program executable on target chip: |
| 35 |
make prog |
| 36 |
|
| 37 |
Project use semihosting, so you may use standard printf() or std::cout << "Hello!" |
| 38 |
|
| 39 |
If problems with heap or low memory, adjust heap size in |
| 40 |
$(CPPUTEST_HOME)/platforms_startup/armcc/AT91SAM7A3/SAM7A3.asm |
| 41 |
and rebuild startup library. |
| 42 |
|
| 43 |
Startup library uses standard Keil MDK-ARM license. |
| 44 |
|
| 45 |
Eclipse project is tested in eclipse Kepler, eclipse Luna. |
| 46 |
You need to adjust some environment variables in "C/C++ Build" tab in |
| 47 |
properties window for project. |
| 48 |
"CPPUTEST_HOME" is a path to root of CppUTest |
| 49 |
"KEIL_DIR" is a path to ARM C/C++ compiler |
| 50 |
"PATH" there is need to add path to make.exe |
| 51 |
Eclipse project use plugin "GDB Hardware Debugger" to debug, so for debug |
| 52 |
you may install "GDB Hardware Debugger" and gdb client (from |
| 53 |
GNU ARM Tools Embedded) or create your own debug configuration |
| 54 |
(for exampe, use eclipse plugin from Keil MDK-ARM installation; no need to |
| 55 |
install other plugins and toolchains). |