
  *(.rodata.str1.4)
  __ctor_start__ = .;
  KEEP (*crtbegin.o(.ctors))
  KEEP (*crtbegin?.o(.ctors))
  KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
  KEEP (*(SORT(.ctors.*)))
  KEEP (*(.ctors))
  __ctor_end__ = .;
  KEEP (*crtbegin.o(.dtors))
  KEEP (*crtbegin?.o(.dtors))
  KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
  KEEP (*(SORT(.dtors.*)))
  KEEP (*(.dtors))
      __dtor_end__ = .;
  . = ALIGN(0x4) ;
  __erodata = .;找到system.c 文件,在该文件中添加如下 函数接口,目的为了初始化 C++ 构造函数构造空间
extern int __dtor_end__;
extern int __ctor_end__;
extern int __ctor_start__;
typedef void (*func_ptr)(void);
__attribute__((weak)) void cxx_system_init(void)
{
    func_ptr *p;
    for (p = (func_ptr *)&__ctor_end__ -1; p >= (func_ptr *)&__ctor_start__; p--)
    {
        (*p)();
    }
}
以上步骤都做好后,理论上就可以尽情的使用C++ 进行编写了,但是官方SDK 并没有做C++ 的支持,因此在包含官方驱动头文件的时候,需要你手动加上 C++ 的判断。
#ifdef __cplusplus
extern "C" {
#endif
/* 头文件中原本内容*/
#ifdef __cplusplus
}
#endif
