
  *(.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

