summaryrefslogtreecommitdiff
path: root/bsp/stm32/stm32f767-atk-apollo
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 /bsp/stm32/stm32f767-atk-apollo
parentefd8b404a3fc6ee8c98b6a735fceaf29fd42c76c (diff)
add c++ support for the bsp of stm32
Diffstat (limited to 'bsp/stm32/stm32f767-atk-apollo')
-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
3 files changed, 24 insertions, 1 deletions
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