初级会员

- 积分
- 153
- 金钱
- 153
- 注册时间
- 2019-9-25
- 在线时间
- 65 小时
|
20金钱
使用正点原子stm32F429开发板,内部ram不够用,想在外部的sdram定义并初始化全局变量数组。已经在system.stm32f4xx.c的SystemInit初始化了sdram,并在main函数中,将数组定义在外部sdram的地址。硬件仿真发现数组中的值和初始化的不同显示乱码,但后续给数组赋值是可以的,想请教有什么问题?
- void SystemInit(void)
- {
- /* FPU settings ------------------------------------------------------------*/
- #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
- SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
- #endif
- /* Reset the RCC clock configuration to the default reset state ------------*/
- /* Set HSION bit */
- RCC->CR |= (uint32_t)0x00000001;
- /* Reset CFGR register */
- RCC->CFGR = 0x00000000;
- /* Reset HSEON, CSSON and PLLON bits */
- RCC->CR &= (uint32_t)0xFEF6FFFF;
- /* Reset PLLCFGR register */
- RCC->PLLCFGR = 0x24003010;
- /* Reset HSEBYP bit */
- RCC->CR &= (uint32_t)0xFFFBFFFF;
- /* Disable all interrupts */
- RCC->CIR = 0x00000000;
- #if defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM)
- SystemInit_ExtMemCtl();
- #endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
- /* Configure the Vector Table location add offset address ------------------*/
- #ifdef VECT_TAB_SRAM
- SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
- #else
- SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
- #endif
- HAL_Init(); //初始化HAL库
- Stm32_Clock_Init(360,25,2,8); //设置时钟,180Mhz
- delay_init(180); //初始化延时函数
- SDRAM_Init(); //初始化SDRAM
- }
复制代码- u16 testsram[10] __attribute__((at(0XC0000000))) = {0x01, 0x02};
复制代码
|
-
函数中数组可以正常赋值
-
进入main函数数组的值和定义的不同
|