1 /* 2 * Copyright (c) 2006-2022, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2020-11-07 wanghaijing the first version 9 */ 10 11 #include <rtthread.h> 12 #include <rtdevice.h> 13 #include <dev_spi_flash.h> 14 #include <drv_spi.h> 15 rt_flash_init(void)16static int rt_flash_init(void) 17 { 18 extern rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const char *spi_dev_name); 19 extern int fal_init(void); 20 21 rt_hw_spi_device_attach("spi1", "spi10", GET_PIN(A, 4)); 22 23 /* initialize SPI Flash device */ 24 rt_sfud_flash_probe("norflash0", "spi10"); 25 26 fal_init(); 27 28 return 0; 29 } 30 INIT_ENV_EXPORT(rt_flash_init); 31