[cc1352,cc26xx] add C++ constructor calls (#5907)

* add C++ constructor calls
* add c++ init array to the cc2650 linker script
This commit is contained in:
Seth Rickard
2020-12-03 09:32:32 -08:00
committed by GitHub
parent 49ae4feba3
commit 3981d15fdc
4 changed files with 37 additions and 7 deletions
+9 -7
View File
@@ -18,16 +18,18 @@ BSD-3-Clause
This version of cc26xxware is copied from the [SimpleLink CC26x2 Software
Development Kit](http://www.ti.com/tool/simplelink-cc13x2-26x2-sdk). Modifications
were made to the software package to support the GCC Automake pedantic build.
were made to enable the OpenThread build.
Also see: release_notes_driverlib_cc13xx_cc26xx.html
| file | change |
|-------------------------------------------------------|------------------------------------------------------------------------------|
| `device/cc26x0/driverlib/bin/gcc/driverlib.a` | Renamed from `driverlib.lib` to allow Automake to recognize the library |
| `device/cc13x52_cc26x2/driverlib/bin/gcc/driverlib.a` | Renamed from `driverlib.lib` to allow Automake to recognize the library |
| `device/cc26x0/linker_files/cc26x0f128.lds` | `end` symbol added for GCC stdlib |
| `device/cc13x52_cc26x2/linker_files/cc26x2r1f.lds` | `end` symbol added for GCC stdlib |
| file | change |
|------------------------------------------------------|-------------------------------------------------------------------------|
| `devices/cc26x0/driverlib/bin/gcc/driverlib.a` | Renamed from `driverlib.lib` to allow Automake to recognize the library |
| `devices/cc13x2_cc26x2/driverlib/bin/gcc/driverlib.a` | Renamed from `driverlib.lib` to allow Automake to recognize the library |
| `devices/cc26x0/linker_files/cc26x0f128.lds` | `end` symbol added for GCC stdlib and C++ init array placement |
| `devices/cc13x2_cc26x2/linker_files/cc26x2r1f.lds` | `end` symbol added for GCC stdlib |
| `devices/cc26x0/startup_files/startup_gcc.c` | C++ constructor calls added to `ResetHandler` |
| `devices/cc13x2_cc26x2/startup_files/startup_gcc.c` | C++ constructor calls added to `ResetHandler` |
Documentation can be found within the [SimpleLink CC26x2 Software Development
Kit](http://www.ti.com/tool/simplelink-cc13x2-26x2-sdk).
@@ -131,6 +131,8 @@ extern uint32_t _edata;
extern uint32_t _bss;
extern uint32_t _ebss;
extern uint32_t _estack;
extern uint32_t _init_array;
extern uint32_t _einit_array;
//*****************************************************************************
//
@@ -202,6 +204,7 @@ void (* const g_pfnVectors[])(void) =
BatMonIntHandler // 53 Combined event from battery monitor
};
typedef void (*init_fn_t)(void);
//*****************************************************************************
//
@@ -218,6 +221,7 @@ ResetISR(void)
{
uint32_t *pSrc;
uint32_t *pDest;
init_fn_t *fp;
//
// Final trim of device
@@ -256,6 +260,12 @@ ResetISR(void)
" orr r1, r1, #(0xF << 20)\n"
" str r1, [r0]\n");
// C++ runtime initialization (BSS, Data, relocation, etc.)
for (fp = (init_fn_t *)&_init_array; fp < (init_fn_t *)&_einit_array; fp++)
{
(*fp)();
}
//
// Call the application's entry point.
//
@@ -90,6 +90,14 @@ SECTIONS
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > FLASH
.init_array :
{
_init_array = .;
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array*))
_einit_array = .;
} > FLASH
.data :
{
_data = .;
@@ -126,6 +126,8 @@ extern uint32_t _edata;
extern uint32_t _bss;
extern uint32_t _ebss;
extern uint32_t _estack;
extern uint32_t _init_array;
extern uint32_t _einit_array;
//*****************************************************************************
//
@@ -193,6 +195,7 @@ void (* const g_pfnVectors[])(void) =
TRNGIntHandler // 49 TRNG event
};
typedef void (*init_fn_t)(void);
//*****************************************************************************
//
@@ -209,6 +212,7 @@ ResetISR(void)
{
uint32_t *pSrc;
uint32_t *pDest;
init_fn_t *fp;
//
// Final trim of device
@@ -237,6 +241,12 @@ ResetISR(void)
" strlt r2, [r0], #4\n"
" blt zero_loop");
// C++ runtime initialization (BSS, Data, relocation, etc.)
for (fp = (init_fn_t *)&_init_array; fp < (init_fn_t *)&_einit_array; fp++)
{
(*fp)();
}
//
// Call the application's entry point.
//