From 31b4b0a8d4cab5251159ac5566caa684a7b2b186 Mon Sep 17 00:00:00 2001 From: Michal Jenikovsky Date: Thu, 10 Aug 2023 11:52:24 +0200 Subject: [PATCH 1/2] idf.py: gdb action incorrectly generated EOL gdbinit scripts GDB on Windows incorrectly reads EOL in the script files causing 'gdb' action to fail. (gdb) source .../build/gdbinit/py_extensions (gdb) source .../build\gdbinit\symbols add symbol table from file "...\build\bootloader\bootloader.elf" .../build\gdbinit\symbols:6: Error in sourced command file: Undefined command: "". Try "help". Forcing line separator to '\n' resolved the issue Signed-off-by: Michal Jenikovsky --- tools/idf_py_actions/debug_ext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/idf_py_actions/debug_ext.py b/tools/idf_py_actions/debug_ext.py index 33e8c16751..bc82dcd847 100644 --- a/tools/idf_py_actions/debug_ext.py +++ b/tools/idf_py_actions/debug_ext.py @@ -270,7 +270,7 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: r.append('set confirm on') r.append('end') r.append('') - return os.linesep.join(r) + return '\n'.join(r) raise FatalError(f'{ESP_ROM_INFO_FILE} file not found. Please check IDF integrity.') def generate_gdbinit_files(gdb: str, gdbinit: Optional[str], project_desc: Dict[str, Any]) -> None: From 1f6f5396f40a863559df58c784b9b8d11e646444 Mon Sep 17 00:00:00 2001 From: Michal Jenikovsky Date: Thu, 10 Aug 2023 11:56:02 +0200 Subject: [PATCH 2/2] fatfs: raw diskio: Fixed handling read-only filesystem ff_ routines incorrectly reported disk state and caused whole fatfs to lock-up when trying to write to read-only device. Signed-off-by: Michal Jenikovsky --- components/fatfs/diskio/diskio_rawflash.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/components/fatfs/diskio/diskio_rawflash.c b/components/fatfs/diskio/diskio_rawflash.c index cbd03e0f31..313aacec4b 100644 --- a/components/fatfs/diskio/diskio_rawflash.c +++ b/components/fatfs/diskio/diskio_rawflash.c @@ -18,6 +18,7 @@ static const esp_partition_t* s_ff_raw_handles[FF_VOLUMES]; // Determine the sector size and sector count by parsing the boot sector static size_t s_sector_size[FF_VOLUMES]; static size_t s_sectors_count[FF_VOLUMES]; +static uint8_t s_initialized[FF_VOLUMES]; #define BPB_BytsPerSec 11 #define BPB_TotSec16 19 @@ -56,12 +57,17 @@ DSTATUS ff_raw_initialize (BYTE pdrv) s_sectors_count[pdrv] = sectors_count_tmp_32; } - return 0; + s_initialized[pdrv] = true; + return STA_PROTECT; } DSTATUS ff_raw_status (BYTE pdrv) { - return 0; + DSTATUS status = STA_PROTECT; + if (!s_initialized[pdrv]) { + status |= STA_NOINIT | STA_NODISK; + } + return status; } DRESULT ff_raw_read (BYTE pdrv, BYTE *buff, DWORD sector, UINT count) @@ -80,7 +86,7 @@ DRESULT ff_raw_read (BYTE pdrv, BYTE *buff, DWORD sector, UINT count) DRESULT ff_raw_write (BYTE pdrv, const BYTE *buff, DWORD sector, UINT count) { - return RES_ERROR; + return RES_WRPRT; } DRESULT ff_raw_ioctl (BYTE pdrv, BYTE cmd, void *buff)