| 1 |
Sample project to test CppUTest for Keil MDK-ARM toolchain and LPC1768 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) or FlashMagic |
| 9 |
|
| 10 |
4. serial connection to UART0 or UART1 interface |
| 11 |
|
| 12 |
5. 12 or 24 MHz quartz. If else, need to be adjusted in |
| 13 |
$(CPPUTEST_HOME)/platforms_startup/armcc/LPC1768/system_LPC17xx.c |
| 14 |
(for _clock_init() function working correctly and to set up 100 MHz core |
| 15 |
clock). |
| 16 |
Please check system_LPC17xx.c for correct quartz selection in function |
| 17 |
SystemInit(), and rebuild startup library for any change. |
| 18 |
Default is 12 MHz quartz. |
| 19 |
|
| 20 |
6. eclipse + gdb server from JLink + arm-none-eabi-gdb from GNU ARM Tools Embedded |
| 21 |
For debug only. |
| 22 |
|
| 23 |
First, you need to compile CppUTest and target startup library: |
| 24 |
make -C ../../../platforms/armcc CPU=Cortex-M3 all |
| 25 |
make -C ../../../platforms_startup/armcc/LPC1768 all |
| 26 |
|
| 27 |
Second, you need to write tests. As example, I use |
| 28 |
$(CPPUTEST_HOME)/examples/AllTests/CircularBufferTest.cpp. |
| 29 |
|
| 30 |
Third, you need to make executable: |
| 31 |
make all |
| 32 |
|
| 33 |
Fourth, you need to program executable on target chip: |
| 34 |
make prog |
| 35 |
|
| 36 |
Project use semihosting, so you may use standard printf() or std::cout << "Hello!" |
| 37 |
|
| 38 |
If problems with heap or low memory, adjust heap size in |
| 39 |
$(CPPUTEST_HOME)/platforms_startup/armcc/LPC1768/startup_LPC17xx.asm |
| 40 |
and rebuild startup library. |