关于lowlevel_init函数的理解

本文详细解析了lowlevel_init.S中的代码,该函数涉及内存控制器配置,如Bank0~Bank7的设置,包括数据总线宽度、等待状态和功能。通过设置存储器寄存器,为加载Bootloader的第二阶段代码准备RAM空间,确保内存芯片的正确初始化。内容主要针对s3c2440芯片和友善之臂mini2440开发板,涉及存储地址分配和芯片型号。
摘要由CSDN通过智能技术生成
我迷迷糊学看了lowlevel_init.S中的代码之后,有一个感觉就是,要想读懂其中的代码首先得看一下你所用的芯片手册,因为里面有比较详细的存储器控制(MemoryController)描述。我用的是s3c2440手册里写得十分清楚,总共有8个块(Banks)(Bank0~Bank7),每个块对应着不同的控制与地址线,其实这些Bank很大一部分是对应着的控制寄存器的地址,这个要看实际的芯片与板子,看了下面的理解估计会有个大概。 第二,就是要清楚你的板子上对的存储地址的分配,一般板子手册上都会有的。我的开发板是友善之臂的mini2440(不是很富裕只能买一些平民板子),在它的手册里写有SDRAM存储系统与FLASH系统的介绍包括芯片型号,存储大小,这些都是后面移植要注意,毕竟U-boot的移植就是对硬件支持的修改。mini2440的SDRAM使用两片32M bytes总共64M bytes型号为HY57V561620FTP芯片,地址空间为0x30000000~0x34000000 进入正题: /* * Memory Setup stuff - taken from blob memsetup.S * * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) and * Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl) * * Modified for the Samsung SMDK2410 by * (C) Copyright 2002 * David Mueller, ELSOFT AG, * * See file CREDITS for list of people who contributed to this * project. * * 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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
void MX_GPIO_Init(void) { GPIO_InitTypeDef GPIO_InitStruct = {0}; /* GPIO Ports Clock Enable */ __HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(GPIOA, Motor_IN4_Pin|Motor_IN3_Pin, GPIO_PIN_RESET); /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(GPIOB, Motor_IN7_Pin|Motor_IN8_Pin|Trig_Pin|Motor_IN5_Pin |Motor_IN6_Pin|Motor_IN2_Pin|Motor_IN1_Pin, GPIO_PIN_RESET); /*Configure GPIO pins : PAPin PAPin */ GPIO_InitStruct.Pin = Motor_IN4_Pin|Motor_IN3_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); /*Configure GPIO pins : PAPin PAPin PAPin */ GPIO_InitStruct.Pin = IR_3_Pin|IR_4_Pin|IR_Pin; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); /*Configure GPIO pins : PBPin PBPin PBPin PBPin PBPin PBPin PBPin */ GPIO_InitStruct.Pin = Motor_IN7_Pin|Motor_IN8_Pin|Trig_Pin|Motor_IN5_Pin |Motor_IN6_Pin|Motor_IN2_Pin|Motor_IN1_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); /*Configure GPIO pin : PtPin */ GPIO_InitStruct.Pin = Echo_Pin; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_PULLUP; HAL_GPIO_Init(Echo_GPIO_Port, &GPIO_InitStruct); /*Configure GPIO pins : PBPin PBPin */ GPIO_InitStruct.Pin = IR_2_Pin|IR_1_Pin; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); }
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值