From bc7a43bdaf0b4c3e2dfb77bc5223ff19eac3a2a4 Mon Sep 17 00:00:00 2001 From: armink Date: Wed, 22 Aug 2018 16:41:56 +0800 Subject: [PATCH 1/2] [DeviceDriver][SFUD] Replace the vsnprintf to rt_vsnprintf. --- components/drivers/spi/spi_flash_sfud.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/drivers/spi/spi_flash_sfud.c b/components/drivers/spi/spi_flash_sfud.c index 72d462a87..9859cb014 100644 --- a/components/drivers/spi/spi_flash_sfud.c +++ b/components/drivers/spi/spi_flash_sfud.c @@ -189,7 +189,7 @@ void sfud_log_debug(const char *file, const long line, const char *format, ...) va_start(args, format); rt_kprintf("[SFUD] (%s:%ld) ", file, line); /* must use vprintf to print */ - vsnprintf(log_buf, sizeof(log_buf), format, args); + rt_vsnprintf(log_buf, sizeof(log_buf), format, args); rt_kprintf("%s\n", log_buf); va_end(args); } @@ -207,7 +207,7 @@ void sfud_log_info(const char *format, ...) { va_start(args, format); rt_kprintf("[SFUD] "); /* must use vprintf to print */ - vsnprintf(log_buf, sizeof(log_buf), format, args); + rt_vsnprintf(log_buf, sizeof(log_buf), format, args); rt_kprintf("%s\n", log_buf); va_end(args); } From 9ef9e4b0f819fa06c43e430eb0a1eb9ac2d645e0 Mon Sep 17 00:00:00 2001 From: armink Date: Wed, 22 Aug 2018 16:48:17 +0800 Subject: [PATCH 2/2] [DeviceDriver][SFUD] Update sfud to v1.0.6 latest version. --- components/drivers/spi/sfud/LICENSE | 2 +- components/drivers/spi/sfud/README.md | 1 + components/drivers/spi/sfud/inc/sfud_def.h | 3 ++- components/drivers/spi/sfud/inc/sfud_flash_def.h | 4 ++++ components/drivers/spi/sfud/src/sfud.c | 2 ++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/components/drivers/spi/sfud/LICENSE b/components/drivers/spi/sfud/LICENSE index f956e1683..14b974614 100644 --- a/components/drivers/spi/sfud/LICENSE +++ b/components/drivers/spi/sfud/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016-2017 Armink (armink.ztl@gmail.com) +Copyright (c) 2016-2018 Armink (armink.ztl@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/components/drivers/spi/sfud/README.md b/components/drivers/spi/sfud/README.md index 0f16b0395..739432124 100644 --- a/components/drivers/spi/sfud/README.md +++ b/components/drivers/spi/sfud/README.md @@ -37,6 +37,7 @@ |[W25Q128BV](http://www.winbond.com/resource-files/w25q128bv_revh_100313_wo_automotive.pdf)|Winbond|128Mb|104Mhz|支持|| |[W25Q256FV](http://www.winbond.com/resource-files/w25q256fv%20revi%2002262016%20kms.pdf)|Winbond|256Mb|104Mhz|支持|| |[MX25L3206E](http://www.macronix.com/Lists/DataSheet/Attachments/3199/MX25L3206E,%203V,%2032Mb,%20v1.5.pdf)|Macronix|32Mb|86MHz|支持|| +|[KH25L4006E](http://www.macronix.com.hk/Lists/Datasheet/Attachments/117/KH25L4006E.pdf)|Macronix|4Mb|86Mhz|支持| by [JiapengLi](https://github.com/JiapengLi)| |[KH25L3206E](http://www.macronix.com.hk/Lists/Datasheet/Attachments/131/KH25L3206E.pdf)|Macronix|32Mb|86Mhz|支持|| |[SST25VF016B](http://ww1.microchip.com/downloads/en/DeviceDoc/20005044C.pdf)|Microchip|16Mb|50MHz|不支持| SST 已被 Microchip 收购| |[M25P40](https://www.micron.com/~/media/documents/products/data-sheet/nor-flash/serial-nor/m25p/m25p40.pdf)|Micron|4Mb|75Mhz|不支持| by [redocCheng](https://github.com/redocCheng)| diff --git a/components/drivers/spi/sfud/inc/sfud_def.h b/components/drivers/spi/sfud/inc/sfud_def.h index bb460d3f7..1b0e8a398 100644 --- a/components/drivers/spi/sfud/inc/sfud_def.h +++ b/components/drivers/spi/sfud/inc/sfud_def.h @@ -30,6 +30,7 @@ #define _SFUD_DEF_H_ #include +#include #include #include #include @@ -77,7 +78,7 @@ if (!(EXPR)) \ else {if (__delay_temp) {__delay_temp();} retry --;} /* software version number */ -#define SFUD_SW_VERSION "1.0.4" +#define SFUD_SW_VERSION "1.0.6" /* * all defined supported command */ diff --git a/components/drivers/spi/sfud/inc/sfud_flash_def.h b/components/drivers/spi/sfud/inc/sfud_flash_def.h index 29878229b..2022a043b 100644 --- a/components/drivers/spi/sfud/inc/sfud_flash_def.h +++ b/components/drivers/spi/sfud/inc/sfud_flash_def.h @@ -77,6 +77,7 @@ typedef struct { #define SFUD_MF_ID_FUDAN 0xA1 #define SFUD_MF_ID_HYUNDAI 0xAD #define SFUD_MF_ID_SST 0xBF +#define SFUD_MF_ID_MICRONIX 0xC2 #define SFUD_MF_ID_GIGADEVICE 0xC8 #define SFUD_MF_ID_ISSI 0xD5 #define SFUD_MF_ID_WINBOND 0xEF @@ -99,6 +100,7 @@ typedef struct { {"GigaDevice", SFUD_MF_ID_GIGADEVICE}, \ {"ISSI", SFUD_MF_ID_ISSI}, \ {"Winbond", SFUD_MF_ID_WINBOND}, \ + {"Micronix", SFUD_MF_ID_MICRONIX}, \ } #ifdef SFUD_USING_FLASH_INFO_TABLE @@ -112,6 +114,8 @@ typedef struct { {"AT45DB161E", SFUD_MF_ID_ATMEL, 0x26, 0x00, 2L*1024L*1024L, SFUD_WM_BYTE|SFUD_WM_DUAL_BUFFER, 512, 0x81}, \ {"W25Q40BV", SFUD_MF_ID_WINBOND, 0x40, 0x13, 512L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \ {"W25Q16BV", SFUD_MF_ID_WINBOND, 0x40, 0x15, 2L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \ + {"W25Q128BV", SFUD_MF_ID_WINBOND, 0x40, 0x18, 16L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \ + {"W25Q256FV", SFUD_MF_ID_WINBOND, 0x40, 0x19, 32L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \ {"SST25VF016B", SFUD_MF_ID_SST, 0x25, 0x41, 2L*1024L*1024L, SFUD_WM_BYTE|SFUD_WM_AAI, 4096, 0x20}, \ {"M25P32", SFUD_MF_ID_MICRON, 0x20, 0x16, 4L*1024L*1024L, SFUD_WM_PAGE_256B, 64L*1024L, 0xD8}, \ {"M25P80", SFUD_MF_ID_MICRON, 0x20, 0x14, 1L*1024L*1024L, SFUD_WM_PAGE_256B, 64L*1024L, 0xD8}, \ diff --git a/components/drivers/spi/sfud/src/sfud.c b/components/drivers/spi/sfud/src/sfud.c index 9b220e3e6..e3376555c 100644 --- a/components/drivers/spi/sfud/src/sfud.c +++ b/components/drivers/spi/sfud/src/sfud.c @@ -238,6 +238,8 @@ static sfud_err hardware_init(sfud_flash *flash) { flash->chip.capacity); } else if (flash_mf_name) { SFUD_INFO("Find a %s flash chip. Size is %ld bytes.", flash_mf_name, flash->chip.capacity); + } else { + SFUD_INFO("Find a flash chip. Size is %ld bytes.", flash->chip.capacity); } }