From 2d794f56d8995db81669e5406113fa76ca19aa90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Tue, 31 Oct 2017 17:04:38 +0100 Subject: [PATCH] fix 3, add hardfault pre handler --- Makefile | 4 ++-- fatfs/shimatta_sdio_driver/shimatta_sdio.c | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index dd673c6..c522f43 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ ##################################################################################### #Add Files and Folders below######################################################### CFILES = main.c syscalls/syscalls.c uart/uart.c startup/system_stm32f4xx.c -ASFILES = boot/startup_stm32f4xx.S +ASFILES = boot/startup_stm32f4xx.S hardfault/hardfault_prehandler.S INCLUDEPATH = -Iinclude @@ -32,7 +32,7 @@ LFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 --disable-newlib-supplied-syscalls LFLAGS += -Tstm32f407vgt6_flash.ld -Wl,-Map=$(mapfile).map -Wl,--gc-sections CFLAGS = -c -fmessage-length=0 -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles -Wall -O3 +CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles -Wall -O0 -g3 #################################################################################### diff --git a/fatfs/shimatta_sdio_driver/shimatta_sdio.c b/fatfs/shimatta_sdio_driver/shimatta_sdio.c index 0e0e485..787963c 100644 --- a/fatfs/shimatta_sdio_driver/shimatta_sdio.c +++ b/fatfs/shimatta_sdio_driver/shimatta_sdio.c @@ -383,8 +383,11 @@ void SDIO_wait_cmd_sent() { SDIO->ICR |= SDIO_ICR_CMDSENTC; } -int __attribute__((noinline)) __attribute__((optimize("O0"))) SDIO_get_response(uint8_t expectedCMD, uint8_t typeOfAns, uint32_t *responseBuffer) { +int /*__attribute__((noinline)) __attribute__((optimize("O0")))*/ SDIO_get_response(uint8_t expectedCMD, uint8_t typeOfAns, uint32_t *responseBuffer) { uint32_t sdio_status; + + /* Wait until command isn't active anymore */ + while (SDIO->STA & SDIO_STA_CMDACT); //Wait for error or success while (1) { sdio_status = SDIO->STA;