From 8ef1fa192a9fd95da8b4533dc39b8e0fcc73a9a9 Mon Sep 17 00:00:00 2001 From: LeeChunHei Date: Tue, 23 Feb 2021 11:45:27 +0800 Subject: [PATCH 1/2] fix no clear bss with gcc and the wrong logic in SConscript --- .../libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S | 2 -- bsp/imxrt/libraries/MIMXRT1050/SConscript | 3 --- .../libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S | 2 -- bsp/imxrt/libraries/MIMXRT1064/SConscript | 3 --- 4 files changed, 10 deletions(-) diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S index 73003ff20c..ae0f797605 100644 --- a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S +++ b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S @@ -367,7 +367,6 @@ Reset_Handler: blt .LC4 #endif /* __STARTUP_INITIALIZE_NONCACHEDATA */ -#ifdef __STARTUP_CLEAR_BSS /* This part of work usually is done in C library startup code. Otherwise, * define this macro to enable it in this startup. * @@ -385,7 +384,6 @@ Reset_Handler: itt lt strlt r0, [r1], #4 blt .LC5 -#endif /* __STARTUP_CLEAR_BSS */ cpsie i /* Unmask interrupts */ #ifndef __START diff --git a/bsp/imxrt/libraries/MIMXRT1050/SConscript b/bsp/imxrt/libraries/MIMXRT1050/SConscript index 58d5ccef78..4b652628f4 100644 --- a/bsp/imxrt/libraries/MIMXRT1050/SConscript +++ b/bsp/imxrt/libraries/MIMXRT1050/SConscript @@ -53,9 +53,6 @@ if GetDepend(['BSP_USING_SDRAM']): if GetDepend(['BSP_USING_LCD']): src += ['MIMXRT1052/drivers/fsl_elcdif.c'] -if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']): - src += ['MIMXRT1052/drivers/fsl_usdhc.c'] - if GetDepend(['BSP_USING_CAN']): src += ['MIMXRT1052/drivers/fsl_flexcan.c'] diff --git a/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S b/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S index db5711e040..ade70ab34e 100644 --- a/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S +++ b/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S @@ -366,7 +366,6 @@ Reset_Handler: blt .LC4 #endif /* __STARTUP_INITIALIZE_NONCACHEDATA */ -#ifdef __STARTUP_CLEAR_BSS /* This part of work usually is done in C library startup code. Otherwise, * define this macro to enable it in this startup. * @@ -384,7 +383,6 @@ Reset_Handler: itt lt strlt r0, [r1], #4 blt .LC5 -#endif /* __STARTUP_CLEAR_BSS */ cpsie i /* Unmask interrupts */ #ifndef __START diff --git a/bsp/imxrt/libraries/MIMXRT1064/SConscript b/bsp/imxrt/libraries/MIMXRT1064/SConscript index 2035ca530f..00361da038 100644 --- a/bsp/imxrt/libraries/MIMXRT1064/SConscript +++ b/bsp/imxrt/libraries/MIMXRT1064/SConscript @@ -49,9 +49,6 @@ if GetDepend(['BSP_USING_ADC']): if GetDepend(['BSP_USING_SDRAM']): src += ['MIMXRT1064/drivers/fsl_semc.c'] -if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']): - src += ['MIMXRT1064/drivers/fsl_usdhc.c'] - if GetDepend(['RT_USING_CAN']): src += ['MIMXRT1064/drivers/fsl_flexcan.c'] From b4cbfca550d0ed7107c3ad53e8519e53cc6b5f0c Mon Sep 17 00:00:00 2001 From: LeeChunHei Date: Wed, 24 Feb 2021 12:04:08 +0800 Subject: [PATCH 2/2] change to use SConscript to enable clear bss in startup.s --- .../libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S | 2 ++ bsp/imxrt/libraries/MIMXRT1050/SConscript | 5 ++++- .../libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S | 2 ++ bsp/imxrt/libraries/MIMXRT1064/SConscript | 5 ++++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S index ae0f797605..73003ff20c 100644 --- a/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S +++ b/bsp/imxrt/libraries/MIMXRT1050/MIMXRT1052/gcc/startup_MIMXRT1052.S @@ -367,6 +367,7 @@ Reset_Handler: blt .LC4 #endif /* __STARTUP_INITIALIZE_NONCACHEDATA */ +#ifdef __STARTUP_CLEAR_BSS /* This part of work usually is done in C library startup code. Otherwise, * define this macro to enable it in this startup. * @@ -384,6 +385,7 @@ Reset_Handler: itt lt strlt r0, [r1], #4 blt .LC5 +#endif /* __STARTUP_CLEAR_BSS */ cpsie i /* Unmask interrupts */ #ifndef __START diff --git a/bsp/imxrt/libraries/MIMXRT1050/SConscript b/bsp/imxrt/libraries/MIMXRT1050/SConscript index 4b652628f4..7f8f971b82 100644 --- a/bsp/imxrt/libraries/MIMXRT1050/SConscript +++ b/bsp/imxrt/libraries/MIMXRT1050/SConscript @@ -76,6 +76,9 @@ if GetDepend(['BSP_USING_DMA']): src += ['MIMXRT1052/drivers/fsl_lpspi_edma.c'] -group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path) +if rtconfig.CROSS_TOOL == 'gcc': + group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path, ASFLAGS = '$ASFLAGS -D __STARTUP_CLEAR_BSS') +else: + group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path) Return('group') diff --git a/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S b/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S index ade70ab34e..db5711e040 100644 --- a/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S +++ b/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/gcc/startup_MIMXRT1064.S @@ -366,6 +366,7 @@ Reset_Handler: blt .LC4 #endif /* __STARTUP_INITIALIZE_NONCACHEDATA */ +#ifdef __STARTUP_CLEAR_BSS /* This part of work usually is done in C library startup code. Otherwise, * define this macro to enable it in this startup. * @@ -383,6 +384,7 @@ Reset_Handler: itt lt strlt r0, [r1], #4 blt .LC5 +#endif /* __STARTUP_CLEAR_BSS */ cpsie i /* Unmask interrupts */ #ifndef __START diff --git a/bsp/imxrt/libraries/MIMXRT1064/SConscript b/bsp/imxrt/libraries/MIMXRT1064/SConscript index 00361da038..c83546f0eb 100644 --- a/bsp/imxrt/libraries/MIMXRT1064/SConscript +++ b/bsp/imxrt/libraries/MIMXRT1064/SConscript @@ -74,6 +74,9 @@ if GetDepend(['RT_SERIAL_USING_DMA']): src += ['MIMXRT1064/drivers/fsl_lpuart_edma.c'] src += ['MIMXRT1064/drivers/fsl_lpspi_edma.c'] -group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path) +if rtconfig.CROSS_TOOL == 'gcc': + group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path, ASFLAGS = '$ASFLAGS -D __STARTUP_CLEAR_BSS') +else: + group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path) Return('group')