diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-12-20 01:04:24 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-12-20 01:04:24 +0300 |
commit | 72355146ae0016da5191f40bcaa0ac71fb972c72 (patch) | |
tree | 461882d55d5fa327dacfe5edc76cec466c4a63a8 | |
parent | d0193b3a3d02591b139cd9d810067cd042b4ab8c (diff) |
Fixed occasional SD card crash on Duet 3 when booting up3.2RC1
Also fixed printout of sqrt and sin/cos timings
-rw-r--r-- | src/Libraries/sd_mmc/sd_mmc.c | 17 | ||||
-rw-r--r-- | src/Platform.cpp | 6 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/Libraries/sd_mmc/sd_mmc.c b/src/Libraries/sd_mmc/sd_mmc.c index e1cae3be..9ff1117c 100644 --- a/src/Libraries/sd_mmc/sd_mmc.c +++ b/src/Libraries/sd_mmc/sd_mmc.c @@ -53,6 +53,11 @@ #include "sd_mmc.h" #include "conf_sd_mmc.h" +#if SAME70 //DC +# define __nocache __attribute__((section(".ram_nocache"))) +#else +# define __nocache // nothing +#endif /** * \ingroup sd_mmc_stack * \defgroup sd_mmc_stack_internal Implementation of SD/MMC/SDIO Stack @@ -224,7 +229,8 @@ struct sd_mmc_card { }; //! SD/MMC card list -static struct sd_mmc_card sd_mmc_cards[SD_MMC_MEM_CNT]; +//DC added __nocache for SAME70 because 'csd' is read by DMA +static __nocache struct sd_mmc_card sd_mmc_cards[SD_MMC_MEM_CNT]; //! Index of current slot selected static uint8_t sd_mmc_slot_sel; @@ -740,7 +746,12 @@ static bool sdio_cmd52_set_high_speed(void) */ static bool sd_cm6_set_high_speed(void) { + +#if SAME70 + static __nocache uint8_t switch_status[SD_SW_STATUS_BSIZE]; +#else uint8_t switch_status[SD_SW_STATUS_BSIZE]; +#endif if (!sd_mmc_card->iface->adtc_start(SD_CMD6_SWITCH_FUNC, SD_CMD6_MODE_SWITCH @@ -1212,7 +1223,11 @@ static bool sd_acmd6(void) */ static bool sd_acmd51(void) { +#if SAME70 + static __nocache uint8_t scr[SD_SCR_REG_BSIZE]; +#else uint8_t scr[SD_SCR_REG_BSIZE]; +#endif // CMD55 - Indicate to the card that the next command is an // application specific command rather than a standard command. diff --git a/src/Platform.cpp b/src/Platform.cpp index 9c9960a7..20c5da1c 100644 --- a/src/Platform.cpp +++ b/src/Platform.cpp @@ -2171,8 +2171,8 @@ GCodeResult Platform::DiagnosticTest(GCodeBuffer& gb, const StringRef& reply, Ou } reply.printf("Square roots: 62-bit %.2fus %s, 32-bit %.2fus %s", - (double)((tim1 * (1'000'000/iterations))/SystemCoreClock), (ok1) ? "ok" : "ERROR", - (double)((tim2 * (1'000'000/iterations))/SystemCoreClock), (ok2) ? "ok" : "ERROR"); + (double)((float)(tim1 * (1'000'000/iterations))/SystemCoreClock), (ok1) ? "ok" : "ERROR", + (double)((float)(tim2 * (1'000'000/iterations))/SystemCoreClock), (ok2) ? "ok" : "ERROR"); } break; @@ -2197,7 +2197,7 @@ GCodeResult Platform::DiagnosticTest(GCodeBuffer& gb, const StringRef& reply, Ou } // We no longer calculate sin and cos for doubles because it pulls in those library functions, which we don't otherwise need - reply.printf("Sine + cosine: float %.2fus", (double)((tim1 * (1'000'000/iterations))/SystemCoreClock)); + reply.printf("Sine + cosine: float %.2fus", (double)((float)(tim1 * (1'000'000/iterations))/SystemCoreClock)); } break; |