From 0a4abb8f9450d0a2ae986910a3b091087843cdb8 Mon Sep 17 00:00:00 2001 From: SummerGift Date: Mon, 3 Dec 2018 18:43:13 +0800 Subject: [PATCH] [bsp][STM32] update linker_scripts for stm32 bsp --- bsp/stm32/stm32f407-atk-explorer/.config | 28 +++++++++++++------ bsp/stm32/stm32f407-atk-explorer/README.md | 2 +- .../stm32f407-atk-explorer/board/board.h | 19 +++++++++---- .../board/linker_scripts/stm32f4xx.icf | 4 +-- .../board/linker_scripts/stm32f4xx.ld | 6 ++-- .../board/linker_scripts/stm32f4xx.sct | 2 +- bsp/stm32/stm32f407-atk-explorer/project.ewd | 14 +++++----- bsp/stm32/stm32f407-atk-explorer/rtconfig.h | 11 ++++++-- bsp/stm32/stm32f429-atk-apollo/README.md | 2 +- bsp/stm32/stm32f429-atk-apollo/board/board.h | 19 +++++++++---- .../board/linker_scripts/stm32f4xx.icf | 4 +-- .../board/linker_scripts/stm32f4xx.ld | 6 ++-- .../board/linker_scripts/stm32f4xx.sct | 2 +- bsp/stm32/stm32f429-fire-challenger/README.md | 3 +- .../stm32f429-fire-challenger/board/board.h | 19 +++++++++---- .../board/linker_scripts/stm32f4xx.icf | 4 +-- .../board/linker_scripts/stm32f4xx.ld | 6 ++-- .../board/linker_scripts/stm32f4xx.sct | 2 +- 18 files changed, 95 insertions(+), 58 deletions(-) diff --git a/bsp/stm32/stm32f407-atk-explorer/.config b/bsp/stm32/stm32f407-atk-explorer/.config index cf0c20d823..4f44d6b3af 100644 --- a/bsp/stm32/stm32f407-atk-explorer/.config +++ b/bsp/stm32/stm32f407-atk-explorer/.config @@ -7,6 +7,7 @@ # RT-Thread Kernel # CONFIG_RT_NAME_MAX=8 +# CONFIG_RT_USING_SMP is not set CONFIG_RT_ALIGN_SIZE=4 # CONFIG_RT_THREAD_PRIORITY_8 is not set CONFIG_RT_THREAD_PRIORITY_32=y @@ -15,6 +16,7 @@ CONFIG_RT_THREAD_PRIORITY_MAX=32 CONFIG_RT_TICK_PER_SECOND=1000 CONFIG_RT_USING_OVERFLOW_CHECK=y CONFIG_RT_USING_HOOK=y +CONFIG_RT_USING_IDLE_HOOK=y CONFIG_RT_IDEL_HOOK_LIST_SIZE=4 CONFIG_IDLE_THREAD_STACK_SIZE=1024 # CONFIG_RT_USING_TIMER_SOFT is not set @@ -63,6 +65,7 @@ CONFIG_RT_CONSOLE_DEVICE_NAME="uart1" CONFIG_ARCH_ARM=y CONFIG_ARCH_ARM_CORTEX_M=y CONFIG_ARCH_ARM_CORTEX_M4=y +# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set # # RT-Thread Components @@ -112,10 +115,12 @@ CONFIG_RT_USING_SERIAL=y # CONFIG_RT_USING_CPUTIME is not set # CONFIG_RT_USING_I2C is not set CONFIG_RT_USING_PIN=y +# CONFIG_RT_USING_ADC is not set # CONFIG_RT_USING_PWM is not set # CONFIG_RT_USING_MTD_NOR is not set # CONFIG_RT_USING_MTD_NAND is not set # CONFIG_RT_USING_MTD is not set +# CONFIG_RT_USING_PM is not set # CONFIG_RT_USING_RTC is not set # CONFIG_RT_USING_SDIO is not set # CONFIG_RT_USING_SPI is not set @@ -173,6 +178,7 @@ CONFIG_RT_USING_PIN=y # # CONFIG_RT_USING_LOGTRACE is not set # CONFIG_RT_USING_RYM is not set +# CONFIG_RT_USING_ULOG is not set # # ARM CMSIS @@ -245,7 +251,6 @@ CONFIG_RT_USING_PIN=y # # CONFIG_PKG_USING_OPENMV is not set # CONFIG_PKG_USING_MUPDF is not set -# CONFIG_PKG_USING_BEEPPLAYER is not set # # tools packages @@ -273,6 +278,7 @@ CONFIG_RT_USING_PIN=y # CONFIG_PKG_USING_LITTLEVGL2RTT is not set # CONFIG_PKG_USING_CMSIS is not set # CONFIG_PKG_USING_DFS_YAFFS is not set +# CONFIG_PKG_USING_LITTLEFS is not set # # peripheral libraries and drivers @@ -329,22 +335,28 @@ CONFIG_SOC_STM32F407ZG=y # # Onboard Peripheral Drivers # +CONFIG_BSP_USING_USB_TO_USART=y +# CONFIG_BSP_USING_SPI_FLASH is not set +# CONFIG_BSP_USING_COM3 is not set +# CONFIG_BSP_USING_EEPROM is not set # CONFIG_BSP_USING_ETH is not set # CONFIG_BSP_USING_MPU6050 is not set -# -# Offboard Peripheral Drivers -# - # # On-chip Peripheral Drivers # CONFIG_BSP_USING_GPIO=y -CONFIG_BSP_USING_UART=y CONFIG_BSP_USING_UART1=y # CONFIG_BSP_USING_UART2 is not set # CONFIG_BSP_USING_UART3 is not set # CONFIG_BSP_USING_UART6 is not set # CONFIG_BSP_UART_USING_DMA_RX is not set -# CONFIG_BSP_USING_SPI is not set -# CONFIG_BSP_USING_I2C is not set +# CONFIG_BSP_USING_SPI1 is not set +# CONFIG_BSP_USING_SPI2 is not set +# CONFIG_BSP_USING_SPI3 is not set +# CONFIG_BSP_SPI_USING_DMA is not set +# CONFIG_BSP_USING_I2C1 is not set + +# +# Board extended module Drivers +# diff --git a/bsp/stm32/stm32f407-atk-explorer/README.md b/bsp/stm32/stm32f407-atk-explorer/README.md index 6f3c4ed1d9..ce02da58d9 100644 --- a/bsp/stm32/stm32f407-atk-explorer/README.md +++ b/bsp/stm32/stm32f407-atk-explorer/README.md @@ -116,7 +116,7 @@ msh > ## 注意事项 -- STM32F407 有两块 RAM:RAM1(0x20000000,128K) 、RAM2(0x10000000,64K) ,本 BSP 将 RT-Thread HEAP 放到了 RAM1,将 RW 段数据放到了 RAM2(此地址空间不能使用 DMA 传输)。因此,如需使用 DMA 功能需使用 `rt_malloc/rt_calloc` 函数为缓冲区分配 RAM1 的空间。 +暂无 ## 联系人信息 diff --git a/bsp/stm32/stm32f407-atk-explorer/board/board.h b/bsp/stm32/stm32f407-atk-explorer/board/board.h index 49d5e8eb09..365474e9e6 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/board.h +++ b/bsp/stm32/stm32f407-atk-explorer/board/board.h @@ -22,12 +22,21 @@ #define LED1_PIN GET_PIN(F, 10) #endif -#define STM32_SRAM1_SIZE (128) -#define STM32_SRAM1_START (0x20000000) -#define STM32_SRAM1_END (STM32_SRAM1_START + STM32_SRAM1_SIZE * 1024) +#define STM32_SRAM_SIZE (128) +#define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#define HEAP_BEGIN STM32_SRAM1_START -#define HEAP_END STM32_SRAM1_END +#ifdef __CC_ARM +extern int Image$$RW_IRAM1$$ZI$$Limit; +#define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) +#elif __ICCARM__ +#pragma section="CSTACK" +#define HEAP_BEGIN (__segment_end("CSTACK")) +#else +extern int __bss_end; +#define HEAP_BEGIN ((void *)&__bss_end) +#endif + +#define HEAP_END STM32_SRAM_END void SystemClock_Config(void); void MX_GPIO_Init(void); diff --git a/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/stm32f4xx.icf b/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/stm32f4xx.icf index bf03328e9f..66c522a006 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/stm32f4xx.icf +++ b/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/stm32f4xx.icf @@ -18,7 +18,6 @@ define symbol __ICFEDIT_size_heap__ = 0x0000; define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM1_region = mem:[from __ICFEDIT_region_RAM1_start__ to __ICFEDIT_region_RAM1_end__]; -define region RAM2_region = mem:[from __ICFEDIT_region_RAM2_start__ to __ICFEDIT_region_RAM2_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; @@ -28,5 +27,4 @@ do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; -place in RAM1_region { section .sram }; -place in RAM2_region { readwrite, block CSTACK}; +place in RAM1_region { readwrite, last block CSTACK }; diff --git a/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/stm32f4xx.ld b/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/stm32f4xx.ld index 119a2411df..fb96952f93 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/stm32f4xx.ld +++ b/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/stm32f4xx.ld @@ -78,7 +78,7 @@ SECTIONS . = ALIGN(4); /* This is used by the startup in order to initialize the .data secion */ _edata = . ; - } >RAM2 + } >RAM1 .stack : { @@ -87,7 +87,7 @@ SECTIONS . = . + _system_stack_size; . = ALIGN(4); _estack = .; - } >RAM2 + } >RAM1 __bss_start = .; .bss : @@ -105,7 +105,7 @@ SECTIONS _ebss = . ; *(.bss.init) - } > RAM2 + } > RAM1 __bss_end = .; _end = .; diff --git a/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/stm32f4xx.sct b/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/stm32f4xx.sct index 6ffd63bb31..0d7c47992d 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/stm32f4xx.sct +++ b/bsp/stm32/stm32f407-atk-explorer/board/linker_scripts/stm32f4xx.sct @@ -8,7 +8,7 @@ LR_IROM1 0x08000000 0x00100000 { ; load region size_region *(InRoot$$Sections) .ANY (+RO) } - RW_IRAM2 0x10000000 0x00010000 { ; RW data + RW_IRAM1 0x20000000 0x00020000 { ; RW data .ANY (+RW +ZI) } } diff --git a/bsp/stm32/stm32f407-atk-explorer/project.ewd b/bsp/stm32/stm32f407-atk-explorer/project.ewd index f3a24deb65..ea50b29bba 100644 --- a/bsp/stm32/stm32f407-atk-explorer/project.ewd +++ b/bsp/stm32/stm32f407-atk-explorer/project.ewd @@ -2,7 +2,7 @@ 3 - Debug + rt-thread ARM @@ -80,7 +80,7 @@