summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortyustli <[email protected]>2019-03-23 13:59:53 +0800
committertyustli <[email protected]>2019-03-23 13:59:53 +0800
commit4f03ef589fd79366b0e6f758c2fec96fabf53009 (patch)
tree1fd1b8c9a57ca3ad67c90537b955aefd56551afd
parentefd8b404a3fc6ee8c98b6a735fceaf29fd42c76c (diff)
add c++ support for the bsp of stm32
-rw-r--r--bsp/stm32/stm32f091-st-nucleo/SConstruct1
-rw-r--r--bsp/stm32/stm32f091-st-nucleo/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f091-st-nucleo/rtconfig.py12
-rw-r--r--bsp/stm32/stm32f103-atk-nano/SConstruct1
-rw-r--r--bsp/stm32/stm32f103-atk-nano/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f103-atk-nano/rtconfig.py12
-rw-r--r--bsp/stm32/stm32f103-atk-warshipv3/SConstruct1
-rw-r--r--bsp/stm32/stm32f103-atk-warshipv3/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f103-atk-warshipv3/rtconfig.py12
-rw-r--r--bsp/stm32/stm32f103-dofly-lyc8/SConstruct1
-rw-r--r--bsp/stm32/stm32f103-dofly-lyc8/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f103-dofly-lyc8/rtconfig.py12
-rw-r--r--bsp/stm32/stm32f103-fire-arbitrary/SConstruct1
-rw-r--r--bsp/stm32/stm32f103-fire-arbitrary/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f103-fire-arbitrary/rtconfig.py12
-rw-r--r--bsp/stm32/stm32f103-hw100k-ibox/SConstruct1
-rw-r--r--bsp/stm32/stm32f103-hw100k-ibox/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f103-hw100k-ibox/rtconfig.py12
-rw-r--r--bsp/stm32/stm32f103-mini-system/SConstruct1
-rw-r--r--bsp/stm32/stm32f103-mini-system/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f103-mini-system/rtconfig.py13
-rw-r--r--bsp/stm32/stm32f107-uc-eval/SConstruct1
-rw-r--r--bsp/stm32/stm32f107-uc-eval/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f107-uc-eval/rtconfig.py12
-rw-r--r--bsp/stm32/stm32f401-st-nucleo/SConstruct1
-rw-r--r--bsp/stm32/stm32f401-st-nucleo/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f401-st-nucleo/rtconfig.py13
-rw-r--r--bsp/stm32/stm32f405-smdz-breadfruit/SConstruct1
-rw-r--r--bsp/stm32/stm32f405-smdz-breadfruit/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f405-smdz-breadfruit/rtconfig.py12
-rw-r--r--bsp/stm32/stm32f407-atk-explorer/SConstruct1
-rw-r--r--bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f407-atk-explorer/rtconfig.py12
-rw-r--r--bsp/stm32/stm32f407-st-discovery/SConstruct1
-rw-r--r--bsp/stm32/stm32f407-st-discovery/board/linker_scripts/link.lds8
-rw-r--r--bsp/stm32/stm32f407-st-discovery/rtconfig.py12
-rw-r--r--bsp/stm32/stm32f411-st-nucleo/SConstruct1
-rw-r--r--bsp/stm32/stm32f411-st-nucleo/board/linker_scripts/link.lds14
-rw-r--r--bsp/stm32/stm32f411-st-nucleo/rtconfig.py12
-rw-r--r--bsp/stm32/stm32f429-armfly-v6/SConstruct1
-rw-r--r--bsp/stm32/stm32f429-armfly-v6/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f429-armfly-v6/rtconfig.py14
-rw-r--r--bsp/stm32/stm32f429-atk-apollo/SConstruct1
-rw-r--r--bsp/stm32/stm32f429-atk-apollo/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f429-atk-apollo/rtconfig.py12
-rw-r--r--bsp/stm32/stm32f429-fire-challenger/SConstruct1
-rw-r--r--bsp/stm32/stm32f429-fire-challenger/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f429-fire-challenger/rtconfig.py12
-rw-r--r--bsp/stm32/stm32f446-st-nucleo/SConstruct1
-rw-r--r--bsp/stm32/stm32f446-st-nucleo/board/linker_scripts/link.lds14
-rw-r--r--bsp/stm32/stm32f446-st-nucleo/rtconfig.py12
-rw-r--r--bsp/stm32/stm32f746-st-disco/SConstruct1
-rw-r--r--bsp/stm32/stm32f746-st-disco/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f746-st-disco/rtconfig.py6
-rw-r--r--bsp/stm32/stm32f767-atk-apollo/SConstruct1
-rw-r--r--bsp/stm32/stm32f767-atk-apollo/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f767-atk-apollo/rtconfig.py11
-rw-r--r--bsp/stm32/stm32f767-fire-challenger/SConstruct1
-rw-r--r--bsp/stm32/stm32f767-fire-challenger/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f767-fire-challenger/rtconfig.py13
-rw-r--r--bsp/stm32/stm32f767-st-nucleo/SConstruct1
-rw-r--r--bsp/stm32/stm32f767-st-nucleo/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32f767-st-nucleo/rtconfig.py11
-rw-r--r--bsp/stm32/stm32g071-st-nucleo/SConstruct1
-rw-r--r--bsp/stm32/stm32g071-st-nucleo/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32g071-st-nucleo/rtconfig.py12
-rw-r--r--bsp/stm32/stm32l053-st-nucleo/SConstruct1
-rw-r--r--bsp/stm32/stm32l053-st-nucleo/board/linker_scripts/link.lds14
-rw-r--r--bsp/stm32/stm32l053-st-nucleo/rtconfig.py12
-rw-r--r--bsp/stm32/stm32l432-st-nucleo/SConstruct1
-rw-r--r--bsp/stm32/stm32l432-st-nucleo/board/linker_scripts/link.lds14
-rw-r--r--bsp/stm32/stm32l432-st-nucleo/rtconfig.py12
-rw-r--r--bsp/stm32/stm32l475-atk-pandora/SConstruct1
-rw-r--r--bsp/stm32/stm32l475-atk-pandora/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32l475-atk-pandora/rtconfig.py13
-rw-r--r--bsp/stm32/stm32l475-st-discovery/SConstruct1
-rw-r--r--bsp/stm32/stm32l475-st-discovery/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32l475-st-discovery/rtconfig.py12
-rw-r--r--bsp/stm32/stm32l476-st-nucleo/SConstruct1
-rw-r--r--bsp/stm32/stm32l476-st-nucleo/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32l476-st-nucleo/rtconfig.py12
-rw-r--r--bsp/stm32/stm32l496-ali-developer/SConstruct1
-rw-r--r--bsp/stm32/stm32l496-ali-developer/board/linker_scripts/link.lds13
-rw-r--r--bsp/stm32/stm32l496-ali-developer/rtconfig.py12
84 files changed, 695 insertions, 30 deletions
diff --git a/bsp/stm32/stm32f091-st-nucleo/SConstruct b/bsp/stm32/stm32f091-st-nucleo/SConstruct
index c120f925df..7979e3a23e 100644
--- a/bsp/stm32/stm32f091-st-nucleo/SConstruct
+++ b/bsp/stm32/stm32f091-st-nucleo/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f091-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32f091-st-nucleo/board/linker_scripts/link.lds
index 5f371f6694..a137112572 100644
--- a/bsp/stm32/stm32f091-st-nucleo/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f091-st-nucleo/board/linker_scripts/link.lds
@@ -46,6 +46,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -72,6 +80,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f091-st-nucleo/rtconfig.py b/bsp/stm32/stm32f091-st-nucleo/rtconfig.py
index c4d744f4f3..3c8992f7d0 100644
--- a/bsp/stm32/stm32f091-st-nucleo/rtconfig.py
+++ b/bsp/stm32/stm32f091-st-nucleo/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m0 -mthumb -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f103-atk-nano/SConstruct b/bsp/stm32/stm32f103-atk-nano/SConstruct
index 05326b2b75..27b5e7fccc 100644
--- a/bsp/stm32/stm32f103-atk-nano/SConstruct
+++ b/bsp/stm32/stm32f103-atk-nano/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f103-atk-nano/board/linker_scripts/link.lds b/bsp/stm32/stm32f103-atk-nano/board/linker_scripts/link.lds
index 74d06fdc57..c1923d786e 100644
--- a/bsp/stm32/stm32f103-atk-nano/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f103-atk-nano/board/linker_scripts/link.lds
@@ -46,6 +46,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -72,6 +80,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f103-atk-nano/rtconfig.py b/bsp/stm32/stm32f103-atk-nano/rtconfig.py
index 40826ac99e..91aba62478 100644
--- a/bsp/stm32/stm32f103-atk-nano/rtconfig.py
+++ b/bsp/stm32/stm32f103-atk-nano/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -129,6 +137,8 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+
+ CXXFLAGS = CFLAGS
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f103-atk-warshipv3/SConstruct b/bsp/stm32/stm32f103-atk-warshipv3/SConstruct
index 05326b2b75..27b5e7fccc 100644
--- a/bsp/stm32/stm32f103-atk-warshipv3/SConstruct
+++ b/bsp/stm32/stm32f103-atk-warshipv3/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f103-atk-warshipv3/board/linker_scripts/link.lds b/bsp/stm32/stm32f103-atk-warshipv3/board/linker_scripts/link.lds
index 52ffe5e459..f1bc84f8f1 100644
--- a/bsp/stm32/stm32f103-atk-warshipv3/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f103-atk-warshipv3/board/linker_scripts/link.lds
@@ -46,6 +46,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -72,6 +80,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f103-atk-warshipv3/rtconfig.py b/bsp/stm32/stm32f103-atk-warshipv3/rtconfig.py
index 40826ac99e..c6d16622da 100644
--- a/bsp/stm32/stm32f103-atk-warshipv3/rtconfig.py
+++ b/bsp/stm32/stm32f103-atk-warshipv3/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f103-dofly-lyc8/SConstruct b/bsp/stm32/stm32f103-dofly-lyc8/SConstruct
index c28354a99d..c4c95cfdb8 100644
--- a/bsp/stm32/stm32f103-dofly-lyc8/SConstruct
+++ b/bsp/stm32/stm32f103-dofly-lyc8/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f103-dofly-lyc8/board/linker_scripts/link.lds b/bsp/stm32/stm32f103-dofly-lyc8/board/linker_scripts/link.lds
index f9fdaf17c5..22e29d2ed7 100644
--- a/bsp/stm32/stm32f103-dofly-lyc8/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f103-dofly-lyc8/board/linker_scripts/link.lds
@@ -46,6 +46,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -72,6 +80,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f103-dofly-lyc8/rtconfig.py b/bsp/stm32/stm32f103-dofly-lyc8/rtconfig.py
index 40826ac99e..91aba62478 100644
--- a/bsp/stm32/stm32f103-dofly-lyc8/rtconfig.py
+++ b/bsp/stm32/stm32f103-dofly-lyc8/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -129,6 +137,8 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+
+ CXXFLAGS = CFLAGS
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f103-fire-arbitrary/SConstruct b/bsp/stm32/stm32f103-fire-arbitrary/SConstruct
index 05326b2b75..27b5e7fccc 100644
--- a/bsp/stm32/stm32f103-fire-arbitrary/SConstruct
+++ b/bsp/stm32/stm32f103-fire-arbitrary/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f103-fire-arbitrary/board/linker_scripts/link.lds b/bsp/stm32/stm32f103-fire-arbitrary/board/linker_scripts/link.lds
index 52ffe5e459..28d8239542 100644
--- a/bsp/stm32/stm32f103-fire-arbitrary/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f103-fire-arbitrary/board/linker_scripts/link.lds
@@ -46,6 +46,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -72,6 +80,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f103-fire-arbitrary/rtconfig.py b/bsp/stm32/stm32f103-fire-arbitrary/rtconfig.py
index 40826ac99e..91aba62478 100644
--- a/bsp/stm32/stm32f103-fire-arbitrary/rtconfig.py
+++ b/bsp/stm32/stm32f103-fire-arbitrary/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -129,6 +137,8 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+
+ CXXFLAGS = CFLAGS
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f103-hw100k-ibox/SConstruct b/bsp/stm32/stm32f103-hw100k-ibox/SConstruct
index 05326b2b75..27b5e7fccc 100644
--- a/bsp/stm32/stm32f103-hw100k-ibox/SConstruct
+++ b/bsp/stm32/stm32f103-hw100k-ibox/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f103-hw100k-ibox/board/linker_scripts/link.lds b/bsp/stm32/stm32f103-hw100k-ibox/board/linker_scripts/link.lds
index 52ffe5e459..01ebc4164b 100644
--- a/bsp/stm32/stm32f103-hw100k-ibox/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f103-hw100k-ibox/board/linker_scripts/link.lds
@@ -46,6 +46,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -72,6 +80,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f103-hw100k-ibox/rtconfig.py b/bsp/stm32/stm32f103-hw100k-ibox/rtconfig.py
index 40826ac99e..c6d16622da 100644
--- a/bsp/stm32/stm32f103-hw100k-ibox/rtconfig.py
+++ b/bsp/stm32/stm32f103-hw100k-ibox/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f103-mini-system/SConstruct b/bsp/stm32/stm32f103-mini-system/SConstruct
index 05326b2b75..27b5e7fccc 100644
--- a/bsp/stm32/stm32f103-mini-system/SConstruct
+++ b/bsp/stm32/stm32f103-mini-system/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f103-mini-system/board/linker_scripts/link.lds b/bsp/stm32/stm32f103-mini-system/board/linker_scripts/link.lds
index f9fdaf17c5..22e29d2ed7 100644
--- a/bsp/stm32/stm32f103-mini-system/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f103-mini-system/board/linker_scripts/link.lds
@@ -46,6 +46,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -72,6 +80,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f103-mini-system/rtconfig.py b/bsp/stm32/stm32f103-mini-system/rtconfig.py
index 40826ac99e..a839777aef 100644
--- a/bsp/stm32/stm32f103-mini-system/rtconfig.py
+++ b/bsp/stm32/stm32f103-mini-system/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,16 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +139,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f107-uc-eval/SConstruct b/bsp/stm32/stm32f107-uc-eval/SConstruct
index 05326b2b75..27b5e7fccc 100644
--- a/bsp/stm32/stm32f107-uc-eval/SConstruct
+++ b/bsp/stm32/stm32f107-uc-eval/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f107-uc-eval/board/linker_scripts/link.lds b/bsp/stm32/stm32f107-uc-eval/board/linker_scripts/link.lds
index d895f771e7..8bb1de29b6 100644
--- a/bsp/stm32/stm32f107-uc-eval/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f107-uc-eval/board/linker_scripts/link.lds
@@ -46,6 +46,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -72,6 +80,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f107-uc-eval/rtconfig.py b/bsp/stm32/stm32f107-uc-eval/rtconfig.py
index 40826ac99e..91aba62478 100644
--- a/bsp/stm32/stm32f107-uc-eval/rtconfig.py
+++ b/bsp/stm32/stm32f107-uc-eval/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -129,6 +137,8 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+
+ CXXFLAGS = CFLAGS
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f401-st-nucleo/SConstruct b/bsp/stm32/stm32f401-st-nucleo/SConstruct
index 1101c708bd..629f25c6ee 100644
--- a/bsp/stm32/stm32f401-st-nucleo/SConstruct
+++ b/bsp/stm32/stm32f401-st-nucleo/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f401-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32f401-st-nucleo/board/linker_scripts/link.lds
index d89ce4e1ad..4690564fa2 100644
--- a/bsp/stm32/stm32f401-st-nucleo/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f401-st-nucleo/board/linker_scripts/link.lds
@@ -47,6 +47,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -73,6 +81,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f401-st-nucleo/rtconfig.py b/bsp/stm32/stm32f401-st-nucleo/rtconfig.py
index 3241586f69..3aafec60b8 100644
--- a/bsp/stm32/stm32f401-st-nucleo/rtconfig.py
+++ b/bsp/stm32/stm32f401-st-nucleo/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +138,8 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f405-smdz-breadfruit/SConstruct b/bsp/stm32/stm32f405-smdz-breadfruit/SConstruct
index 6180d5bea2..110a631aea 100644
--- a/bsp/stm32/stm32f405-smdz-breadfruit/SConstruct
+++ b/bsp/stm32/stm32f405-smdz-breadfruit/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f405-smdz-breadfruit/board/linker_scripts/link.lds b/bsp/stm32/stm32f405-smdz-breadfruit/board/linker_scripts/link.lds
index fb96952f93..d7aaa5969d 100644
--- a/bsp/stm32/stm32f405-smdz-breadfruit/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f405-smdz-breadfruit/board/linker_scripts/link.lds
@@ -49,6 +49,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > CODE = 0
@@ -75,6 +83,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f405-smdz-breadfruit/rtconfig.py b/bsp/stm32/stm32f405-smdz-breadfruit/rtconfig.py
index ca3993b30d..5094363dfa 100644
--- a/bsp/stm32/stm32f405-smdz-breadfruit/rtconfig.py
+++ b/bsp/stm32/stm32f405-smdz-breadfruit/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f407-atk-explorer/SConstruct b/bsp/stm32/stm32f407-atk-explorer/SConstruct
index 1101c708bd..629f25c6ee 100644
--- a/bsp/stm32/stm32f407-atk-explorer/SConstruct
+++ b/bsp/stm32/stm32f407-atk-explorer/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/link.lds b/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/link.lds
index fb96952f93..79a7e76df3 100644
--- a/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/link.lds
@@ -49,6 +49,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > CODE = 0
@@ -75,6 +83,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f407-atk-explorer/rtconfig.py b/bsp/stm32/stm32f407-atk-explorer/rtconfig.py
index 3241586f69..4a9fe33cef 100644
--- a/bsp/stm32/stm32f407-atk-explorer/rtconfig.py
+++ b/bsp/stm32/stm32f407-atk-explorer/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f407-st-discovery/SConstruct b/bsp/stm32/stm32f407-st-discovery/SConstruct
index f80a225c3b..b3728e2330 100644
--- a/bsp/stm32/stm32f407-st-discovery/SConstruct
+++ b/bsp/stm32/stm32f407-st-discovery/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f407-st-discovery/board/linker_scripts/link.lds b/bsp/stm32/stm32f407-st-discovery/board/linker_scripts/link.lds
index 02bebed7a6..46cc164fa9 100644
--- a/bsp/stm32/stm32f407-st-discovery/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f407-st-discovery/board/linker_scripts/link.lds
@@ -48,6 +48,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > CODE = 0
diff --git a/bsp/stm32/stm32f407-st-discovery/rtconfig.py b/bsp/stm32/stm32f407-st-discovery/rtconfig.py
index 4d9d4450aa..4f3dbc90ee 100644
--- a/bsp/stm32/stm32f407-st-discovery/rtconfig.py
+++ b/bsp/stm32/stm32f407-st-discovery/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f411-st-nucleo/SConstruct b/bsp/stm32/stm32f411-st-nucleo/SConstruct
index f80a225c3b..b3728e2330 100644
--- a/bsp/stm32/stm32f411-st-nucleo/SConstruct
+++ b/bsp/stm32/stm32f411-st-nucleo/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f411-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32f411-st-nucleo/board/linker_scripts/link.lds
index 4d08a6d00e..cab0cf0418 100644
--- a/bsp/stm32/stm32f411-st-nucleo/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f411-st-nucleo/board/linker_scripts/link.lds
@@ -47,6 +47,15 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -73,6 +82,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f411-st-nucleo/rtconfig.py b/bsp/stm32/stm32f411-st-nucleo/rtconfig.py
index 4d9d4450aa..69a32c6da2 100644
--- a/bsp/stm32/stm32f411-st-nucleo/rtconfig.py
+++ b/bsp/stm32/stm32f411-st-nucleo/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f429-armfly-v6/SConstruct b/bsp/stm32/stm32f429-armfly-v6/SConstruct
index 1101c708bd..629f25c6ee 100644
--- a/bsp/stm32/stm32f429-armfly-v6/SConstruct
+++ b/bsp/stm32/stm32f429-armfly-v6/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f429-armfly-v6/board/linker_scripts/link.lds b/bsp/stm32/stm32f429-armfly-v6/board/linker_scripts/link.lds
index adf166dd64..7fb843251f 100644
--- a/bsp/stm32/stm32f429-armfly-v6/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f429-armfly-v6/board/linker_scripts/link.lds
@@ -49,6 +49,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > CODE = 0
@@ -75,6 +83,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f429-armfly-v6/rtconfig.py b/bsp/stm32/stm32f429-armfly-v6/rtconfig.py
index 2e3b7cf492..3bb974643b 100644
--- a/bsp/stm32/stm32f429-armfly-v6/rtconfig.py
+++ b/bsp/stm32/stm32f429-armfly-v6/rtconfig.py
@@ -35,6 +35,7 @@ if PLATFORM == 'gcc':
PREFIX = 'arm-none-eabi-'
CC = PREFIX + 'gcc'
AS = PREFIX + 'gcc'
+ CXX = PREFIX + 'g++'
AR = PREFIX + 'ar'
LINK = PREFIX + 'gcc'
TARGET_EXT = 'elf'
@@ -43,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -56,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -84,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -129,5 +138,8 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f429-atk-apollo/SConstruct b/bsp/stm32/stm32f429-atk-apollo/SConstruct
index 1101c708bd..629f25c6ee 100644
--- a/bsp/stm32/stm32f429-atk-apollo/SConstruct
+++ b/bsp/stm32/stm32f429-atk-apollo/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f429-atk-apollo/board/linker_scripts/link.lds b/bsp/stm32/stm32f429-atk-apollo/board/linker_scripts/link.lds
index bc4b95e6ae..d023c0b256 100644
--- a/bsp/stm32/stm32f429-atk-apollo/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f429-atk-apollo/board/linker_scripts/link.lds
@@ -55,6 +55,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > CODE = 0
@@ -81,6 +89,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f429-atk-apollo/rtconfig.py b/bsp/stm32/stm32f429-atk-apollo/rtconfig.py
index 3241586f69..4a9fe33cef 100644
--- a/bsp/stm32/stm32f429-atk-apollo/rtconfig.py
+++ b/bsp/stm32/stm32f429-atk-apollo/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f429-fire-challenger/SConstruct b/bsp/stm32/stm32f429-fire-challenger/SConstruct
index 1101c708bd..629f25c6ee 100644
--- a/bsp/stm32/stm32f429-fire-challenger/SConstruct
+++ b/bsp/stm32/stm32f429-fire-challenger/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f429-fire-challenger/board/linker_scripts/link.lds b/bsp/stm32/stm32f429-fire-challenger/board/linker_scripts/link.lds
index adf166dd64..7fb843251f 100644
--- a/bsp/stm32/stm32f429-fire-challenger/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f429-fire-challenger/board/linker_scripts/link.lds
@@ -49,6 +49,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > CODE = 0
@@ -75,6 +83,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f429-fire-challenger/rtconfig.py b/bsp/stm32/stm32f429-fire-challenger/rtconfig.py
index 3241586f69..4a9fe33cef 100644
--- a/bsp/stm32/stm32f429-fire-challenger/rtconfig.py
+++ b/bsp/stm32/stm32f429-fire-challenger/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f446-st-nucleo/SConstruct b/bsp/stm32/stm32f446-st-nucleo/SConstruct
index 1101c708bd..629f25c6ee 100644
--- a/bsp/stm32/stm32f446-st-nucleo/SConstruct
+++ b/bsp/stm32/stm32f446-st-nucleo/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f446-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32f446-st-nucleo/board/linker_scripts/link.lds
index 21d57b9d71..34823737b3 100644
--- a/bsp/stm32/stm32f446-st-nucleo/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f446-st-nucleo/board/linker_scripts/link.lds
@@ -47,6 +47,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -73,6 +81,12 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f446-st-nucleo/rtconfig.py b/bsp/stm32/stm32f446-st-nucleo/rtconfig.py
index 3241586f69..4a9fe33cef 100644
--- a/bsp/stm32/stm32f446-st-nucleo/rtconfig.py
+++ b/bsp/stm32/stm32f446-st-nucleo/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32f746-st-disco/SConstruct b/bsp/stm32/stm32f746-st-disco/SConstruct
index b6053d64c2..012e6b41bf 100644
--- a/bsp/stm32/stm32f746-st-disco/SConstruct
+++ b/bsp/stm32/stm32f746-st-disco/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f746-st-disco/board/linker_scripts/link.lds b/bsp/stm32/stm32f746-st-disco/board/linker_scripts/link.lds
index 83adc09622..09cdaa3a09 100644
--- a/bsp/stm32/stm32f746-st-disco/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f746-st-disco/board/linker_scripts/link.lds
@@ -47,6 +47,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -73,6 +81,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f746-st-disco/rtconfig.py b/bsp/stm32/stm32f746-st-disco/rtconfig.py
index dbe66205eb..4c4dc4ef02 100644
--- a/bsp/stm32/stm32f746-st-disco/rtconfig.py
+++ b/bsp/stm32/stm32f746-st-disco/rtconfig.py
@@ -43,7 +43,7 @@ if PLATFORM == 'gcc':
STRIP = PREFIX + 'strip'
DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -g -Wall'
+ CFLAGS = DEVICE + ' -g -Wall'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -56,6 +56,9 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2 -Os'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
# module setting
@@ -92,6 +95,7 @@ elif PLATFORM == 'armcc':
CFLAGS += ' -O2 -Otime'
CXXFLAGS = CFLAGS
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
diff --git a/bsp/stm32/stm32f767-atk-apollo/SConstruct b/bsp/stm32/stm32f767-atk-apollo/SConstruct
index dd77b5c1d3..ca0f33d692 100644
--- a/bsp/stm32/stm32f767-atk-apollo/SConstruct
+++ b/bsp/stm32/stm32f767-atk-apollo/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f767-atk-apollo/board/linker_scripts/link.lds b/bsp/stm32/stm32f767-atk-apollo/board/linker_scripts/link.lds
index c6fe92740e..50169db320 100644
--- a/bsp/stm32/stm32f767-atk-apollo/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f767-atk-apollo/board/linker_scripts/link.lds
@@ -47,6 +47,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -73,6 +81,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f767-atk-apollo/rtconfig.py b/bsp/stm32/stm32f767-atk-apollo/rtconfig.py
index 11cbdba8c4..251d8168e7 100644
--- a/bsp/stm32/stm32f767-atk-apollo/rtconfig.py
+++ b/bsp/stm32/stm32f767-atk-apollo/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -86,11 +90,14 @@ elif PLATFORM == 'armcc':
CFLAGS += ' -O2'
CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -131,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' \ No newline at end of file
diff --git a/bsp/stm32/stm32f767-fire-challenger/SConstruct b/bsp/stm32/stm32f767-fire-challenger/SConstruct
index dd77b5c1d3..ca0f33d692 100644
--- a/bsp/stm32/stm32f767-fire-challenger/SConstruct
+++ b/bsp/stm32/stm32f767-fire-challenger/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f767-fire-challenger/board/linker_scripts/link.lds b/bsp/stm32/stm32f767-fire-challenger/board/linker_scripts/link.lds
index c6fe92740e..50169db320 100644
--- a/bsp/stm32/stm32f767-fire-challenger/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f767-fire-challenger/board/linker_scripts/link.lds
@@ -47,6 +47,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -73,6 +81,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f767-fire-challenger/rtconfig.py b/bsp/stm32/stm32f767-fire-challenger/rtconfig.py
index 11cbdba8c4..93d7b66033 100644
--- a/bsp/stm32/stm32f767-fire-challenger/rtconfig.py
+++ b/bsp/stm32/stm32f767-fire-challenger/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,12 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
- CXXFLAGS = CFLAGS
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -131,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin' \ No newline at end of file
diff --git a/bsp/stm32/stm32f767-st-nucleo/SConstruct b/bsp/stm32/stm32f767-st-nucleo/SConstruct
index b6053d64c2..012e6b41bf 100644
--- a/bsp/stm32/stm32f767-st-nucleo/SConstruct
+++ b/bsp/stm32/stm32f767-st-nucleo/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32f767-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32f767-st-nucleo/board/linker_scripts/link.lds
index e9f089ac5c..406ae0c82e 100644
--- a/bsp/stm32/stm32f767-st-nucleo/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32f767-st-nucleo/board/linker_scripts/link.lds
@@ -47,6 +47,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -73,6 +81,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32f767-st-nucleo/rtconfig.py b/bsp/stm32/stm32f767-st-nucleo/rtconfig.py
index dbe66205eb..ef578d17ca 100644
--- a/bsp/stm32/stm32f767-st-nucleo/rtconfig.py
+++ b/bsp/stm32/stm32f767-st-nucleo/rtconfig.py
@@ -43,7 +43,7 @@ if PLATFORM == 'gcc':
STRIP = PREFIX + 'strip'
DEVICE = ' -mcpu=' + CPU + ' -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -g -Wall'
+ CFLAGS = DEVICE + ' -g -Wall'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -56,6 +56,9 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2 -Os'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
# module setting
@@ -70,6 +73,7 @@ elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
CXX = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -91,13 +95,16 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2 -Otime'
- CXXFLAGS = CFLAGS
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
CXX = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
diff --git a/bsp/stm32/stm32g071-st-nucleo/SConstruct b/bsp/stm32/stm32g071-st-nucleo/SConstruct
index 59e76d2f2e..9de90da39b 100644
--- a/bsp/stm32/stm32g071-st-nucleo/SConstruct
+++ b/bsp/stm32/stm32g071-st-nucleo/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32g071-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32g071-st-nucleo/board/linker_scripts/link.lds
index f8692a3b45..963ce61634 100644
--- a/bsp/stm32/stm32g071-st-nucleo/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32g071-st-nucleo/board/linker_scripts/link.lds
@@ -46,6 +46,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -72,6 +80,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32g071-st-nucleo/rtconfig.py b/bsp/stm32/stm32g071-st-nucleo/rtconfig.py
index 7c5cbfea7f..7b2a05c9e3 100644
--- a/bsp/stm32/stm32g071-st-nucleo/rtconfig.py
+++ b/bsp/stm32/stm32g071-st-nucleo/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m0plus -mthumb -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32l053-st-nucleo/SConstruct b/bsp/stm32/stm32l053-st-nucleo/SConstruct
index 1528fcf082..b158e3828b 100644
--- a/bsp/stm32/stm32l053-st-nucleo/SConstruct
+++ b/bsp/stm32/stm32l053-st-nucleo/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32l053-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32l053-st-nucleo/board/linker_scripts/link.lds
index e31508b29c..3838be7354 100644
--- a/bsp/stm32/stm32l053-st-nucleo/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32l053-st-nucleo/board/linker_scripts/link.lds
@@ -46,6 +46,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -72,6 +80,12 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32l053-st-nucleo/rtconfig.py b/bsp/stm32/stm32l053-st-nucleo/rtconfig.py
index 7c5cbfea7f..ff1b0664a5 100644
--- a/bsp/stm32/stm32l053-st-nucleo/rtconfig.py
+++ b/bsp/stm32/stm32l053-st-nucleo/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m0plus -mthumb -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32l432-st-nucleo/SConstruct b/bsp/stm32/stm32l432-st-nucleo/SConstruct
index e1989a9d81..58a36adbfc 100644
--- a/bsp/stm32/stm32l432-st-nucleo/SConstruct
+++ b/bsp/stm32/stm32l432-st-nucleo/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32l432-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32l432-st-nucleo/board/linker_scripts/link.lds
index 82a4371c68..a20112b7ef 100644
--- a/bsp/stm32/stm32l432-st-nucleo/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32l432-st-nucleo/board/linker_scripts/link.lds
@@ -47,6 +47,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -73,6 +81,12 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32l432-st-nucleo/rtconfig.py b/bsp/stm32/stm32l432-st-nucleo/rtconfig.py
index d632114e2d..ae800430f2 100644
--- a/bsp/stm32/stm32l432-st-nucleo/rtconfig.py
+++ b/bsp/stm32/stm32l432-st-nucleo/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32l475-atk-pandora/SConstruct b/bsp/stm32/stm32l475-atk-pandora/SConstruct
index e1989a9d81..58a36adbfc 100644
--- a/bsp/stm32/stm32l475-atk-pandora/SConstruct
+++ b/bsp/stm32/stm32l475-atk-pandora/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32l475-atk-pandora/board/linker_scripts/link.lds b/bsp/stm32/stm32l475-atk-pandora/board/linker_scripts/link.lds
index 91149a6a2f..9017e4b0f8 100644
--- a/bsp/stm32/stm32l475-atk-pandora/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32l475-atk-pandora/board/linker_scripts/link.lds
@@ -47,6 +47,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -73,6 +81,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32l475-atk-pandora/rtconfig.py b/bsp/stm32/stm32l475-atk-pandora/rtconfig.py
index d632114e2d..2b495647e4 100644
--- a/bsp/stm32/stm32l475-atk-pandora/rtconfig.py
+++ b/bsp/stm32/stm32l475-atk-pandora/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,16 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +139,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32l475-st-discovery/SConstruct b/bsp/stm32/stm32l475-st-discovery/SConstruct
index 6e29ff6ae3..1a3000812b 100644
--- a/bsp/stm32/stm32l475-st-discovery/SConstruct
+++ b/bsp/stm32/stm32l475-st-discovery/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32l475-st-discovery/board/linker_scripts/link.lds b/bsp/stm32/stm32l475-st-discovery/board/linker_scripts/link.lds
index e57d211bd1..a399cbe150 100644
--- a/bsp/stm32/stm32l475-st-discovery/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32l475-st-discovery/board/linker_scripts/link.lds
@@ -48,6 +48,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -74,6 +82,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32l475-st-discovery/rtconfig.py b/bsp/stm32/stm32l475-st-discovery/rtconfig.py
index d98a0bf18f..2876ce6761 100644
--- a/bsp/stm32/stm32l475-st-discovery/rtconfig.py
+++ b/bsp/stm32/stm32l475-st-discovery/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32l476-st-nucleo/SConstruct b/bsp/stm32/stm32l476-st-nucleo/SConstruct
index e1989a9d81..58a36adbfc 100644
--- a/bsp/stm32/stm32l476-st-nucleo/SConstruct
+++ b/bsp/stm32/stm32l476-st-nucleo/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32l476-st-nucleo/board/linker_scripts/link.lds b/bsp/stm32/stm32l476-st-nucleo/board/linker_scripts/link.lds
index 7edc4c6855..312244b71e 100644
--- a/bsp/stm32/stm32l476-st-nucleo/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32l476-st-nucleo/board/linker_scripts/link.lds
@@ -47,6 +47,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -73,6 +81,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32l476-st-nucleo/rtconfig.py b/bsp/stm32/stm32l476-st-nucleo/rtconfig.py
index d632114e2d..f13d785d54 100644
--- a/bsp/stm32/stm32l476-st-nucleo/rtconfig.py
+++ b/bsp/stm32/stm32l476-st-nucleo/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -129,6 +137,8 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+
+ CXXFLAGS = CFLAGS
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
diff --git a/bsp/stm32/stm32l496-ali-developer/SConstruct b/bsp/stm32/stm32l496-ali-developer/SConstruct
index e1989a9d81..58a36adbfc 100644
--- a/bsp/stm32/stm32l496-ali-developer/SConstruct
+++ b/bsp/stm32/stm32l496-ali-developer/SConstruct
@@ -21,6 +21,7 @@ env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
+ CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
diff --git a/bsp/stm32/stm32l496-ali-developer/board/linker_scripts/link.lds b/bsp/stm32/stm32l496-ali-developer/board/linker_scripts/link.lds
index 2047b8e166..941ff06a51 100644
--- a/bsp/stm32/stm32l496-ali-developer/board/linker_scripts/link.lds
+++ b/bsp/stm32/stm32l496-ali-developer/board/linker_scripts/link.lds
@@ -46,6 +46,14 @@ SECTIONS
__rt_init_end = .;
. = ALIGN(4);
+
+ PROVIDE(__ctors_start__ = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE(__ctors_end__ = .);
+
+ . = ALIGN(4);
+
_etext = .;
} > ROM = 0
@@ -72,6 +80,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
+ PROVIDE(__dtors_start__ = .);
+ KEEP(*(SORT(.dtors.*)))
+ KEEP(*(.dtors))
+ PROVIDE(__dtors_end__ = .);
+
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data secion */
_edata = . ;
diff --git a/bsp/stm32/stm32l496-ali-developer/rtconfig.py b/bsp/stm32/stm32l496-ali-developer/rtconfig.py
index d632114e2d..ae800430f2 100644
--- a/bsp/stm32/stm32l496-ali-developer/rtconfig.py
+++ b/bsp/stm32/stm32l496-ali-developer/rtconfig.py
@@ -44,7 +44,7 @@ if PLATFORM == 'gcc':
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
- CFLAGS = DEVICE + ' -std=c99 -Dgcc'
+ CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-cref,-u,Reset_Handler -T board/linker_scripts/link.lds'
@@ -57,11 +57,15 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
+ CXX = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
@@ -85,11 +89,15 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
+ CXXFLAGS = CFLAGS
+ CFLAGS += ' -std=c99'
+
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
+ CXX = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
@@ -130,5 +138,7 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config "board/linker_scripts/link.icf"'
LFLAGS += ' --entry __iar_program_start'
+ CXXFLAGS = CFLAGS
+
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'