From cd986ff9847c91e1356c4f70bb32e728bf6aa216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Sat, 22 Feb 2020 19:30:13 +0100 Subject: [PATCH] Edit linker script and fix read function in SDIO --- fatfs/shimatta_sdio_driver/shimatta_sdio.c | 12 ++++++++---- stm32f407vgt6_flash.ld | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/fatfs/shimatta_sdio_driver/shimatta_sdio.c b/fatfs/shimatta_sdio_driver/shimatta_sdio.c index c327586..763079e 100644 --- a/fatfs/shimatta_sdio_driver/shimatta_sdio.c +++ b/fatfs/shimatta_sdio_driver/shimatta_sdio.c @@ -246,15 +246,19 @@ DRESULT SDIO_disk_read(BYTE *buff, DWORD sector, UINT count){ SDIO->DLEN = (1 << BLOCKSIZE); - /* Init Transfer */ - if (SDIO_send_read_block_CMD17(addr)) { - return RES_ERROR; - } + SDIO->ICR = SDIO_ICR_CCRCFAILC | SDIO_ICR_DCRCFAILC | SDIO_ICR_CTIMEOUTC | SDIO_ICR_DTIMEOUTC | SDIO_ICR_TXUNDERRC | SDIO_ICR_RXOVERRC | SDIO_ICR_CMDRENDC | SDIO_ICR_CMDSENTC | SDIO_ICR_DATAENDC | SDIO_ICR_STBITERRC | SDIO_ICR_DBCKENDC | SDIO_ICR_SDIOITC | SDIO_ICR_CEATAENDC; SDIO->DCTRL = (BLOCKSIZE<<4) | SDIO_DCTRL_DTDIR | /*SDIO_DCTRL_DMAEN |*/ SDIO_DCTRL_DTEN; + + /* Init Transfer */ + if (SDIO_send_read_block_CMD17(addr)) { + SDIO->DCTRL = 0; + return RES_ERROR; + } + debug=0; counter = 0; while (counter < (1<<(BLOCKSIZE-2)) || !(SDIO->STA & (SDIO_STA_DBCKEND | SDIO_STA_DATAEND))) { // TODO: Handle errors diff --git a/stm32f407vgt6_flash.ld b/stm32f407vgt6_flash.ld index 2b27460..d6d71ad 100644 --- a/stm32f407vgt6_flash.ld +++ b/stm32f407vgt6_flash.ld @@ -152,7 +152,7 @@ SECTIONS /* Uninitialized data section */ . = ALIGN(4); - .bss : + .bss (NOLOAD): { /* This is used by the startup in order to initialize the .bss secion */ _sbss = .; /* define a global symbol at bss start */ @@ -167,7 +167,7 @@ SECTIONS } >RAM /* User_heap_stack section, used to check that there is enough RAM left */ - ._user_heap_stack : + ._user_heap_stack (NOLOAD): { . = ALIGN(4); PROVIDE (heap_low = .); /* for _sbrk */