STM32存储左右互搏 SDIO总线读写SD/MicroSD/TF卡

STM32存储左右互搏 SDIO总线读写SD/MicroSD/TF卡

SD/MicroSD/TF卡是基于FLASH的一种常见非易失存储单元,由接口协议电路和FLASH构成。市面上由不同尺寸和不同容量的卡,手机领域用的TF卡实际就是MicroSD卡,尺寸比SD卡小,而电路和协议操作则是一样。这里介绍STM32CUBEIDE开发平台HAL库SDIO总线操作SD/MicroSD/TF卡的例程。

SD/MicroSD/TF卡访问接口

SD/MicroSD/TF卡可以通过访问更快的SDIO专用协议接口或是访问慢一些的普通SPI接口进行操作,两种协议接口复用管脚。通过SDIO访问的接口连接方式如下:
在这里插入图片描述
其中CMD连接用于指示发送的是命令还是数据。CLK提供访问同步时钟,4根数据线(DATA0 ~ DATA3 )则实现信息双向传输。
SDIO可以操作在1bit数据线和4bit数据线模式,因为4bit数据线明显效率高于1bit数据线模式,所以1bit数据线模式很少用,只有在某种极限节省连接资源的情况下可以用1bit数据线模式,在1bit模式下,数据线DATA0用来传输数据,DATA1用作中断。在4bit数据线模式下,数据线DATA0~DATA3用于传输数据,其中DATA1复用作中断线。

例程采用STM32F103VET6芯片对4GB的TF卡进行操作,TF卡也可以插入转换卡套插入SD卡接口。

STM32工程配置

首先建立基本工程并设置时钟:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
配置SDIO接口:
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
配置使用DMA, 优先级可以根据需要调整:
在这里插入图片描述
配置UART1作为控制和打印输出接口:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
保存并生成初始工程代码:
在这里插入图片描述

STM32工程代码

UART串口printf打印输出实现参考:STM32 UART串口printf函数应用及浮点打印代码空间节省 (HAL)

对SD/MicroSD/TF卡的SDIO接口操作可以调用HAL库函数进行,代码实现在main.c文件里,实现如下功能:

  1. 串口收到0x01指令,查询SD/MicroSD/TF卡容量等信息
  2. 串口收到0x02指令,执行特定区域(块0)的擦除
  3. 串口收到0x03指令,阻塞模式执行写操作
  4. 串口收到0x04指令,阻塞模式执行读操作
  5. 串口收到0x05指令,中断模式执行写操作
  6. 串口收到0x06指令,中断模式执行读操作
  7. 串口收到0x07指令,DMA模式执行写操作
  8. 串口收到0x08指令,DMA模式执行读操作

完整的main.c代码如下:

/* USER CODE BEGIN Header */
/********************************************************************************* @file           : main.c* @brief          : Main program body******************************************************************************* @attention** Copyright (c) 2022 STMicroelectronics.* All rights reserved.** This software is licensed under terms that can be found in the LICENSE file* in the root directory of this software component.* If no LICENSE file comes with this software, it is provided AS-IS.********************************************************************************/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "string.h"
#include "usart.h"
/* USER CODE END Includes *//* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
__IO float usDelayBase;
void PY_usDelayTest(void)
{__IO uint32_t firstms, secondms;__IO uint32_t counter = 0;firstms = HAL_GetTick()+1;secondms = firstms+1;while(uwTick!=firstms) ;while(uwTick!=secondms) counter++;usDelayBase = ((float)counter)/1000;
}void PY_Delay_us_t(uint32_t Delay)
{__IO uint32_t delayReg;__IO uint32_t usNum = (uint32_t)(Delay*usDelayBase);delayReg = 0;while(delayReg!=usNum) delayReg++;
}void PY_usDelayOptimize(void)
{__IO uint32_t firstms, secondms;__IO float coe = 1.0;firstms = HAL_GetTick();PY_Delay_us_t(1000000) ;secondms = HAL_GetTick();coe = ((float)1000)/(secondms-firstms);usDelayBase = coe*usDelayBase;
}void PY_Delay_us(uint32_t Delay)
{__IO uint32_t delayReg;__IO uint32_t msNum = Delay/1000;__IO uint32_t usNum = (uint32_t)((Delay%1000)*usDelayBase);if(msNum>0) HAL_Delay(msNum);delayReg = 0;while(delayReg!=usNum) delayReg++;
}
/* USER CODE END PTD *//* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
//#define BLOCKSIZE   512U /*!< Block size is 512 bytes */
#define BLOCK_START_ADDR 0 /* Block start address */
#define NUM_OF_BLOCKS 1 /* Total number of blocks */
#define BUFFER_WORDS_SIZE ((BLOCKSIZE * NUM_OF_BLOCKS) >> 2) /* Total data size in bytes *//* USER CODE END PD *//* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
/* USER CODE END PM *//* Private variables ---------------------------------------------------------*/
SD_HandleTypeDef hsd;
DMA_HandleTypeDef hdma_sdio;UART_HandleTypeDef huart1;/* USER CODE BEGIN PV */
uint8_t uart1_rxd[256];
uint8_t uart1_txd[256];
uint8_t cmd;/* USER CODE END PV *//* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_DMA_Init(void);
static void MX_SDIO_SD_Init(void);
static void MX_USART1_UART_Init(void);
/* USER CODE BEGIN PFP *//* USER CODE END PFP *//* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
uint8_t SD_Buffer_Tx[512] = {0} ;
uint8_t SD_Buffer_Rx[512] = {0};uint32_t SD_Status = 0;
uint32_t SD_Rx_Int = 0;
uint32_t SD_Tx_Int = 0;void SD_DMA_INIT_M2P(SD_HandleTypeDef* hsd) //DMA init: memory --> peripheral
{HAL_DMA_DeInit(&hdma_sdio);/* SDIO DMA Init *//* SDIO Init */hdma_sdio.Instance = DMA2_Channel4;hdma_sdio.Init.Direction = DMA_MEMORY_TO_PERIPH;hdma_sdio.Init.PeriphInc = DMA_PINC_DISABLE;hdma_sdio.Init.MemInc = DMA_MINC_ENABLE;hdma_sdio.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;hdma_sdio.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;hdma_sdio.Init.Mode = DMA_NORMAL;hdma_sdio.Init.Priority = DMA_PRIORITY_LOW;if (HAL_DMA_Init(&hdma_sdio) != HAL_OK){Error_Handler();}/* Several peripheral DMA handle pointers point to the same DMA handle.Be aware that there is only one channel to perform all the requested DMAs. *//* Be sure to change transfer direction before callingHAL_SD_ReadBlocks_DMA or HAL_SD_WriteBlocks_DMA. */__HAL_LINKDMA(hsd,hdmarx,hdma_sdio);__HAL_LINKDMA(hsd,hdmatx,hdma_sdio);
}void SD_DMA_INIT_P2M(SD_HandleTypeDef* hsd) //DMA init: memory <-- peripheral
{HAL_DMA_DeInit(&hdma_sdio);/* SDIO DMA Init *//* SDIO Init */hdma_sdio.Instance = DMA2_Channel4;hdma_sdio.Init.Direction = DMA_PERIPH_TO_MEMORY;hdma_sdio.Init.PeriphInc = DMA_PINC_DISABLE;hdma_sdio.Init.MemInc = DMA_MINC_ENABLE;hdma_sdio.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;hdma_sdio.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;hdma_sdio.Init.Mode = DMA_NORMAL;hdma_sdio.Init.Priority = DMA_PRIORITY_LOW;if (HAL_DMA_Init(&hdma_sdio) != HAL_OK){Error_Handler();}/* Several peripheral DMA handle pointers point to the same DMA handle.Be aware that there is only one channel to perform all the requested DMAs. *//* Be sure to change transfer direction before callingHAL_SD_ReadBlocks_DMA or HAL_SD_WriteBlocks_DMA. */__HAL_LINKDMA(hsd,hdmarx,hdma_sdio);__HAL_LINKDMA(hsd,hdmatx,hdma_sdio);
}
/* USER CODE END 0 *//*** @brief  The application entry point.* @retval int*/
int main(void)
{/* USER CODE BEGIN 1 *//* USER CODE END 1 *//* MCU Configuration--------------------------------------------------------*//* Reset of all peripherals, Initializes the Flash interface and the Systick. */HAL_Init();/* USER CODE BEGIN Init *//* USER CODE END Init *//* Configure the system clock */SystemClock_Config();/* USER CODE BEGIN SysInit *//* USER CODE END SysInit *//* Initialize all configured peripherals */MX_GPIO_Init();MX_DMA_Init();MX_SDIO_SD_Init();MX_USART1_UART_Init();/* USER CODE BEGIN 2 */PY_usDelayTest();PY_usDelayOptimize();HAL_UART_Receive_IT(&huart1, uart1_rxd, 1);/* USER CODE END 2 *//* Infinite loop *//* USER CODE BEGIN WHILE */while (1){/*HAL_SD_CARD_TRANSFER is the operate correct and complete status for SD card operation*/if(cmd==0x01) //Get SD card information{cmd = 0;printf("\r\n SD card test...\r\n");if(HAL_SD_GetCardState(&hsd) == HAL_SD_CARD_TRANSFER) //Get SD card resource info{printf("\r\n Initialize SD card successful!\r\n");printf(" SD card information↓ \r\n");printf(" Card Capacity : %llu \r\n", (unsigned long long)hsd.SdCard.BlockSize * hsd.SdCard.BlockNbr);printf(" One block size in bytes : %d \r\n", (int)hsd.SdCard.BlockSize);printf(" Logical Capacity in blocks : %d \r\n", (int)hsd.SdCard.LogBlockNbr);printf(" Logical block size in bytes : %d \r\n", (int)hsd.SdCard.LogBlockSize);printf(" Relative Card Address : %d \r\n", (int)hsd.SdCard.RelCardAdd);printf(" Card Type  : %d \r\n", (int)hsd.SdCard.CardType);HAL_SD_CardCIDTypeDef sdcard_cid;HAL_SD_GetCardCID(&hsd,&sdcard_cid); //Get SD card vendor infoprintf(" Manufacturer ID: %d \r\n", (int)sdcard_cid.ManufacturerID);}else{printf("\r\n SD card initiation failed!\r\n" );}}else if(cmd==0x02) //Erase SD card block{cmd = 0;printf("\r\n------------------- Block Erase -------------------------------\r\n");if(HAL_SD_Erase(&hsd, BLOCK_START_ADDR, NUM_OF_BLOCKS) == HAL_OK) //Erase block operation{while(HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) PY_Delay_us_t(10);printf("\r\n Erase Block Successful!\r\n");}else{printf("\r\n Erase Block Failed!\r\n");}}else if(cmd==0x03) //SD card write in block mode{cmd = 0;memset(SD_Buffer_Tx, 0xAA, sizeof(SD_Buffer_Tx)); //0xAA written into buffer for this testprintf("\r\n------------------- Write SD card block data in block mode ------------------\r\n");__disable_irq();SD_Status = HAL_SD_WriteBlocks(&hsd, SD_Buffer_Tx, BLOCK_START_ADDR, NUM_OF_BLOCKS, 0xFFFFFFFF); //Write block operation in block modeif(SD_Status==HAL_OK){while(HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) PY_Delay_us_t(10); //Wait for write endprintf("\r\n Write block data in block mode successful!\r\n");}else{printf("\r\n Write block data in block mode failed!\r\n");}__enable_irq();}else if(cmd==0x04) //SD card read in block mode{cmd = 0;printf("\r\n------------------- Read SD card block data in block mode ------------------\r\n");__disable_irq();SD_Status = HAL_SD_ReadBlocks(&hsd, SD_Buffer_Rx, BLOCK_START_ADDR, NUM_OF_BLOCKS, 0xFFFFFFFF); //read block operation in block modeif( SD_Status== HAL_OK){while(HAL_SD_GetCardState(&hsd) != HAL_SD_CARD_TRANSFER) PY_Delay_us_t(10); //Wait for read endprintf("\r\n Read block data in block mode successful!\r\n");for(uint32_t i = 0; i < sizeof(SD_Buffer_Rx); i++){printf("0x%02x:%02x ", (unsigned int)i, (unsigned int)SD_Buffer_Rx[i]);}printf("\r\n");}else{printf("\r\n Read block data in block mode failed!\r\n");}__enable_irq();}else if(cmd==0x05) //SD card write in INT mode{cmd = 0;memset(SD_Buffer_Tx, 0x55, sizeof(SD_Buffer_Tx)); //0x55 written into buffer for this testprintf("\r\n------------------- Write SD card block data in INT mode ------------------\r\n");SD_Tx_Int = 1;SD_Status = HAL_SD_WriteBlocks_IT(&hsd, SD_Buffer_Tx, BLOCK_START_ADDR, NUM_OF_BLOCKS); //write block operation in INT modeif(SD_Status== HAL_OK){while(SD_Tx_Int==1) PY_Delay_us_t(1); //Wait for write endprintf("\r\n Write block data in INT mode successful!\r\n");}else{printf("\r\n Write block data in INT mode failed!\r\n");}}else if(cmd==0x06) //SD card read in INT mode{cmd = 0;printf("\r\n------------------- Read SD card block data in INT mode ------------------\r\n");SD_Rx_Int = 1;SD_Status = HAL_SD_ReadBlocks_IT(&hsd, SD_Buffer_Rx, BLOCK_START_ADDR, NUM_OF_BLOCKS); //read block operation in INT modeif( SD_Status== HAL_OK){while(SD_Rx_Int==1) PY_Delay_us_t(1); //Wait for read endprintf("\r\n Read block data in INT mode successful!\r\n");for(uint32_t i = 0; i < sizeof(SD_Buffer_Rx); i++){printf("0x%02x:%02x ", (unsigned int)i, (unsigned int)SD_Buffer_Rx[i]);}printf("\r\n");}else{printf("\r\n Read block data in INT mode failed!\r\n");}}else if(cmd==0x07) //SD card write in DMA mode{cmd = 0;SD_DMA_INIT_M2P(&hsd); //Switch DMA mode directionmemset(SD_Buffer_Tx, 0x5A, sizeof(SD_Buffer_Tx)); //0x5A written into buffer for this testprintf("\r\n------------------- Write SD card block data in DMA mode ------------------\r\n");SD_Tx_Int = 1;SD_Status = HAL_SD_WriteBlocks_DMA(&hsd, SD_Buffer_Tx, BLOCK_START_ADDR, NUM_OF_BLOCKS); //write block operation in DMA modeif(SD_Status== HAL_OK){while(SD_Tx_Int==1) PY_Delay_us_t(1); //Wait for write endprintf("\r\n Write block data in DMA mode successful!\r\n");}else{printf("\r\n Write block data in DMA mode failed!\r\n");}}else if(cmd==0x08) //SD card read in DMA mode{cmd = 0;SD_DMA_INIT_P2M(&hsd); //Switch DMA mode directionprintf("\r\n------------------- Read SD card block data in DMA mode ------------------\r\n");SD_Rx_Int = 1;SD_Status = HAL_SD_ReadBlocks_DMA(&hsd, SD_Buffer_Rx, BLOCK_START_ADDR, NUM_OF_BLOCKS); //read block operation in DMA modeif( SD_Status== HAL_OK){while(SD_Rx_Int==1) PY_Delay_us_t(1); //Wait for read endprintf("\r\n Read block data in DMA mode successful!\r\n");for(uint32_t i = 0; i < sizeof(SD_Buffer_Rx); i++){printf("0x%02x:%02x ", (unsigned int)i, (unsigned int)SD_Buffer_Rx[i]);}printf("\r\n");}else{printf("\r\n Read block data in DMA mode failed!\r\n");}}else;/* USER CODE END WHILE *//* USER CODE BEGIN 3 */}/* USER CODE END 3 */
}/*** @brief System Clock Configuration* @retval None*/
void SystemClock_Config(void)
{RCC_OscInitTypeDef RCC_OscInitStruct = {0};RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};/** Initializes the RCC Oscillators according to the specified parameters* in the RCC_OscInitTypeDef structure.*/RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;RCC_OscInitStruct.HSEState = RCC_HSE_ON;RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;RCC_OscInitStruct.HSIState = RCC_HSI_ON;RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK){Error_Handler();}/** Initializes the CPU, AHB and APB buses clocks*/RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK){Error_Handler();}
}/*** @brief SDIO Initialization Function* @param None* @retval None*/
static void MX_SDIO_SD_Init(void)
{/* USER CODE BEGIN SDIO_Init 0 *//* USER CODE END SDIO_Init 0 *//* USER CODE BEGIN SDIO_Init 1 *//* USER CODE END SDIO_Init 1 */hsd.Instance = SDIO;hsd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING;hsd.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE;hsd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE;hsd.Init.BusWide = SDIO_BUS_WIDE_1B;hsd.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_ENABLE;hsd.Init.ClockDiv = 6;if (HAL_SD_Init(&hsd) != HAL_OK){Error_Handler();}if (HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B) != HAL_OK){Error_Handler();}/* USER CODE BEGIN SDIO_Init 2 *//* USER CODE END SDIO_Init 2 */}/*** @brief USART1 Initialization Function* @param None* @retval None*/
static void MX_USART1_UART_Init(void)
{/* USER CODE BEGIN USART1_Init 0 *//* USER CODE END USART1_Init 0 *//* USER CODE BEGIN USART1_Init 1 *//* USER CODE END USART1_Init 1 */huart1.Instance = USART1;huart1.Init.BaudRate = 115200;huart1.Init.WordLength = UART_WORDLENGTH_8B;huart1.Init.StopBits = UART_STOPBITS_1;huart1.Init.Parity = UART_PARITY_NONE;huart1.Init.Mode = UART_MODE_TX_RX;huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;huart1.Init.OverSampling = UART_OVERSAMPLING_16;if (HAL_UART_Init(&huart1) != HAL_OK){Error_Handler();}/* USER CODE BEGIN USART1_Init 2 *//* USER CODE END USART1_Init 2 */}/*** Enable DMA controller clock*/
static void MX_DMA_Init(void)
{/* DMA controller clock enable */__HAL_RCC_DMA2_CLK_ENABLE();/* DMA interrupt init *//* DMA2_Channel4_5_IRQn interrupt configuration */HAL_NVIC_SetPriority(DMA2_Channel4_5_IRQn, 0, 0);HAL_NVIC_EnableIRQ(DMA2_Channel4_5_IRQn);}/*** @brief GPIO Initialization Function* @param None* @retval None*/
static void MX_GPIO_Init(void)
{/* GPIO Ports Clock Enable */__HAL_RCC_GPIOC_CLK_ENABLE();__HAL_RCC_GPIOA_CLK_ENABLE();__HAL_RCC_GPIOD_CLK_ENABLE();}/* USER CODE BEGIN 4 */
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{if(huart==&huart1){cmd = uart1_rxd[0];HAL_UART_Receive_IT(&huart1, uart1_rxd, 1);}
}void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)
{SD_Tx_Int = 0;
}void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd)
{SD_Rx_Int = 0;
}
/* USER CODE END 4 *//*** @brief  This function is executed in case of error occurrence.* @retval None*/
void Error_Handler(void)
{/* USER CODE BEGIN Error_Handler_Debug *//* User can add his own implementation to report the HAL error return state */__disable_irq();while (1){}/* USER CODE END Error_Handler_Debug */
}#ifdef  USE_FULL_ASSERT
/*** @brief  Reports the name of the source file and the source line number*         where the assert_param error has occurred.* @param  file: pointer to the source file name* @param  line: assert_param error line source number* @retval None*/
void assert_failed(uint8_t *file, uint32_t line)
{/* USER CODE BEGIN 6 *//* User can add his own implementation to report the file name and line number,ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) *//* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */

STM32例程测试

串口指令0x01测试效果如下:
在这里插入图片描述
串口指令0x02测试效果如下:
在这里插入图片描述
串口指令0x03测试效果如下:
在这里插入图片描述
串口指令0x04测试效果如下:
在这里插入图片描述
串口指令0x05测试效果如下:
在这里插入图片描述
串口指令0x06测试效果如下:
在这里插入图片描述
串口指令0x07测试效果如下:
在这里插入图片描述
串口指令0x08测试效果如下:
在这里插入图片描述

STM32例程下载

STM32F103VET6 SDIO总线读写SD/MicroSD/TF卡例程下载

–End–

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/620729.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

fiddler常用操作汇总

1、过滤 2、查看数据包内容 3、弱网测试 弱网测试其实就是提前设置好一个值&#xff0c;在这个环境下进行测试就行了。 &#xff08;1&#xff09;进入定制规则页面&#xff1a; (2) 点击CtrlF调起搜索&#xff0c;在Find what 中输入300进行查找&#xff0c;更改上行、下行网…

【MATLAB源码-第43期】基于matlab的turbo码误码率仿真比较不同迭代次数,采用logmap/sova算法。

操作环境&#xff1a; MATLAB 2022a 1、算法描述 Turbo码是一种前向纠错码 (Forward Error Correction, FEC)&#xff0c;在 1993 年由法国的两位研究员 Claude Berrou 和 Alain Glavieux 提出。这种编码技术以其接近 Shannon 极限的高性能而受到广泛关注。以下是关于 Turbo…

软考125-上午题-【软件工程】-传统软件的测试策略

一、传统软件的测试策略 有效的软件测试实际上分为4步进行&#xff0c;即&#xff1a;单元测试、集成测试、确认测试、系统测试。 1-1、单元测试&#xff08;模块测试&#xff09; 单元测试也称为模块测试&#xff0c;在模块编写完成且无编译错误后就可以进行。 单元测试侧重…

C语言文件操作详解

1. 什么是文件&#xff1a; 文件是计算机中存储数据的一种方式&#xff0c;它可以包含文本、图像、音频、视频等各种形式的信息。在计算机系统中&#xff0c;文件被组织成一个个独立的单元&#xff0c;可以通过文件名来标识和访问。文件可以存储在计算机的硬盘、固态硬盘、光盘…

初学python记录:力扣706. 设计哈希映射

题目&#xff1a; 不使用任何内建的哈希表库设计一个哈希映射&#xff08;HashMap&#xff09;。 实现 MyHashMap 类&#xff1a; MyHashMap() 用空映射初始化对象void put(int key, int value) 向 HashMap 插入一个键值对 (key, value) 。如果 key 已经存在于映射中&#x…

使用IT-Tools+Cpolar在Windows搭建自己的IT工具箱并实现远程在线使用

文章目录 1. 使用Docker本地部署it-tools2. 本地访问it-tools3. 安装cpolar内网穿透4. 固定it-tools公网地址 本篇文章将介绍如何在Windows上使用Docker本地部署IT- Tools&#xff0c;并且同样可以结合cpolar实现公网访问。 在前一篇文章中我们讲解了如何在Linux中使用Docker搭…

unity——Button组件单击双击长按功能

1.实现单击、双击、长按功能 using UnityEngine; using UnityEngine.Events; using UnityEngine.EventSystems; public class ButtonControl_Click_Press_Double : MonoBehaviour, IPointerClickHandler, IPointerDownHandler, IPointerUpHandler, IPointerExitHandler {publi…

【InternLM 实战营第二期笔记01】书生·浦语大模型全链路开源体系+InternLM2技术报告

本次课程链接在GitHub上&#xff1a;InternLM/Tutorial at camp2 (github.com) 第一次课程录播链接&#xff1a;书生浦语大模型全链路开源体系_哔哩哔哩_bilibili InternLM2技术报告&#xff1a;arxiv.org/pdf/2403.17297.pdf 一、书生浦语大模型全链路开源体系笔记 Intern…

强化学习-Reinforcement learning | RL

目录 什么是强化学习? 强化学习的应用场景 强化学习的主流算法 强化学习是机器学习的一种学习方式,它跟监督学习、无监督学习是对应的。本文将详细介绍强化学习的基本概念、应用场景和主流的强化学习算法及分类。 什么是强化学习? 强化学习并不是某一种特定的算法,而是…

消费增值新模式:让每一分钱都更有价值

亲爱的消费者们&#xff0c;大家好&#xff01;今天我想和大家探讨一种新颖的消费方式——消费增值&#xff0c;它让您的每一次消费都蕴含了额外的价值&#xff0c;让消费变得更加有意义。 在过往的消费观念里&#xff0c;我们往往只是简单地将钱花出去&#xff0c;购买所需的商…

Jmeter —— jmeter利用取样器中http发送请求

使用Jmeter发送HTTP请求 取样器是用来模拟用户操作&#xff0c;向服务器发送请求以及接收服务器的响应数 据的一类元件&#xff0c;其中HTTP请求取样器是用来模拟常用的http请求的 步骤如下&#xff1a; 步骤一&#xff1a;添加线程组 右击测试计划——添加——线程&#x…

ModuleNotFoundError: No module named ‘imageio‘ 解决方案

错误原因&#xff1a; 缺少imageio包导致 解决办法&#xff1a; 1、查看是否安装conda环境&#xff0c;如果未安装就先安装conda环境 conda --version 输出conda版本&#xff1a; 2、输入如下代码 conda config --add channels conda-forge conda install imgaug