#define FLASH_USER (FLASH_BASE+0x00100000U)
void StartDefaultTask(void const * argument)
{
/* USER CODE BEGIN 5 */
uint32_t i = 0;
uint32_t * pFlash_Data = (uint32_t *)FLASH_USER;
/* Infinite loop */
for(;;)
{
osDelay(5000);
HAL_FLASH_Unlock();
HAL_FLASH_Program(FLASH_PSIZE_WORD,FLASH_USER, (uint64_t)i++);
HAL_FLASH_Lock();
FLASH_WaitForLastOpera
tion(100);
printf("Hello world%d
",*pFlash_Data);
HAL_GPIO_WritePin(GPIOB, LD1_GREEN_Pin, i&0x00000001);
//HAL_UART_Transmit(&huart3, "a", 1, 0xFFFF);
}
/* USER CODE END 5 */
}
以上代码写入后读出测试失败,大侠给个例子吧。
一周热门 更多>