Compare commits
2 Commits
ecd8d2537d
...
47d8df052a
Author | SHA1 | Date | |
---|---|---|---|
47d8df052a | |||
3705cc09d1 |
@ -13,7 +13,7 @@ LIBRARYPATH = -L. -Lmathlib
|
||||
LIBRARIES = -larm_cortexM4lf_math -lm
|
||||
|
||||
DEFINES = -DSTM32F407xx -DSTM32F4XX -DARM_MATH_CM4 -DHSE_VALUE=8000000UL
|
||||
mapfile = memory-mapping
|
||||
MAPFILE_BASE = memory-mapping
|
||||
|
||||
export GIT_VER = $(shell git describe --always --dirty --tags)
|
||||
DEFINES += -DGIT_VER=$(GIT_VER)
|
||||
@ -61,34 +61,39 @@ OBJCOPY=$(CROSS_COMPILE)objcopy
|
||||
OBJDUMP=$(CROSS_COMPILE)objdump
|
||||
SIZE=$(CROSS_COMPILE)size
|
||||
|
||||
LFLAGS = -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
|
||||
LFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 --disable-newlib-supplied-syscalls -nostartfiles
|
||||
LFLAGS += -Tstm32f407vet6_flash.ld -Wl,-Map=$(mapfile).map
|
||||
|
||||
CFLAGS = -c -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
|
||||
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles
|
||||
CFLAGS += -Wall -Wextra -Wold-style-declaration -Wuninitialized -Wmaybe-uninitialized -Wunused-parameter -Wimplicit-fallthrough=3 -Wsign-compare
|
||||
|
||||
CFLAGS_RELEASE = -O3 -g
|
||||
CFLAGS_DEBUG = -O0 -g
|
||||
|
||||
LFLAGS_RELEASE = -Wl,--gc-sections
|
||||
LFLAGS_DEBUG =
|
||||
|
||||
CFLAGS =
|
||||
LFLAGS =
|
||||
|
||||
ifneq ($(DEBUGBUILD),true)
|
||||
DEFINES += $(RELEASE_DEFINES)
|
||||
CFLAGS += $(CFLAGS_RELEASE)
|
||||
LFLAGS += $(LFLAGS_RELEASE)
|
||||
target = $(TARGET_BASE)-release
|
||||
OBJDIR = $(OBJDIR_BASE)/release
|
||||
MAPFILE = $(MAPFILE_BASE)-release
|
||||
else
|
||||
DEFINES += $(DEBUG_DEFINES)
|
||||
target = $(TARGET_BASE)-debug
|
||||
CFLAGS += $(CFLAGS_DEBUG)
|
||||
LFLAGS += $(LFLAGS_DEBUG)
|
||||
OBJDIR = $(OBJDIR_BASE)/debug
|
||||
MAPFILE = $(MAPFILE_BASE)-debug
|
||||
endif
|
||||
|
||||
LFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
|
||||
LFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 --disable-newlib-supplied-syscalls -nostartfiles
|
||||
LFLAGS += -Tstm32f407vet6_flash.ld -Wl,-Map=$(MAPFILE).map
|
||||
|
||||
CFLAGS += -c -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
|
||||
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles
|
||||
CFLAGS += -Wall -Wextra -Wold-style-declaration -Wuninitialized -Wmaybe-uninitialized -Wunused-parameter -Wimplicit-fallthrough=3 -Wsign-compare
|
||||
|
||||
####################################################################################
|
||||
|
||||
OBJ = $(CFILES:%.c=$(OBJDIR)/%.c.o)
|
||||
|
@ -238,6 +238,8 @@ static int sdio_check_status_register_cmd13(uint16_t rca, uint32_t *status)
|
||||
uint32_t response;
|
||||
int res;
|
||||
|
||||
*status = 0UL;
|
||||
|
||||
do {
|
||||
sdio_send_cmd(13, (rca<<16)&0xFFFF0000, SHORT_ANS);
|
||||
if (!(res = sdio_get_response(13, SHORT_ANS, &response))) {
|
||||
@ -465,10 +467,14 @@ static int sdio_send_select_card_cmd7(uint16_t rca) {
|
||||
} while(--timeout > 0);
|
||||
|
||||
/* Check, if card in in TRANS state */
|
||||
if (sdio_check_status_register_cmd13(rca, &(status.value)))
|
||||
if (sdio_check_status_register_cmd13(rca, &status.value)) {
|
||||
res = -1;
|
||||
goto ret_val;
|
||||
}
|
||||
if (status.statusstruct.CURRENT_STATE != CURRENT_STATE_TRAN)
|
||||
res = -2;
|
||||
|
||||
ret_val:
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -705,9 +711,10 @@ DRESULT sdio_disk_write(const BYTE *buff, DWORD sector, UINT count)
|
||||
|
||||
while (count) {
|
||||
do {
|
||||
sdio_check_status_register_cmd13(card_info.rca, &status.value);
|
||||
ret = sdio_check_status_register_cmd13(card_info.rca, &status.value);
|
||||
} while (status.statusstruct.CURRENT_STATE == CURRENT_STATE_PRG ||
|
||||
status.statusstruct.CURRENT_STATE == CURRENT_STATE_RCV);
|
||||
status.statusstruct.CURRENT_STATE == CURRENT_STATE_RCV ||
|
||||
!ret);
|
||||
|
||||
if (status.statusstruct.CURRENT_STATE == CURRENT_STATE_STBY) {
|
||||
if (sdio_send_select_card_cmd7(card_info.rca))
|
||||
|
Loading…
x
Reference in New Issue
Block a user