Skip to content

Instantly share code, notes, and snippets.

@eighthree
Last active November 22, 2018 08:52
Show Gist options
  • Save eighthree/42ae852e0ca83bc7565f3eb67bf8ab5e to your computer and use it in GitHub Desktop.
Save eighthree/42ae852e0ca83bc7565f3eb67bf8ab5e to your computer and use it in GitHub Desktop.
(gdb) break supervisor_flash_init_vfs
Breakpoint 6 at 0x2b512: file ../../supervisor/shared/flash.c, line 190.
(gdb) load
Loading section .text, size 0x35b84 lma 0x2000
Loading section .ARM.exidx, size 0x8 lma 0x37b84
Loading section .data, size 0x17c lma 0x37b8c
Start address 0x2000, load size 220424
Transfer rate: 35876 KB/sec, 13776 bytes/write.
(gdb) monitor reset
Resetting target
(gdb) continue
Continuing.
Breakpoint 6, filesystem_init (create_allowed=true, force_create=false) at ../../supervisor/shared/filesystem.c:50
50 supervisor_flash_init_vfs(vfs_fat);
(gdb) next
53 FRESULT res = f_mount(&vfs_fat->fatfs);
(gdb) next
50 supervisor_flash_init_vfs(vfs_fat);
(gdb) next
46 void filesystem_init(bool create_allowed, bool force_create) {
(gdb) next
50 supervisor_flash_init_vfs(vfs_fat);
(gdb) next
53 FRESULT res = f_mount(&vfs_fat->fatfs);
(gdb) next
50 supervisor_flash_init_vfs(vfs_fat);
(gdb) next
53 FRESULT res = f_mount(&vfs_fat->fatfs);
(gdb) next
55 if ((res == FR_NO_FILESYSTEM && create_allowed) || force_create) {
(gdb) next
76 } else if (res != FR_OK) {
(gdb) next
80 vfs->str = "/";
(gdb) next
82 vfs->obj = MP_OBJ_FROM_PTR(vfs_fat);
(gdb) next
80 vfs->str = "/";
(gdb) next
81 vfs->len = 1;
(gdb) next
83 vfs->next = NULL;
(gdb) next
84 MP_STATE_VM(vfs_mount_table) = vfs;
(gdb) next
88 MP_STATE_PORT(vfs_cur) = vfs;
(gdb) next
84 MP_STATE_VM(vfs_mount_table) = vfs;
(gdb) next
88 MP_STATE_PORT(vfs_cur) = vfs;
(gdb) next
89 }
(gdb) next
main () at ../../main.c:405
405 reset_port();
(gdb) next
409 autoreload_enable();
(gdb) next
413 filesystem_writable_by_python(false);
(gdb) next
409 autoreload_enable();
(gdb) next
415 run_boot_py(safe_mode);
(gdb) next
409 autoreload_enable();
(gdb) next
413 filesystem_writable_by_python(false);
(gdb) next
409 autoreload_enable();
(gdb) next
413 filesystem_writable_by_python(false);
(gdb) next
418 serial_init();
(gdb) next
413 filesystem_writable_by_python(false);
(gdb) next
415 run_boot_py(safe_mode);
(gdb) next
^[[A
^[[A
^[[A^[[A^C
Program received signal SIGTRAP, Trace/breakpoint trap.
0x00018ae8 in _spi_m_sync_trans (dev=0x20001afc <spi+4>, msg=msg@entry=0x20007ba4) at asf4/samd21/hpl/sercom/hpl_sercom.c:2849
2849 if (ctrl.txcnt >= msg->size && ctrl.rxcnt >= msg->size) {
(gdb) backtrace
#0 0x00018ae8 in _spi_m_sync_trans (dev=0x20001afc <spi+4>, msg=msg@entry=0x20007ba4) at asf4/samd21/hpl/sercom/hpl_sercom.c:2849
#1 0x00018b36 in spi_m_sync_transfer (p_xfer=<synthetic pointer>, spi=<optimized out>) at asf4/samd21/hal/src/hal_spi_m_sync.c:201
#2 _spi_m_sync_io_write.lto_priv.806 (io=<optimized out>, buf=<optimized out>, length=<optimized out>) at asf4/samd21/hal/src/hal_spi_m_sync.c:188
#3 0x000263dc in common_hal_busio_spi_write.part.1 (self=<optimized out>, data=<optimized out>, len=<optimized out>) at common-hal/busio/SPI.c:311
#4 0x0002ac46 in common_hal_busio_spi_write (len=1, data=0x20007bd7 "\005\241", self=0x20001af8 <spi>) at ../../supervisor/shared/external_flash/spi_flash.c:57
#5 transfer (data_length=1, data_out=0x20007bd4 "\377\360\377\005\241", data_in=0x0, command_length=1, command=0x20007bd7 "\005\241") at ../../supervisor/shared/external_flash/spi_flash.c:58
#6 transfer_command (data_length=1, data_out=0x20007bd4 "\377\360\377\005\241", data_in=0x0, command=<optimized out>) at ../../supervisor/shared/external_flash/spi_flash.c:73
#7 spi_flash_read_command (data_length=1, data=0x20007bd4 "\377\360\377\005\241", command=5 '\005') at ../../supervisor/shared/external_flash/spi_flash.c:81
#8 wait_for_flash_ready () at ../../supervisor/shared/external_flash/external_flash.c:64
#9 0x0002bbf4 in external_flash_write_block (block=161, data=0x2000124c <_internal_vfs.lto_priv.994+116> "Adafruit CircuitPython 4.0.0-alpha.3-3-gb823cbd08-dirty on 2018-11-21; Espress0 with samd21e18\r\n")
at ../../supervisor/shared/external_flash/external_flash.c:491
#10 supervisor_flash_write_blocks (num_blocks=<optimized out>, block_num=<optimized out>, src=<optimized out>) at ../../supervisor/shared/external_flash/external_flash.c:541
#11 flash_write_blocks (src=<optimized out>, block_num=<optimized out>, num_blocks=<optimized out>, num_blocks=<optimized out>, block_num=<optimized out>, src=<optimized out>) at ../../supervisor/shared/flash.c:141
#12 0x0000b7a0 in disk_write (pdrv=<optimized out>, buff=<optimized out>, sector=<optimized out>, count=<optimized out>, count=<optimized out>, sector=<optimized out>, buff=<optimized out>, pdrv=<optimized out>)
at ../../extmod/vfs_fat_diskio.c:120
#13 0x000184ae in sync_window.part.2 (fs=0x20001210 <_internal_vfs.lto_priv.994+56>) at ../../lib/oofatfs/ff.c:857
#14 0x000184ee in sync_window (fs=<optimized out>) at ../../lib/oofatfs/ff.c:855
#15 0x00019a12 in move_window.lto_priv.1055 (fs=<optimized out>, sector=<optimized out>, sector=<optimized out>, fs=<optimized out>) at ../../lib/oofatfs/ff.c:885
#16 0x0001a798 in dir_find (dp=dp@entry=0x20007d18) at ../../lib/oofatfs/ff.c:2179
#17 0x0001ab84 in follow_path.lto_priv.1059 (dp=dp@entry=0x20007d18, path=0x30ac0 "settings.py", path@entry=0x30ab3 "settings.txt") at ../../lib/oofatfs/ff.c:2785
#18 0x0001abf6 in f_stat (fs=0x20001210 <_internal_vfs.lto_priv.994+56>, path=0x30ab3 "settings.txt", fno=0x20007d60) at ../../lib/oofatfs/ff.c:4165
#19 0x0001f44c in fat_vfs_import_stat (vfs_in=<optimized out>, path=<optimized out>) at ../../extmod/vfs_fat.c:57
#20 0x00020132 in mp_vfs_import_stat (path=<optimized out>) at ../../extmod/vfs.c:131
#21 0x0000b3e6 in first_existing_file_in_list (filenames=filenames@entry=0x20000014 <boot_py_filenames>) at ../../main.c:135
#22 0x0000b3fe in maybe_run_list (filenames=filenames@entry=0x20000014 <boot_py_filenames>, exec_result=exec_result@entry=0x0) at ../../main.c:150
#23 0x0000ba6e in run_boot_py (safe_mode=safe_mode@entry=NO_SAFE_MODE) at ../../main.c:346
#24 0x0000bd6e in main () at ../../main.c:415
(gdb) load
Loading section .text, size 0x35b84 lma 0x2000
Loading section .ARM.exidx, size 0x8 lma 0x37b84
Loading section .data, size 0x17c lma 0x37b8c
Start address 0x2000, load size 220424
Transfer rate: 35876 KB/sec, 13776 bytes/write.
(gdb) monitor reset
Resetting target
(gdb) continue
Continuing.
Breakpoint 6, filesystem_init (create_allowed=true, force_create=false) at ../../supervisor/shared/filesystem.c:50
50 supervisor_flash_init_vfs(vfs_fat);
(gdb) continue
Continuing.
^C
Program received signal SIGTRAP, Trace/breakpoint trap.
_spi_m_sync_trans (dev=0x20001afc <spi+4>, msg=msg@entry=0x20007bbc) at asf4/samd21/hpl/sercom/hpl_sercom.c:2844
2844 rc = _spi_err_check(iflag, hw);
(gdb) backtrace
#0 _spi_m_sync_trans (dev=0x20001afc <spi+4>, msg=msg@entry=0x20007bbc) at asf4/samd21/hpl/sercom/hpl_sercom.c:2844
#1 0x00018b4c in spi_m_sync_transfer (p_xfer=<synthetic pointer>, spi=<optimized out>) at asf4/samd21/hal/src/hal_spi_m_sync.c:201
#2 _spi_m_sync_io_read.lto_priv.805 (io=<optimized out>, buf=<optimized out>, length=<optimized out>) at asf4/samd21/hal/src/hal_spi_m_sync.c:157
#3 0x0002ac60 in common_hal_busio_spi_read (write_value=255 '\377', len=1, data=0x20007bd4 "\377\360\377\005\243", self=0x20001af8 <spi>) at common-hal/busio/SPI.c:330
#4 transfer (data_length=1, data_out=0x20007bd4 "\377\360\377\005\243", data_in=0x0, command_length=1, command=0x20007bd7 "\005\243") at ../../supervisor/shared/external_flash/spi_flash.c:63
#5 transfer_command (data_length=1, data_out=0x20007bd4 "\377\360\377\005\243", data_in=0x0, command=<optimized out>) at ../../supervisor/shared/external_flash/spi_flash.c:73
#6 spi_flash_read_command (data_length=1, data=0x20007bd4 "\377\360\377\005\243", command=5 '\005') at ../../supervisor/shared/external_flash/spi_flash.c:81
#7 wait_for_flash_ready () at ../../supervisor/shared/external_flash/external_flash.c:64
#8 0x0002bbf4 in external_flash_write_block (block=163,
data=0x2000124c <_internal_vfs.lto_priv.994+116> "Adafruit CircuitPython 4.0.0-alpha.3-3-gb823cbd08-dirty on 2018-11-21; Espress0 with samd21e18\r\n\377\017")
at ../../supervisor/shared/external_flash/external_flash.c:491
#9 supervisor_flash_write_blocks (num_blocks=<optimized out>, block_num=<optimized out>, src=<optimized out>) at ../../supervisor/shared/external_flash/external_flash.c:541
#10 flash_write_blocks (src=<optimized out>, block_num=<optimized out>, num_blocks=<optimized out>, num_blocks=<optimized out>, block_num=<optimized out>, src=<optimized out>)
at ../../supervisor/shared/flash.c:141
#11 0x0000b7a0 in disk_write (pdrv=<optimized out>, buff=<optimized out>, sector=<optimized out>, count=<optimized out>, count=<optimized out>, sector=<optimized out>, buff=<optimized out>,
pdrv=<optimized out>) at ../../extmod/vfs_fat_diskio.c:120
#12 0x000184ae in sync_window.part.2 (fs=0x20001210 <_internal_vfs.lto_priv.994+56>) at ../../lib/oofatfs/ff.c:857
#13 0x000184ee in sync_window (fs=<optimized out>) at ../../lib/oofatfs/ff.c:855
#14 0x00019a12 in move_window.lto_priv.1055 (fs=<optimized out>, sector=<optimized out>, sector=<optimized out>, fs=<optimized out>) at ../../lib/oofatfs/ff.c:885
#15 0x0001a798 in dir_find (dp=dp@entry=0x20007d18) at ../../lib/oofatfs/ff.c:2179
#16 0x0001ab84 in follow_path.lto_priv.1059 (dp=dp@entry=0x20007d18, path=0x30ac0 "settings.py", path@entry=0x30ab3 "settings.txt") at ../../lib/oofatfs/ff.c:2785
#17 0x0001abf6 in f_stat (fs=0x20001210 <_internal_vfs.lto_priv.994+56>, path=0x30ab3 "settings.txt", fno=0x20007d60) at ../../lib/oofatfs/ff.c:4165
#18 0x0001f44c in fat_vfs_import_stat (vfs_in=<optimized out>, path=<optimized out>) at ../../extmod/vfs_fat.c:57
#19 0x00020132 in mp_vfs_import_stat (path=<optimized out>) at ../../extmod/vfs.c:131
#20 0x0000b3e6 in first_existing_file_in_list (filenames=filenames@entry=0x20000014 <boot_py_filenames>) at ../../main.c:135
#21 0x0000b3fe in maybe_run_list (filenames=filenames@entry=0x20000014 <boot_py_filenames>, exec_result=exec_result@entry=0x0) at ../../main.c:150
#22 0x0000ba6e in run_boot_py (safe_mode=safe_mode@entry=NO_SAFE_MODE) at ../../main.c:346
#23 0x0000bd6e in main () at ../../main.c:415
(gdb) break external_flash.c:210
Breakpoint 1 at 0x2b284: file ../../supervisor/shared/external_flash/external_flash.c, line 210.
(gdb) load
Loading section .text, size 0x35b54 lma 0x2000
Loading section .ARM.exidx, size 0x8 lma 0x37b54
Loading section .data, size 0x17c lma 0x37b5c
Start address 0x2000, load size 220376
Transfer rate: 30744 KB/sec, 13773 bytes/write.
(gdb) monitor reset
Resetting target
(gdb) continue
Continuing.
Breakpoint 1, supervisor_flash_init ()
at ../../supervisor/shared/external_flash/external_flash.c:210
210 if (flash_device == NULL) {
(gdb) continue
Continuing.
^C
Program received signal SIGTRAP, Trace/breakpoint trap.
0x00018ae4 in _spi_m_sync_trans (dev=0x20001afc <spi+4>,
msg=msg@entry=0x20007ba4) at asf4/samd21/hpl/sercom/hpl_sercom.c:2849
2849 if (ctrl.txcnt >= msg->size && ctrl.rxcnt >= msg->size) {
(gdb) backtrace
#0 0x00018ae4 in _spi_m_sync_trans (dev=0x20001afc <spi+4>,
msg=msg@entry=0x20007ba4) at asf4/samd21/hpl/sercom/hpl_sercom.c:2849
#1 0x00018b36 in spi_m_sync_transfer (p_xfer=<synthetic pointer>,
spi=<optimized out>) at asf4/samd21/hal/src/hal_spi_m_sync.c:201
#2 _spi_m_sync_io_write.lto_priv.806 (io=<optimized out>,
buf=<optimized out>, length=<optimized out>)
at asf4/samd21/hal/src/hal_spi_m_sync.c:188
#3 0x000263dc in common_hal_busio_spi_write.part.1 (self=<optimized out>,
data=<optimized out>, len=<optimized out>) at common-hal/busio/SPI.c:311
#4 0x0002ac08 in common_hal_busio_spi_write (len=1, data=0x20007bd7 "\005)",
self=0x20001af8 <spi>)
at ../../supervisor/shared/external_flash/spi_flash.c:57
#5 transfer (data_length=1, data_out=0x20007bd4 "\377\360\377\005)",
data_in=0x0, command_length=1, command=0x20007bd7 "\005)")
at ../../supervisor/shared/external_flash/spi_flash.c:58
#6 transfer_command (data_length=1, data_out=0x20007bd4 "\377\360\377\005)",
data_in=0x0, command=<optimized out>)
at ../../supervisor/shared/external_flash/spi_flash.c:73
#7 spi_flash_read_command (data_length=1,
data=0x20007bd4 "\377\360\377\005)", command=5 '\005')
at ../../supervisor/shared/external_flash/spi_flash.c:81
#8 wait_for_flash_ready ()
at ../../supervisor/shared/external_flash/external_flash.c:64
---Type <return> to continue, or q <return> to quit---
#9 0x0002bbdc in external_flash_write_block (block=41,
data=0x2000124c <_internal_vfs.lto_priv.994+116> "Adafruit CircuitPython 4.0.0-alpha.3-4-g28dc5a65d-dirty on 2018-11-21; Espress0 with samd21e18\r\n") at ../../supervisor/shared/external_flash/external_flash.c:491
#10 supervisor_flash_write_blocks (num_blocks=<optimized out>, block_num=<optimized out>, src=<optimized out>)
at ../../supervisor/shared/external_flash/external_flash.c:541
#11 flash_write_blocks (src=<optimized out>, block_num=<optimized out>, num_blocks=<optimized out>,
num_blocks=<optimized out>, block_num=<optimized out>, src=<optimized out>) at ../../supervisor/shared/flash.c:141
#12 0x0000b7a0 in disk_write (pdrv=<optimized out>, buff=<optimized out>, sector=<optimized out>, count=<optimized out>,
count=<optimized out>, sector=<optimized out>, buff=<optimized out>, pdrv=<optimized out>)
at ../../extmod/vfs_fat_diskio.c:120
#13 0x000184ae in sync_window.part.2 (fs=0x20001210 <_internal_vfs.lto_priv.994+56>) at ../../lib/oofatfs/ff.c:857
#14 0x000184ee in sync_window (fs=<optimized out>) at ../../lib/oofatfs/ff.c:855
#15 0x00019a12 in move_window.lto_priv.1055 (fs=<optimized out>, sector=<optimized out>, sector=<optimized out>,
fs=<optimized out>) at ../../lib/oofatfs/ff.c:885
#16 0x0001a798 in dir_find (dp=dp@entry=0x20007d18) at ../../lib/oofatfs/ff.c:2179
#17 0x0001ab84 in follow_path.lto_priv.1059 (dp=dp@entry=0x20007d18, path=0x30aa8 "settings.py",
path@entry=0x30a9b "settings.txt") at ../../lib/oofatfs/ff.c:2785
#18 0x0001abf6 in f_stat (fs=0x20001210 <_internal_vfs.lto_priv.994+56>, path=0x30a9b "settings.txt", fno=0x20007d60)
at ../../lib/oofatfs/ff.c:4165
#19 0x0001f44c in fat_vfs_import_stat (vfs_in=<optimized out>, path=<optimized out>) at ../../extmod/vfs_fat.c:57
#20 0x00020132 in mp_vfs_import_stat (path=<optimized out>) at ../../extmod/vfs.c:131
#21 0x0000b3e6 in first_existing_file_in_list (filenames=filenames@entry=0x20000014 <boot_py_filenames>) at ../../main.c:135
#22 0x0000b3fe in maybe_run_list (filenames=filenames@entry=0x20000014 <boot_py_filenames>, exec_result=exec_result@entry=0x0)
at ../../main.c:150
#23 0x0000ba6e in run_boot_py (safe_mode=safe_mode@entry=NO_SAFE_MODE) at ../../main.c:346
#24 0x0000bd6e in main () at ../../main.c:415
(gdb)
I did move spi flash to using the internal common_hal apis instead of dedicated code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment