From 7a1f8ee1c48b1db88e2a349caf54c828d5513b65 Mon Sep 17 00:00:00 2001 From: ArdaFu Date: Mon, 4 Jun 2018 13:34:45 +0800 Subject: [PATCH 1/3] [libcpu][arm][arm926] Using C header file to define stack and heap size. --- bsp/asm9260t/platform/rt_low_level_gcc.inc | 31 ----------------- ..._low_level_iar.inc => rt_low_level_init.h} | 8 +++-- bsp/asm9260t/platform/rt_low_level_keil.inc | 33 ------------------- bsp/at91sam9260/platform/rt_low_level_gcc.inc | 31 ----------------- ..._low_level_iar.inc => rt_low_level_init.h} | 8 +++-- .../platform/rt_low_level_keil.inc | 32 ------------------ libcpu/arm/arm926/start_gcc.S | 7 ++-- libcpu/arm/arm926/start_iar.S | 7 ++-- libcpu/arm/arm926/start_rvds.S | 5 ++- 9 files changed, 22 insertions(+), 140 deletions(-) delete mode 100644 bsp/asm9260t/platform/rt_low_level_gcc.inc rename bsp/asm9260t/platform/{rt_low_level_iar.inc => rt_low_level_init.h} (86%) delete mode 100644 bsp/asm9260t/platform/rt_low_level_keil.inc delete mode 100644 bsp/at91sam9260/platform/rt_low_level_gcc.inc rename bsp/at91sam9260/platform/{rt_low_level_iar.inc => rt_low_level_init.h} (86%) delete mode 100644 bsp/at91sam9260/platform/rt_low_level_keil.inc diff --git a/bsp/asm9260t/platform/rt_low_level_gcc.inc b/bsp/asm9260t/platform/rt_low_level_gcc.inc deleted file mode 100644 index c6edd3787..000000000 --- a/bsp/asm9260t/platform/rt_low_level_gcc.inc +++ /dev/null @@ -1,31 +0,0 @@ -/* - * File : rt_low_level_gcc.inc - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2015-04-14 ArdaFu first version - */ - -/*--------- Stack size of CPU modes ------------------------------------------*/ -.equ UND_STK_SIZE, 2048 -.equ SVC_STK_SIZE, 4096 -.equ ABT_STK_SIZE, 2048 -.equ IRQ_STK_SIZE, 4096 -.equ FIQ_STK_SIZE, 4096 -.equ SYS_STK_SIZE, 2048 diff --git a/bsp/asm9260t/platform/rt_low_level_iar.inc b/bsp/asm9260t/platform/rt_low_level_init.h similarity index 86% rename from bsp/asm9260t/platform/rt_low_level_iar.inc rename to bsp/asm9260t/platform/rt_low_level_init.h index 3046253d0..86dcfb59d 100644 --- a/bsp/asm9260t/platform/rt_low_level_iar.inc +++ b/bsp/asm9260t/platform/rt_low_level_init.h @@ -1,5 +1,5 @@ /* - * File : rt_low_level_iar.inc + * File : rt_low_level_init.h * This file is part of RT-Thread RTOS * COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team * @@ -19,8 +19,10 @@ * * Change Logs: * Date Author Notes - * 2015-04-14 ArdaFu first version + * 2018-06-04 ArdaFu first version */ +#ifndef __RT_LOW_LEVEL_INIT_H__ +#define __RT_LOW_LEVEL_INIT_H__ /*-------- Stack size of CPU modes -------------------------------------------*/ #define UND_STK_SIZE 512 @@ -29,3 +31,5 @@ #define IRQ_STK_SIZE 1024 #define FIQ_STK_SIZE 1024 #define SYS_STK_SIZE 512 +#define Heap_Size 512 +#endif diff --git a/bsp/asm9260t/platform/rt_low_level_keil.inc b/bsp/asm9260t/platform/rt_low_level_keil.inc deleted file mode 100644 index 7b3c8cfe9..000000000 --- a/bsp/asm9260t/platform/rt_low_level_keil.inc +++ /dev/null @@ -1,33 +0,0 @@ -;/* -; * File : rt_low_level_keil.inc -; * This file is part of RT-Thread RTOS -; * COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team -; * -; * This program is free software; you can redistribute it and/or modify -; * it under the terms of the GNU General Public License as published by -; * the Free Software Foundation; either version 2 of the License, or -; * (at your option) any later version. -; * -; * This program is distributed in the hope that it will be useful, -; * but WITHOUT ANY WARRANTY; without even the implied warranty of -; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; * GNU General Public License for more details. -; * -; * You should have received a copy of the GNU General Public License along -; * with this program; if not, write to the Free Software Foundation, Inc., -; * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -; * -; * Change Logs: -; * Date Author Notes -; * 2015-04-14 ArdaFu first version -; */ - -;/*-------- Stack size of CPU modes ------------------------------------------*/ -UND_STK_SIZE EQU 512 -SVC_STK_SIZE EQU 4096 -ABT_STK_SIZE EQU 512 -IRQ_STK_SIZE EQU 1024 -FIQ_STK_SIZE EQU 1024 -SYS_STK_SIZE EQU 512 -Heap_Size EQU 512 - END diff --git a/bsp/at91sam9260/platform/rt_low_level_gcc.inc b/bsp/at91sam9260/platform/rt_low_level_gcc.inc deleted file mode 100644 index c6edd3787..000000000 --- a/bsp/at91sam9260/platform/rt_low_level_gcc.inc +++ /dev/null @@ -1,31 +0,0 @@ -/* - * File : rt_low_level_gcc.inc - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2015-04-14 ArdaFu first version - */ - -/*--------- Stack size of CPU modes ------------------------------------------*/ -.equ UND_STK_SIZE, 2048 -.equ SVC_STK_SIZE, 4096 -.equ ABT_STK_SIZE, 2048 -.equ IRQ_STK_SIZE, 4096 -.equ FIQ_STK_SIZE, 4096 -.equ SYS_STK_SIZE, 2048 diff --git a/bsp/at91sam9260/platform/rt_low_level_iar.inc b/bsp/at91sam9260/platform/rt_low_level_init.h similarity index 86% rename from bsp/at91sam9260/platform/rt_low_level_iar.inc rename to bsp/at91sam9260/platform/rt_low_level_init.h index 3046253d0..86dcfb59d 100644 --- a/bsp/at91sam9260/platform/rt_low_level_iar.inc +++ b/bsp/at91sam9260/platform/rt_low_level_init.h @@ -1,5 +1,5 @@ /* - * File : rt_low_level_iar.inc + * File : rt_low_level_init.h * This file is part of RT-Thread RTOS * COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team * @@ -19,8 +19,10 @@ * * Change Logs: * Date Author Notes - * 2015-04-14 ArdaFu first version + * 2018-06-04 ArdaFu first version */ +#ifndef __RT_LOW_LEVEL_INIT_H__ +#define __RT_LOW_LEVEL_INIT_H__ /*-------- Stack size of CPU modes -------------------------------------------*/ #define UND_STK_SIZE 512 @@ -29,3 +31,5 @@ #define IRQ_STK_SIZE 1024 #define FIQ_STK_SIZE 1024 #define SYS_STK_SIZE 512 +#define Heap_Size 512 +#endif diff --git a/bsp/at91sam9260/platform/rt_low_level_keil.inc b/bsp/at91sam9260/platform/rt_low_level_keil.inc deleted file mode 100644 index c3cde15de..000000000 --- a/bsp/at91sam9260/platform/rt_low_level_keil.inc +++ /dev/null @@ -1,32 +0,0 @@ -;/* -; * File : rt_low_level_keil.inc -; * This file is part of RT-Thread RTOS -; * COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team -; * -; * This program is free software; you can redistribute it and/or modify -; * it under the terms of the GNU General Public License as published by -; * the Free Software Foundation; either version 2 of the License, or -; * (at your option) any later version. -; * -; * This program is distributed in the hope that it will be useful, -; * but WITHOUT ANY WARRANTY; without even the implied warranty of -; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; * GNU General Public License for more details. -; * -; * You should have received a copy of the GNU General Public License along -; * with this program; if not, write to the Free Software Foundation, Inc., -; * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -; * -; * Change Logs: -; * Date Author Notes -; * 2015-04-14 ArdaFu first version -; */ - -;/*-------- Stack size of CPU modes ------------------------------------------*/ -UND_STK_SIZE EQU 512 -SVC_STK_SIZE EQU 4096 -ABT_STK_SIZE EQU 512 -IRQ_STK_SIZE EQU 1024 -FIQ_STK_SIZE EQU 1024 -SYS_STK_SIZE EQU 512 - END diff --git a/libcpu/arm/arm926/start_gcc.S b/libcpu/arm/arm926/start_gcc.S index 1ccff156b..130bc041f 100644 --- a/libcpu/arm/arm926/start_gcc.S +++ b/libcpu/arm/arm926/start_gcc.S @@ -24,7 +24,9 @@ * 2015-04-21 ArdaFu Remove remap code. Using mmu to map vector table * 2015-06-04 aozima Align stack address to 8 byte. */ - + +#include "rt_low_level_init.h" + #define S_FRAME_SIZE (18*4) //72 @#define S_SPSR (17*4) //SPSR @@ -54,9 +56,8 @@ #define MODE_ABT 0x17 #define MODE_UND 0x1B #define MODEMASK 0x1F -#define NOINT 0xC0 -.include "rt_low_level_gcc.inc" +#define NOINT 0xC0 @;----------------------- Stack and Heap Definitions --------------------------- .section .nobss, "w" diff --git a/libcpu/arm/arm926/start_iar.S b/libcpu/arm/arm926/start_iar.S index 3494b108d..880f2d970 100644 --- a/libcpu/arm/arm926/start_iar.S +++ b/libcpu/arm/arm926/start_iar.S @@ -24,7 +24,9 @@ ; * 2015-04-21 ArdaFu Remove remap code. Using mmu to map vector table ; * 2015-06-04 aozima Align stack address to 8 byte. ; */ - + +#include "rt_low_level_init.h" + #define S_FRAME_SIZE (18*4) ;72 ;#define S_SPSR (17*4) ;SPSR @@ -54,9 +56,8 @@ #define MODE_ABT 0x17 #define MODE_UND 0x1B #define MODEMASK 0x1F -#define NOINT 0xC0 -#include "rt_low_level_iar.inc" +#define NOINT 0xC0 ;----------------------- Stack and Heap Definitions ---------------------------- MODULE ?cstartup diff --git a/libcpu/arm/arm926/start_rvds.S b/libcpu/arm/arm926/start_rvds.S index 1c1e48c07..9f789b97f 100644 --- a/libcpu/arm/arm926/start_rvds.S +++ b/libcpu/arm/arm926/start_rvds.S @@ -25,6 +25,8 @@ ; * 2015-06-04 aozima Align stack address to 8 byte. ; */ +#include "rt_low_level_init.h" + S_FRAME_SIZE EQU (18*4) ;72 ;S_SPSR EQU (17*4) ;SPSR ;S_CPSR EQU (16*4) ;CPSR @@ -46,7 +48,6 @@ S_PC EQU (15*4) ;R15 ;S_R1 EQU (1*4) ;S_R0 EQU (0*4) - MODE_USR EQU 0X10 MODE_FIQ EQU 0X11 MODE_IRQ EQU 0X12 @@ -57,8 +58,6 @@ MODE_SYS EQU 0X1F MODEMASK EQU 0X1F NOINT EQU 0xC0 - - GET rt_low_level_keil.inc ;----------------------- Stack and Heap Definitions ---------------------------- AREA STACK, NOINIT, READWRITE, ALIGN=3 From 099062de782913dc911e2fadf889291aafbeeeb8 Mon Sep 17 00:00:00 2001 From: ArdaFu Date: Mon, 4 Jun 2018 14:18:31 +0800 Subject: [PATCH 2/3] [tools][building] Add ASFLAGS in DefineGroup. --- libcpu/SConscript | 6 +++++- tools/building.py | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libcpu/SConscript b/libcpu/SConscript index 0d0097609..a3404e010 100644 --- a/libcpu/SConscript +++ b/libcpu/SConscript @@ -4,6 +4,7 @@ from building import * comm = rtconfig.ARCH + '/common' path = rtconfig.ARCH + '/' + rtconfig.CPU +AFLAGS = '' # The set of source files associated with this SConscript file. if rtconfig.PLATFORM == 'armcc': @@ -21,7 +22,10 @@ if rtconfig.PLATFORM == 'cl': if rtconfig.PLATFORM == 'mingw': src = Glob(path + '/*.c') +if rtconfig.PLATFORM == 'armcc' and rtconfig.ARCH == 'arm' and rtconfig.CPU == 'arm926': + ASFLAGS = ' --cpreproc' + CPPPATH = [RTT_ROOT + '/libcpu/' + rtconfig.ARCH + '/' + rtconfig.CPU, RTT_ROOT + '/libcpu/' + rtconfig.ARCH + '/common'] -group = DefineGroup(rtconfig.CPU.upper(), src, depend = [''], CPPPATH = CPPPATH) +group = DefineGroup(rtconfig.CPU.upper(), src, depend = [''], CPPPATH = CPPPATH, ASFLAGS = ASFLAGS) Return('group') diff --git a/tools/building.py b/tools/building.py index c727591bb..31dc4dae1 100644 --- a/tools/building.py +++ b/tools/building.py @@ -487,6 +487,11 @@ def MergeGroup(src_group, group): src_group['CPPDEFINES'] = src_group['CPPDEFINES'] + group['CPPDEFINES'] else: src_group['CPPDEFINES'] = group['CPPDEFINES'] + if group.has_key('ASFLAGS'): + if src_group.has_key('ASFLAGS'): + src_group['ASFLAGS'] = src_group['ASFLAGS'] + group['ASFLAGS'] + else: + src_group['ASFLAGS'] = group['ASFLAGS'] # for local CCFLAGS/CPPPATH/CPPDEFINES if group.has_key('LOCAL_CCFLAGS'): @@ -520,6 +525,11 @@ def MergeGroup(src_group, group): src_group['LIBPATH'] = src_group['LIBPATH'] + group['LIBPATH'] else: src_group['LIBPATH'] = group['LIBPATH'] + if group.has_key('LOCAL_ASFLAGS'): + if src_group.has_key('LOCAL_ASFLAGS'): + src_group['LOCAL_ASFLAGS'] = src_group['LOCAL_ASFLAGS'] + group['LOCAL_ASFLAGS'] + else: + src_group['LOCAL_ASFLAGS'] = group['LOCAL_ASFLAGS'] def DefineGroup(name, src, depend, **parameters): global Env @@ -550,6 +560,8 @@ def DefineGroup(name, src, depend, **parameters): Env.AppendUnique(CPPDEFINES = group['CPPDEFINES']) if group.has_key('LINKFLAGS'): Env.AppendUnique(LINKFLAGS = group['LINKFLAGS']) + if group.has_key('ASFLAGS'): + Env.AppendUnique(ASFLAGS = group['ASFLAGS']) # check whether to clean up library if GetOption('cleanlib') and os.path.exists(os.path.join(group['path'], GroupLibFullName(name, Env))): @@ -645,13 +657,14 @@ def DoBuilding(target, objects): # handle local group def local_group(group, objects): - if group.has_key('LOCAL_CCFLAGS') or group.has_key('LOCAL_CPPPATH') or group.has_key('LOCAL_CPPDEFINES'): + if group.has_key('LOCAL_CCFLAGS') or group.has_key('LOCAL_CPPPATH') or group.has_key('LOCAL_CPPDEFINES') or group.has_key('LOCAL_ASFLAGS'): CCFLAGS = Env.get('CCFLAGS', '') + group.get('LOCAL_CCFLAGS', '') CPPPATH = Env.get('CPPPATH', ['']) + group.get('LOCAL_CPPPATH', ['']) CPPDEFINES = Env.get('CPPDEFINES', ['']) + group.get('LOCAL_CPPDEFINES', ['']) + ASFLAGS = Env.get('ASFLAGS', '') + group.get('LOCAL_ASFLAGS', '') for source in group['src']: - objects.append(Env.Object(source, CCFLAGS = CCFLAGS, + objects.append(Env.Object(source, CCFLAGS = CCFLAGS, ASFLAGS = ASFLAGS, CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)) return True From aa08164cb397d1b3439c410740849d213f99477f Mon Sep 17 00:00:00 2001 From: ArdaFu Date: Mon, 4 Jun 2018 14:23:54 +0800 Subject: [PATCH 3/3] [libcpu] Sconscript: fix spell srror. --- libcpu/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcpu/SConscript b/libcpu/SConscript index a3404e010..a42909e64 100644 --- a/libcpu/SConscript +++ b/libcpu/SConscript @@ -4,7 +4,7 @@ from building import * comm = rtconfig.ARCH + '/common' path = rtconfig.ARCH + '/' + rtconfig.CPU -AFLAGS = '' +ASFLAGS = '' # The set of source files associated with this SConscript file. if rtconfig.PLATFORM == 'armcc':