diff --git a/platformio.ini b/platformio.ini index ba13453..d5a5248 100644 --- a/platformio.ini +++ b/platformio.ini @@ -23,13 +23,13 @@ build_unflags = -Os -DARDUINO_ARCH_STM32F1 build_flags = - -O3 -w - -DDEBUG_LEVEL=DEBUG_NONE -DARDUINO_GENERIC_STM32F103C -DARDUINO_LIB_DISCOVERY_PHASE -DARDUINO=10813 -DARDUINO_ARCH_STM32 + -DDEBUG_LEVEL=DEBUG_NONE + -O3 ; Possible work around for clones, untested. ; https://community.platformio.org/t/cannot-upload-to-stm32-bluepill-board-over-stlink-v2/3492/25 diff --git a/src/BlueSCSI.cpp b/src/BlueSCSI.cpp index 9c205ae..049d4f3 100644 --- a/src/BlueSCSI.cpp +++ b/src/BlueSCSI.cpp @@ -164,11 +164,9 @@ SdFs SD; #define SCSI_TARGET_INACTIVE() { SCSI_OUT(vREQ,inactive); SCSI_OUT(vMSG,inactive); SCSI_OUT(vCD,inactive);SCSI_OUT(vIO,inactive); SCSI_OUT(vBSY,inactive); gpio_mode(BSY, GPIO_INPUT_PU); } // HDDiamge file -#define HDIMG_FILE_256 "HDxx_256.hda" // BLOCKSIZE=256 HDD image file -#define HDIMG_FILE_512 "HDxx_512.hda" // BLOCKSIZE=512 HDD image file name base -#define HDIMG_FILE_1024 "HDxx_1024.hda" // BLOCKSIZE=1024 HDD image file #define HDIMG_ID_POS 2 // Position to embed ID number #define HDIMG_LUN_POS 3 // Position to embed LUN numbers +#define HDIMG_BLK_POS 5 // Position to embed block size numbers #define MAX_FILE_PATH 32 // Maximum file name length // HDD image @@ -277,20 +275,14 @@ inline byte readIO(void) bool hddimageOpen(HDDIMG *h,const char *image_name,int id,int lun,int blocksize) { - char file_path[MAX_FILE_PATH+1]; - - // build file path - strcpy(file_path,image_name); - file_path[HDIMG_ID_POS ] = '0'+id; - file_path[HDIMG_LUN_POS] = '0'+lun; h->m_fileSize = 0; h->m_blocksize = blocksize; - h->m_file = SD.open(file_path, O_RDWR); + h->m_file = SD.open(image_name, O_RDWR); if(h->m_file.isOpen()) { h->m_fileSize = h->m_file.size(); LOG_FILE.print("Imagefile: "); - LOG_FILE.print(file_path); + LOG_FILE.print(image_name); if(h->m_fileSize>0) { // check blocksize dummy file @@ -375,31 +367,49 @@ void setup() m_buf[MAX_BLOCKSIZE] = 0xff; // DB0 all off,DBP off //HD image file open scsi_id_mask = 0x00; - for(int id=0;id