Skip to content

Commit 7e003b2

Browse files
committed
修改相关sram名称为external sram;
1 parent 8b11bfd commit 7e003b2

File tree

5 files changed

+38
-36
lines changed

5 files changed

+38
-36
lines changed

bsp/stm32/libraries/STM32F1xx_HAL/SConscript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ if GetDepend(['RT_USING_MTD_NOR']):
7474
if GetDepend(['RT_USING_MTD_NAND']):
7575
src += ['STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_nand.c']
7676

77-
if GetDepend(['BSP_USING_SRAM']):
77+
if GetDepend(['BSP_USING_EXT_SRAM']):
7878
src += ['STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_fsmc.c']
7979
src += ['STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_sram.c']
8080

bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ menu "Onboard Peripheral Drivers"
3434
select BSP_USING_ADC1
3535
default n
3636

37-
config BSP_USING_SRAM
38-
bool "Enable SRAM. Chip name is IS62WV51216, 1Mbytes static RAMs organized as 512K words by 16bits."
37+
config BSP_USING_EXT_SRAM
38+
bool "Enable external sram"
3939
default n
40+
help
41+
Chip name is IS62WV51216, 1Mbytes static RAMs organized as 512K words by 16bits.
4042

4143
endmenu
4244

bsp/stm32/stm32f103-atk-warshipv3/board/SConscript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ board.c
1212
CubeMX_Config/Src/stm32f1xx_hal_msp.c
1313
''')
1414

15-
if GetDepend(['BSP_USING_SRAM']):
15+
if GetDepend(['BSP_USING_EXT_SRAM']):
1616
src += Glob('ports/drv_sram.c')
1717

1818
path = [cwd]

bsp/stm32/stm32f103-atk-warshipv3/board/ports/drv_sram.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
#include <rtdevice.h>
1313
#include <board.h>
1414

15-
#ifdef BSP_USING_SRAM
15+
#ifdef BSP_USING_EXT_SRAM
1616
#include <sram_port.h>
1717

1818
#define DRV_DEBUG
19-
#define LOG_TAG "drv.sram"
19+
#define LOG_TAG "drv.ext_sram"
2020
#include <drv_log.h>
2121

2222
static SRAM_HandleTypeDef hsram1;
2323
#ifdef RT_USING_MEMHEAP_AS_HEAP
2424
static struct rt_memheap system_heap;
2525
#endif
2626

27-
static int sram_init(void)
27+
static int external_sram_init(void)
2828
{
2929
int result = RT_EOK;
3030

@@ -39,9 +39,9 @@ static int sram_init(void)
3939
hsram1.Init.NSBank = FSMC_NORSRAM_BANK3;
4040
hsram1.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE;
4141
hsram1.Init.MemoryType = FSMC_MEMORY_TYPE_SRAM;
42-
#if SRAM_DATA_WIDTH == 8
42+
#if EXTERNAL_SRAM_DATA_WIDTH == 8
4343
hsram1.Init.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_8;
44-
#elif SRAM_DATA_WIDTH == 16
44+
#elif EXTERNAL_SRAM_DATA_WIDTH == 16
4545
hsram1.Init.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_16;
4646
#else
4747
hsram1.Init.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_32;
@@ -69,15 +69,15 @@ static int sram_init(void)
6969
/* Initialize the SRAM controller */
7070
if (HAL_SRAM_Init(&hsram1, &Timing, NULL) != HAL_OK)
7171
{
72-
LOG_E("SRAM init failed!");
72+
LOG_E("External SRAM init failed!");
7373
result = -RT_ERROR;
7474
}
7575
else
7676
{
77-
LOG_D("sram init success, mapped at 0x%X, size is %d bytes, data width is %d", SRAM_BANK_ADDR, SRAM_SIZE, SRAM_DATA_WIDTH);
77+
LOG_D("External sram init success, mapped at 0x%X, size is %d bytes, data width is %d", EXTERNAL_SRAM_BANK_ADDR, EXTERNAL_SRAM_SIZE, EXTERNAL_SRAM_DATA_WIDTH);
7878
#ifdef RT_USING_MEMHEAP_AS_HEAP
7979
/* If RT_USING_MEMHEAP_AS_HEAP is enabled, SRAM is initialized to the heap */
80-
rt_memheap_init(&system_heap, "sram", (void *)SRAM_BANK_ADDR, SRAM_SIZE);
80+
rt_memheap_init(&system_heap, "ext_sram", (void *)EXTERNAL_SRAM_BANK_ADDR, EXTERNAL_SRAM_SIZE);
8181
#endif
8282
}
8383

@@ -88,36 +88,36 @@ static int sram_init(void)
8888

8989
return result;
9090
}
91-
INIT_BOARD_EXPORT(sram_init);
91+
INIT_BOARD_EXPORT(external_sram_init);
9292

9393
#ifdef DRV_DEBUG
9494
#ifdef FINSH_USING_MSH
95-
int sram_test(void)
95+
int external_sram_test(void)
9696
{
9797
int i = 0;
9898
uint32_t start_time = 0, time_cast = 0;
99-
#if SRAM_DATA_WIDTH == 8
99+
#if EXTERNAL_SRAM_DATA_WIDTH == 8
100100
char data_width = 1;
101101
uint8_t data = 0;
102-
uint8_t *ptr = (uint8_t *)SRAM_BANK_ADDR;
103-
#elif SRAM_DATA_WIDTH == 16
102+
uint8_t *ptr = (uint8_t *)EXTERNAL_SRAM_BANK_ADDR;
103+
#elif EXTERNAL_SRAM_DATA_WIDTH == 16
104104
char data_width = 2;
105105
uint16_t data = 0;
106-
uint16_t *ptr = (uint16_t *)SRAM_BANK_ADDR;
106+
uint16_t *ptr = (uint16_t *)EXTERNAL_SRAM_BANK_ADDR;
107107
#else
108108
char data_width = 4;
109109
uint32_t data = 0;
110-
uint32_t *ptr = (uint32_t *)SRAM_BANK_ADDR;
110+
uint32_t *ptr = (uint32_t *)EXTERNAL_SRAM_BANK_ADDR;
111111
#endif
112112

113113
/* write data */
114-
LOG_D("Writing the %ld bytes data, waiting....", SRAM_SIZE);
114+
LOG_D("Writing the %ld bytes data, waiting....", EXTERNAL_SRAM_SIZE);
115115
start_time = rt_tick_get();
116-
for (i = 0; i < SRAM_SIZE / data_width; i++)
116+
for (i = 0; i < EXTERNAL_SRAM_SIZE / data_width; i++)
117117
{
118-
#if SRAM_DATA_WIDTH == 8
118+
#if EXTERNAL_SRAM_DATA_WIDTH == 8
119119
((__IO uint8_t *)ptr)[i] = (uint8_t)0x55;
120-
#elif SRAM_DATA_WIDTH == 16
120+
#elif EXTERNAL_SRAM_DATA_WIDTH == 16
121121
((__IO uint16_t *)ptr)[i] = (uint16_t)0x5555;
122122
#else
123123
((__IO uint32_t *)ptr)[i] = (uint32_t)0x55555555;
@@ -129,40 +129,40 @@ int sram_test(void)
129129

130130
/* read data */
131131
LOG_D("start Reading and verifying data, waiting....");
132-
for (i = 0; i < SRAM_SIZE / data_width; i++)
132+
for (i = 0; i < EXTERNAL_SRAM_SIZE / data_width; i++)
133133
{
134-
#if SRAM_DATA_WIDTH == 8
134+
#if EXTERNAL_SRAM_DATA_WIDTH == 8
135135
data = ((__IO uint8_t *)ptr)[i];
136136
if (data != 0x55)
137137
{
138-
LOG_E("SRAM test failed!");
138+
LOG_E("External SRAM test failed!");
139139
break;
140140
}
141-
#elif SRAM_DATA_WIDTH == 16
141+
#elif EXTERNAL_SRAM_DATA_WIDTH == 16
142142
data = ((__IO uint16_t *)ptr)[i];
143143
if (data != 0x5555)
144144
{
145-
LOG_E("SRAM test failed!");
145+
LOG_E("External SRAM test failed!");
146146
break;
147147
}
148148
#else
149149
data = ((__IO uint32_t *)ptr)[i];
150150
if (data != 0x55555555)
151151
{
152-
LOG_E("SRAM test failed!");
152+
LOG_E("External SRAM test failed!");
153153
break;
154154
}
155155
#endif
156156
}
157157

158-
if (i >= SRAM_SIZE / data_width)
158+
if (i >= EXTERNAL_SRAM_SIZE / data_width)
159159
{
160-
LOG_D("SRAM test success!");
160+
LOG_D("External SRAM test success!");
161161
}
162162

163163
return RT_EOK;
164164
}
165-
MSH_CMD_EXPORT(sram_test, sram test);
165+
MSH_CMD_EXPORT(external_sram_test, sram test);
166166
#endif /* FINSH_USING_MSH */
167167
#endif /* DRV_DEBUG */
168-
#endif /* BSP_USING_SRAM */
168+
#endif /* BSP_USING_EXT_SRAM */

bsp/stm32/stm32f103-atk-warshipv3/board/ports/include/sram_port.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
/* parameters for sdram peripheral */
1515
/* stm32f1 Bank1:0x68000000 */
16-
#define SRAM_BANK_ADDR ((uint32_t)0x68000000)
16+
#define EXTERNAL_SRAM_BANK_ADDR ((uint32_t)0x68000000)
1717
/* data width: 8, 16, 32 */
18-
#define SRAM_DATA_WIDTH 16
18+
#define EXTERNAL_SRAM_DATA_WIDTH 16
1919
/* sram size */
20-
#define SRAM_SIZE ((uint32_t)0x100000)
20+
#define EXTERNAL_SRAM_SIZE ((uint32_t)0x100000)
2121

2222
#endif

0 commit comments

Comments
 (0)