From 3761d113d03b832a372167403304315a37f4b7b0 Mon Sep 17 00:00:00 2001 From: "@lin12345678" Date: Wed, 8 Sep 2021 14:29:24 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9backtrace=EF=BC=8C?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E7=94=A8=E4=BA=8E=E6=A0=88=E5=9B=9E=E6=BA=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/imx6ull-artpi-smart/.config | 48 +++++---- bsp/imx6ull-artpi-smart/SConstruct | 16 ++- bsp/imx6ull-artpi-smart/link_smart.lds | 139 ++++++++++++++----------- bsp/imx6ull-artpi-smart/rtconfig.h | 2 +- bsp/imx6ull-artpi-smart/rtconfig.py | 2 +- 5 files changed, 123 insertions(+), 84 deletions(-) diff --git a/bsp/imx6ull-artpi-smart/.config b/bsp/imx6ull-artpi-smart/.config index 0becda67dc..f0405d6ced 100644 --- a/bsp/imx6ull-artpi-smart/.config +++ b/bsp/imx6ull-artpi-smart/.config @@ -80,6 +80,7 @@ CONFIG_PV_OFFSET=0xc0000000 # CONFIG_RT_IOREMAP_LATE is not set CONFIG_ARCH_ARM_CORTEX_A=y CONFIG_ARCH_ARM_CORTEX_A7=y +CONFIG_ARCH_ARM_SECURE_MODE=y CONFIG_RT_BACKTRACE_FUNCTION_NAME=y # @@ -405,6 +406,7 @@ CONFIG_LWP_TID_MAX_NR=64 # CONFIG_PKG_USING_AT_DEVICE is not set # CONFIG_PKG_USING_ATSRV_SOCKET is not set # CONFIG_PKG_USING_WIZNET is not set +# CONFIG_PKG_USING_ZB_COORDINATOR is not set # # IoT Cloud @@ -446,7 +448,6 @@ CONFIG_LWP_TID_MAX_NR=64 # CONFIG_PKG_USING_AGILE_FTP is not set # CONFIG_PKG_USING_EMBEDDEDPROTO is not set # CONFIG_PKG_USING_RT_LINK_HW is not set -# CONFIG_PKG_USING_UPNP is not set # # security packages @@ -463,6 +464,7 @@ CONFIG_LWP_TID_MAX_NR=64 # CONFIG_PKG_USING_LUA is not set # CONFIG_PKG_USING_JERRYSCRIPT is not set # CONFIG_PKG_USING_MICROPYTHON is not set +# CONFIG_PKG_USING_PIKASCRIPT is not set # # multimedia packages @@ -579,6 +581,8 @@ CONFIG_PKG_LWEXT4_VER="latest" # CONFIG_PKG_USING_LPM is not set # CONFIG_PKG_USING_TLSF is not set # CONFIG_PKG_USING_EVENT_RECORDER is not set +# CONFIG_PKG_USING_ARM_2D is not set +# CONFIG_PKG_USING_WCWIDTH is not set # # peripheral libraries and drivers @@ -649,6 +653,8 @@ CONFIG_PKG_LWEXT4_VER="latest" # CONFIG_PKG_USING_KOBUKI is not set # CONFIG_PKG_USING_ROSSERIAL is not set # CONFIG_PKG_USING_MICRO_ROS is not set +# CONFIG_PKG_USING_MCP23008 is not set +# CONFIG_PKG_USING_BLUETRUM_SDK is not set # # AI packages @@ -666,6 +672,27 @@ CONFIG_PKG_LWEXT4_VER="latest" # # miscellaneous packages # + +# +# samples: kernel and components samples +# +# CONFIG_PKG_USING_KERNEL_SAMPLES is not set +# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set +# CONFIG_PKG_USING_NETWORK_SAMPLES is not set +# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set + +# +# entertainment: terminal games and other interesting software packages +# +# CONFIG_PKG_USING_CMATRIX is not set +# CONFIG_PKG_USING_SL is not set +# CONFIG_PKG_USING_CAL is not set +# CONFIG_PKG_USING_ACLOCK is not set +# CONFIG_PKG_USING_THREES is not set +# CONFIG_PKG_USING_2048 is not set +# CONFIG_PKG_USING_SNAKE is not set +# CONFIG_PKG_USING_TETRIS is not set +# CONFIG_PKG_USING_DONUT is not set # CONFIG_PKG_USING_LIBCSV is not set # CONFIG_PKG_USING_OPTPARSE is not set # CONFIG_PKG_USING_FASTLZ is not set @@ -683,14 +710,6 @@ CONFIG_PKG_LWEXT4_VER="latest" # CONFIG_PKG_USING_DIGITALCTRL is not set # CONFIG_PKG_USING_UPACKER is not set # CONFIG_PKG_USING_UPARAM is not set - -# -# samples: kernel and components samples -# -# CONFIG_PKG_USING_KERNEL_SAMPLES is not set -# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set -# CONFIG_PKG_USING_NETWORK_SAMPLES is not set -# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set # CONFIG_PKG_USING_HELLO is not set # CONFIG_PKG_USING_VI is not set # CONFIG_PKG_USING_KI is not set @@ -698,20 +717,11 @@ CONFIG_PKG_LWEXT4_VER="latest" # CONFIG_PKG_USING_VT100 is not set # CONFIG_PKG_USING_UKAL is not set # CONFIG_PKG_USING_CRCLIB is not set - -# -# entertainment: terminal games and other interesting software packages -# -# CONFIG_PKG_USING_THREES is not set -# CONFIG_PKG_USING_2048 is not set -# CONFIG_PKG_USING_SNAKE is not set -# CONFIG_PKG_USING_TETRIS is not set -# CONFIG_PKG_USING_DONUT is not set -# CONFIG_PKG_USING_ACLOCK is not set # CONFIG_PKG_USING_LWGPS is not set # CONFIG_PKG_USING_STATE_MACHINE is not set # CONFIG_PKG_USING_MCURSES is not set # CONFIG_PKG_USING_COWSAY is not set +# CONFIG_PKG_USING_TERMBOX is not set CONFIG_SOC_IMX6ULL=y CONFIG_CPU_MCIMX6Y2CVM05=y CONFIG_FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL=1 diff --git a/bsp/imx6ull-artpi-smart/SConstruct b/bsp/imx6ull-artpi-smart/SConstruct index 15f69a4c5d..a1ea54d063 100644 --- a/bsp/imx6ull-artpi-smart/SConstruct +++ b/bsp/imx6ull-artpi-smart/SConstruct @@ -1,7 +1,7 @@ import os import sys import rtconfig - +import re RTT_ROOT = os.getenv('RTT_ROOT') or os.path.join('..', '..') sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')] @@ -9,11 +9,19 @@ from building import * TARGET = 'rtthread.' + rtconfig.TARGET_EXT +content = "" +with open("rtconfig.h") as f: + for line in f.readlines(): + if line.find("RT_BACKTRACE_FUNCTION_NAME") != -1: + for token in line.split(" "): + if re.match(r'RT_BACKTRACE_FUNCTION_NAME$', token, flags=0): + TRACE_CONFIG = " -mpoke-function-name" + DefaultEnvironment(tools=[]) env = Environment(tools = ['mingw'], - AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, - CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS, - CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, + AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS + TRACE_CONFIG, + CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS + TRACE_CONFIG, + CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS + TRACE_CONFIG, AR = rtconfig.AR, ARFLAGS = '-rc', LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) env.PrependENVPath('PATH', rtconfig.EXEC_PATH) diff --git a/bsp/imx6ull-artpi-smart/link_smart.lds b/bsp/imx6ull-artpi-smart/link_smart.lds index e9227757c8..a4caca0ac2 100644 --- a/bsp/imx6ull-artpi-smart/link_smart.lds +++ b/bsp/imx6ull-artpi-smart/link_smart.lds @@ -1,60 +1,97 @@ -OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") -OUTPUT_ARCH(arm) +/* + * File : link.lds + * COPYRIGHT (C) 2017, 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: + * 2017-5-30 bernard first version + */ + +/* _EL1_STACK_SIZE = DEFINED(_EL1_STACK_SIZE) ? _EL1_STACK_SIZE : 0x20000; */ + SECTIONS { - /*. = 0x80001000; */ . = 0xc0001000; - - __text_start = .; + . = ALIGN(4096); .text : { + KEEP(*(.text.entrypoint)) /* The entry point */ *(.vectors) - *(.text) - *(.text.*) + *(.text) /* remaining code */ + *(.text.*) /* remaining code */ - /* section information for utest */ - . = ALIGN(4); - __rt_utest_tc_tab_start = .; - KEEP(*(UtestTcTab)) - __rt_utest_tc_tab_end = .; + *(.rodata) /* read-only data (constants) */ + *(.rodata*) + *(.glue_7) + *(.glue_7t) + *(.gnu.linkonce.t*) + /* section information for finsh shell */ - . = ALIGN(4); + . = ALIGN(16); __fsymtab_start = .; KEEP(*(FSymTab)) __fsymtab_end = .; - . = ALIGN(4); + . = ALIGN(16); __vsymtab_start = .; KEEP(*(VSymTab)) __vsymtab_end = .; - . = ALIGN(4); + . = ALIGN(16); - /* section information for modules */ - . = ALIGN(4); - __rtmsymtab_start = .; - KEEP(*(RTMSymTab)) - __rtmsymtab_end = .; - - /* section information for initialization */ - . = ALIGN(4); + /* section information for initial. */ + . = ALIGN(16); __rt_init_start = .; KEEP(*(SORT(.rti_fn*))) __rt_init_end = .; - } =0 - __text_end = .; + . = ALIGN(16); - .ARM.exidx : - { + . = ALIGN(16); + _etext = .; + } + + .ARM.exidx : { __exidx_start = .; *(.ARM.exidx* .gnu.linkonce.armexidx.*) __exidx_end = .; } - __rodata_start = .; - .rodata : { *(.rodata) *(.rodata.*) } - __rodata_end = .; + .eh_frame_hdr : + { + *(.eh_frame_hdr) + *(.eh_frame_entry) + } + .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } + + . = ALIGN(16); + .data : + { + *(.data) + *(.data.*) - . = ALIGN(4); + *(.data1) + *(.data1.*) + + . = ALIGN(16); + _gp = ABSOLUTE(.); /* Base of small data */ + + *(.sdata) + *(.sdata.*) + } + + . = ALIGN(16); .ctors : { PROVIDE(__ctors_start__ = .); @@ -71,35 +108,19 @@ SECTIONS PROVIDE(__dtors_end__ = .); } - . = ALIGN(8); - __data_start = .; - .data : + . = ALIGN(16); + .bss : { - *(.data) - *(.data.*) + PROVIDE(__bss_start = .); + *(.bss) + *(.bss.*) + *(.dynbss) + + *(COMMON) + PROVIDE(__bss_end = .); } - __data_end = .; - - . = ALIGN(8); - __bss_start = .; - .bss : - { - *(.bss) - *(.bss.*) - *(COMMON) - . = ALIGN(4); - } - . = ALIGN(4); - __bss_end = .; - - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - _end = .; + } + +__bss_size = (__bss_end - __bss_start)>>3; diff --git a/bsp/imx6ull-artpi-smart/rtconfig.h b/bsp/imx6ull-artpi-smart/rtconfig.h index 16b2e2c296..c9ae158463 100644 --- a/bsp/imx6ull-artpi-smart/rtconfig.h +++ b/bsp/imx6ull-artpi-smart/rtconfig.h @@ -57,6 +57,7 @@ #define PV_OFFSET 0xc0000000 #define ARCH_ARM_CORTEX_A #define ARCH_ARM_CORTEX_A7 +#define ARCH_ARM_SECURE_MODE #define RT_BACKTRACE_FUNCTION_NAME /* RT-Thread Components */ @@ -287,7 +288,6 @@ /* miscellaneous packages */ - /* samples: kernel and components samples */ diff --git a/bsp/imx6ull-artpi-smart/rtconfig.py b/bsp/imx6ull-artpi-smart/rtconfig.py index 8d3f2c287f..2818ed86fc 100644 --- a/bsp/imx6ull-artpi-smart/rtconfig.py +++ b/bsp/imx6ull-artpi-smart/rtconfig.py @@ -23,7 +23,7 @@ if PLATFORM == 'gcc': STRIP = PREFIX + 'strip' CFPFLAGS = ' -msoft-float' AFPFLAGS = ' -mfloat-abi=softfp -mfpu=vfpv3-d16' - DEVICE = ' -march=armv7-a -mtune=cortex-a7 -ftree-vectorize -ffast-math' + DEVICE = ' -march=armv7-a -mtune=cortex-a7 -ftree-vectorize -ffast-math -funwind-tables -fno-strict-aliasing' CXXFLAGS= DEVICE + CFPFLAGS + ' -Wall' CFLAGS = DEVICE + CFPFLAGS + ' -Wall -std=gnu99' -- Gitee From e49c4b1f7f78350cbeae5bc9be718baae828b5f1 Mon Sep 17 00:00:00 2001 From: "@lin12345678" Date: Thu, 9 Sep 2021 10:04:33 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/imx6ull-artpi-smart/link_smart.lds | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/bsp/imx6ull-artpi-smart/link_smart.lds b/bsp/imx6ull-artpi-smart/link_smart.lds index a4caca0ac2..a53e1b61b8 100644 --- a/bsp/imx6ull-artpi-smart/link_smart.lds +++ b/bsp/imx6ull-artpi-smart/link_smart.lds @@ -1,24 +1,5 @@ -/* - * File : link.lds - * COPYRIGHT (C) 2017, 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: - * 2017-5-30 bernard first version - */ +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) /* _EL1_STACK_SIZE = DEFINED(_EL1_STACK_SIZE) ? _EL1_STACK_SIZE : 0x20000; */ -- Gitee From 954327bf7e908b730769dc00b136556836beaf07 Mon Sep 17 00:00:00 2001 From: "@lin12345678" Date: Thu, 9 Sep 2021 10:55:45 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/imx6ull-artpi-smart/link_smart.lds | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bsp/imx6ull-artpi-smart/link_smart.lds b/bsp/imx6ull-artpi-smart/link_smart.lds index a53e1b61b8..7483fe83d5 100644 --- a/bsp/imx6ull-artpi-smart/link_smart.lds +++ b/bsp/imx6ull-artpi-smart/link_smart.lds @@ -1,3 +1,12 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2021-09-09 linzhenxing first version + */ OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") OUTPUT_ARCH(arm) -- Gitee