Skip to content

Commit b73085d

Browse files
committed
stm: add pyb.sd_test; flash cache flushed only via MSD.
1 parent a3dcd9e commit b73085d

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

stm/lib/usbd_storage_msd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ int8_t STORAGE_Write (uint8_t lun,
309309
#endif
310310
*/
311311
disk_write(0, buf, blk_addr, blk_len);
312+
storage_flush(); // XXX hack for now so that the cache is always flushed
312313
return (0);
313314
}
314315

stm/main.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,13 @@ static py_obj_t pyb_info(void) {
367367
return py_const_none;
368368
}
369369

370+
// SD card test
371+
static py_obj_t pyb_sd_test(void) {
372+
extern void sdio_init(void);
373+
sdio_init();
374+
return py_const_none;
375+
}
376+
370377
static void SYSCLKConfig_STOP(void) {
371378
/* After wake-up from STOP reconfigure the system clock */
372379
/* Enable HSE */
@@ -1010,6 +1017,7 @@ int main(void) {
10101017

10111018
py_obj_t m = py_module_new();
10121019
rt_store_attr(m, qstr_from_str_static("info"), rt_make_function_0(pyb_info));
1020+
rt_store_attr(m, qstr_from_str_static("sd_test"), rt_make_function_0(pyb_sd_test));
10131021
rt_store_attr(m, qstr_from_str_static("stop"), rt_make_function_0(pyb_stop));
10141022
rt_store_attr(m, qstr_from_str_static("standby"), rt_make_function_0(pyb_standby));
10151023
rt_store_attr(m, qstr_from_str_static("source_dir"), rt_make_function_1(pyb_source_dir));

stm/storage.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ bool storage_write_block(const uint8_t *src, uint32_t block) {
152152
uint8_t *dest = cache_get_addr_for_write(flash_addr);
153153
memcpy(dest, src, BLOCK_SIZE);
154154
sys_tick_counter_last_write = sys_tick_counter;
155-
cache_flush(); // XXX hack for now so that the cache is always flushed
156155
return true;
157156

158157
} else {

0 commit comments

Comments
 (0)