From ac38532aebdab7bb0f6f9fdcb96be1a8bb118c97 Mon Sep 17 00:00:00 2001 From: liYony <941843540@qq.com> Date: Wed, 20 Mar 2024 21:46:32 +0800 Subject: [PATCH] [rt-smart][art-pi] update imx6ull-smart bsp --- bsp/nxp/imx/imx6ull-smart/.config | 1 + bsp/nxp/imx/imx6ull-smart/drivers/board.c | 7 +++- bsp/nxp/imx/imx6ull-smart/drivers/drv_sdio.c | 2 +- bsp/nxp/imx/imx6ull-smart/rtconfig.py | 35 +++++++++++--------- 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/bsp/nxp/imx/imx6ull-smart/.config b/bsp/nxp/imx/imx6ull-smart/.config index c22f23aec9..78dc560851 100644 --- a/bsp/nxp/imx/imx6ull-smart/.config +++ b/bsp/nxp/imx/imx6ull-smart/.config @@ -995,6 +995,7 @@ CONFIG_RT_USING_LDSO=y # CONFIG_PKG_USING_UKAL is not set # CONFIG_PKG_USING_DIGITALCTRL is not set # CONFIG_PKG_USING_KISSFFT is not set +# CONFIG_PKG_USING_CMSIS_DSP is not set # # miscellaneous packages diff --git a/bsp/nxp/imx/imx6ull-smart/drivers/board.c b/bsp/nxp/imx/imx6ull-smart/drivers/board.c index 8a77d5be09..d95362c591 100644 --- a/bsp/nxp/imx/imx6ull-smart/drivers/board.c +++ b/bsp/nxp/imx/imx6ull-smart/drivers/board.c @@ -104,14 +104,19 @@ void assert_handler(const char *ex_string, const char *func, rt_size_t line) void rt_hw_board_init(void) { #ifdef RT_USING_SMART + rt_uint32_t mmutable_p = 0; rt_hw_mmu_map_init(&rt_kernel_space, (void*)0xf0000000, 0x10000000, MMUTable, PV_OFFSET); - + rt_hw_init_mmu_table(platform_mem_desc, platform_mem_desc_size); + mmutable_p = (rt_uint32_t)MMUTable + (rt_uint32_t)PV_OFFSET ; + rt_hw_mmu_switch((void*)mmutable_p); rt_page_init(init_page_region); rt_hw_mmu_ioremap_init(&rt_kernel_space, (void*)0xf0000000, 0x10000000); arch_kuser_init(&rt_kernel_space, (void*)0xffff0000); #else rt_hw_mmu_map_init(&rt_kernel_space, (void*)0x80000000, 0x10000000, MMUTable, 0); + rt_hw_init_mmu_table(platform_mem_desc,platform_mem_desc_size); + rt_hw_mmu_init(); rt_hw_mmu_ioremap_init(&rt_kernel_space, (void*)0x80000000, 0x10000000); #endif diff --git a/bsp/nxp/imx/imx6ull-smart/drivers/drv_sdio.c b/bsp/nxp/imx/imx6ull-smart/drivers/drv_sdio.c index d5c483759d..8ece4418c5 100644 --- a/bsp/nxp/imx/imx6ull-smart/drivers/drv_sdio.c +++ b/bsp/nxp/imx/imx6ull-smart/drivers/drv_sdio.c @@ -52,7 +52,7 @@ /* Endian mode. */ #define USDHC_ENDIAN_MODE kUSDHC_EndianModeLittle -uint32_t g_usdhcAdma2Table[USDHC_ADMA_TABLE_WORDS]; +static uint32_t g_usdhcAdma2Table[USDHC_ADMA_TABLE_WORDS]; struct rt_mmcsd_host *host1; struct rt_mmcsd_host *host2; static rt_mutex_t mmcsd_mutex = RT_NULL; diff --git a/bsp/nxp/imx/imx6ull-smart/rtconfig.py b/bsp/nxp/imx/imx6ull-smart/rtconfig.py index ce6c3d61a0..42f8483971 100644 --- a/bsp/nxp/imx/imx6ull-smart/rtconfig.py +++ b/bsp/nxp/imx/imx6ull-smart/rtconfig.py @@ -5,12 +5,13 @@ ARCH ='arm' CPU ='cortex-a' CROSS_TOOL = 'gcc' PLATFORM = 'gcc' -EXEC_PATH = os.getenv('RTT_EXEC_PATH') or '/usr/bin' +EXEC_PATH = os.getenv('RTT_EXEC_PATH') or r'/usr/bin' BUILD = 'debug' +LINK_SCRIPT = 'link.lds' + if PLATFORM == 'gcc': - # toolchains - PREFIX = os.getenv('RTT_CC_PREFIX') or 'arm-linux-musleabi-' + PREFIX = os.getenv('RTT_CC_PREFIX') or 'arm-none-eabi-' CC = PREFIX + 'gcc' CXX = PREFIX + 'g++' AS = PREFIX + 'gcc' @@ -22,26 +23,30 @@ if PLATFORM == 'gcc': OBJCPY = PREFIX + 'objcopy' STRIP = PREFIX + 'strip' CFPFLAGS = ' -msoft-float' - AFPFLAGS = ' -mfloat-abi=softfp -mfpu=vfpv3-d16' - DEVICE = ' -march=armv7-a -mtune=cortex-a7 -ftree-vectorize -ffast-math -funwind-tables -fno-strict-aliasing -fcommon' + AFPFLAGS = ' -mfloat-abi=softfp -mfpu=neon' + 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' - AFLAGS = DEVICE + ' -c' + AFPFLAGS + ' -x assembler-with-cpp -D__ASSEMBLY__' - LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,system_vectors -T link.lds' + ' -lgcc' + CXXFLAGS= DEVICE + CFPFLAGS + ' -Wall -fdiagnostics-color=always' + CFLAGS = DEVICE + CFPFLAGS + ' -Wall -Wno-cpp -std=gnu99 -D_POSIX_SOURCE -fdiagnostics-color=always' + AFLAGS = DEVICE + ' -c' + AFPFLAGS + ' -x assembler-with-cpp' + LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,system_vectors -T '+ LINK_SCRIPT + ' -lsupc++ -lgcc -static' CPATH = '' LPATH = '' if BUILD == 'debug': - CFLAGS += ' -O0 -gdwarf-2' + ' -Wno-unused-function' + CFLAGS += ' -O0 -gdwarf-2' CXXFLAGS += ' -O0 -gdwarf-2' AFLAGS += ' -gdwarf-2' else: CFLAGS += ' -Os' CXXFLAGS += ' -Os' - CXXFLAGS += ' -Woverloaded-virtual -fno-exceptions -fno-rtti' - MKIMAGE = '-t imximage -b rtthread.bin -o rtthread.imx -g rtthread.img -a 0x80001000' + CXXFLAGS += ' -Woverloaded-virtual -fno-rtti' -DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtt.asm\n' -POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' +\ - 'python3 mkimage.py ' + MKIMAGE + '\n' + M_CFLAGS = CFLAGS + ' -mlong-calls -fPIC ' + M_CXXFLAGS = CXXFLAGS + ' -mlong-calls -fPIC' + M_LFLAGS = DEVICE + CXXFLAGS + ' -Wl,--gc-sections,-z,max-page-size=0x4' +\ + ' -shared -fPIC -nostartfiles -nostdlib -static-libgcc' + M_POST_ACTION = STRIP + ' -R .hash $TARGET\n' + SIZE + ' $TARGET \n' + + DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtt.asm\n' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'