在尝试使用TouchGFX的时候会遇到很多坑。尤其是你使用TouchGX Designer并采用官方模板生成的工程。你需要添加很多头文件和源文件到工程中。- <touchgfx_application_root_directory>/gui/include& A) k, I; a" P' d) g! k; G4 f
- <touchgfx_application_root_directory>/generated/gui_generated/include
# S9 X1 p/ C9 F* |6 ~ - <touchgfx_application_root_directory>/platform/os
$ I' U' L% n: } - <touchgfx_application_root_directory>/generated/fonts/include, a9 C# L$ I2 p2 F
- <touchgfx_application_root_directory>/generated/images/include; ~1 j8 j: c, ?9 p/ E
- <touchgfx_application_root_directory>/generated/texts/include# m/ i: F0 r$ h
- <touchgfx_application_root_directory>/touchgfx/framework/include
复制代码 但是即便你尝试这样做之后,还会提示下面的错误:: S- v9 v) c% S# ~0 \
Error: L6218E: Undefined symbol __aeabi_assert (referred from TouchGFXHAL.o)* Z0 M5 S1 l2 m$ @$ w+ F
在开头还会提示你MicroLib和C++同时使用的警告。
' N0 m+ N; V7 X1 \. l在参考这篇文档(http://www.keil.com/support/docs/4073.htm)之后你可以看到解决方案。
P# Y5 @: ?3 o就是把MicroLib给勾掉。! a$ L3 e9 B* h2 _3 m8 ^
3 t0 c5 T5 l1 Z) Y4 G5 I! {2 b
引申:, X! n3 t; J& I, C7 c& `6 P# t# W
那为什么会这样?
! u* ?0 l' ]: p' |! y+ p可以参考这篇文档的介绍:http://www.keil.com/support/man/docs/ARMLIB/armlib_chr1358938938431.htm
4 z* J0 y1 u. P& C3 x( T5 W基本上告知了MicroLib以下几个特点:, y) O$ o8 V) { a/ a
- 1、Microlib is not compliant with the ISO C library standard 不兼容标准ISO C库
8 M3 e6 _2 ]; p, q' @ - 2、Microlib is not compliant with the IEEE 754 standard for binary floating-point arithmetic 不兼容IEEE 754标准浮点运算
& i' w5 B6 X+ p5 \! Z5 p' |+ p6 ~( E/ f - 3、Microlib is highly optimized for small code size高优化,小尺寸
, T1 A+ E9 M4 e4 f/ V$ | - 4、Locales are not configurable 只有一个Locale,不可配置
2 E6 b1 l0 V U7 O - 5、main() must not be declared to take arguments and must not return. Main函数不带参,不返回
* j& ~+ V N W0 k2 N( |- }" U P" `4 A - 6、Microlib provides limited support for C99 functions。对C99支持不完善1 m! Q9 P! m9 r, H( l4 [- ^3 K
- 7、Microlib does not support C++ 不支持C++
7 W/ ?" |# g. I/ k9 L2 o- y - 8、Microlib does not support operating system functions不支持操作系统函数4 l$ X' y% q8 r/ t3 {! j
- 9、Microlib does not support position-independent code 不支持地址无关代码(http://zh.wikipedia.org/wiki/%E5%9C%B0%E5%9D%80%E6%97%A0%E5%85%B3%E4%BB%A3%E7%A0%81)
& ^3 w& R( _8 G - 10、Microlib does not provide mutex locks to guard against code that is not thread safe不能通过mutex lock确保代码安全5 L! q4 w4 }* G! M
- 11、Microlib does not support wide characters or multibyte strings不支持宽字符和多字节字符串9 A' G6 h0 E2 Z9 W0 @8 ]
- ...太多了,不翻译了
复制代码 - m' S; P4 q4 F+ `
其中第7条就告知了不支持c++。4 t X+ c- @5 |/ A5 M, U
8 b1 a( J9 m0 g) [, z
8 G4 @& L4 y# B: ~7 d! i8 @: I1 s
. ~9 v1 _# r5 L
4 l! K" @5 W) H, `$ F5 p |