@@ -6086,7 +6086,7 @@ bool link_command::execute(device_map &devices) {
6086
6086
6087
6087
#if HAS_LIBUSB
6088
6088
struct _bdevfs_setup {
6089
- picoboot::connection *con ;
6089
+ picoboot::connection *connection ;
6090
6090
std::shared_ptr<picoboot_memory_access> access;
6091
6091
uint32_t base_addr;
6092
6092
uint32_t size;
@@ -6095,14 +6095,13 @@ struct _bdevfs_setup {
6095
6095
};
6096
6096
_bdevfs_setup bdevfs_setup;
6097
6097
6098
- void setup_bdevfs (picoboot::connection con) {
6099
- auto raw_access_ptr = std::make_shared<picoboot_memory_access>(con);
6100
- auto raw_access = *raw_access_ptr;
6101
- bdevfs_setup.con = &con;
6102
- bdevfs_setup.access = raw_access_ptr;
6098
+ #define setup_bdevfs (con ) bdevfs_setup.access = std::make_shared<picoboot_memory_access>(con); bdevfs_setup.connection = &con; setup_bdevfs_internal()
6099
+
6100
+ void setup_bdevfs_internal () {
6101
+ auto raw_access = *bdevfs_setup.access ;
6103
6102
6104
6103
if (settings.bdev .partition >= 0 ) {
6105
- auto partitions = get_partitions (con );
6104
+ auto partitions = get_partitions (*bdevfs_setup. connection );
6106
6105
if (!partitions) {
6107
6106
fail (ERROR_NOT_POSSIBLE, " There is no partition table on the device" );
6108
6107
}
@@ -6256,7 +6255,7 @@ DRESULT disk_ioctl (void *drv, BYTE cmd, void* buff) {
6256
6255
if (start % FLASH_SECTOR_ERASE_SIZE) start += FLASH_SECTOR_ERASE_SIZE - (start % FLASH_SECTOR_ERASE_SIZE);
6257
6256
end -= end % FLASH_SECTOR_ERASE_SIZE;
6258
6257
for (uint32_t addr = start; addr < end; addr += FLASH_SECTOR_ERASE_SIZE) {
6259
- bdevfs_setup.con ->flash_erase (addr, FLASH_SECTOR_ERASE_SIZE);
6258
+ bdevfs_setup.connection ->flash_erase (addr, FLASH_SECTOR_ERASE_SIZE);
6260
6259
}
6261
6260
return RES_OK;
6262
6261
} else {
@@ -6383,7 +6382,7 @@ int lfs_prog(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, const
6383
6382
6384
6383
int lfs_erase (const struct lfs_config *c, lfs_block_t block) {
6385
6384
if (bdevfs_setup.writeable ) {
6386
- bdevfs_setup.con ->flash_erase (bdevfs_setup.base_addr + (block * c->block_size ), c->block_size );
6385
+ bdevfs_setup.connection ->flash_erase (bdevfs_setup.base_addr + (block * c->block_size ), c->block_size );
6387
6386
return LFS_ERR_OK;
6388
6387
} else {
6389
6388
fail (ERROR_NOT_POSSIBLE, " This block device is not writeable" );
@@ -6498,6 +6497,8 @@ bool bdev_ls_command::execute(device_map &devices) {
6498
6497
dir.pop_back ();
6499
6498
}
6500
6499
6500
+ fos << settings.filenames [0 ] << " /\n " ;
6501
+
6501
6502
switch (settings.bdev .fs ) {
6502
6503
case fs_littlefs: {
6503
6504
lfs_op_fn lfs_op = [&](lfs_t *lfs) {
@@ -6555,6 +6556,9 @@ bool bdev_mkdir_command::execute(device_map &devices) {
6555
6556
default :
6556
6557
fail (ERROR_ARGS, " Unknown filesystem specified" );
6557
6558
}
6559
+
6560
+ fos << " Created directory " << settings.filenames [0 ] << " on device\n " ;
6561
+
6558
6562
return false ;
6559
6563
}
6560
6564
@@ -6725,6 +6729,9 @@ bool bdev_rm_command::execute(device_map &devices) {
6725
6729
default :
6726
6730
fail (ERROR_ARGS, " Unknown filesystem specified" );
6727
6731
}
6732
+
6733
+ fos << " Removed " << settings.filenames [0 ] << " from device\n " ;
6734
+
6728
6735
return false ;
6729
6736
}
6730
6737
0 commit comments