Where in the code are you copying an SD binary into SPIRAM? It appears you are doing it image by image. I've been reading an entire file in sector by sector. I'm suspecting strongly that my binary reading function is faulty. I have a code snip-it below that shows how I am reading the data. Again, this all works on the emulator but not the hardware. I'm using the portable and my original unit. Both encounter the error at the same position.
I tried the portable and my original Uzebox unit with the RPG I was working on. It worked just fine on the emulator and both hardware units.
I'm really starting to suspect that this has something to do with the screen resolution. In the past I have been able to use SPIRAM and the SD card with the bootlib library but the screen dimensions were different.
Code: Select all
// (void)(SPSR); // http://uzebox.org/forums/viewtopic.php?f=3&t=7788&p=27613&hilit=SPSR#p27609
u32 pos;
do{
debugDisplay(0,numSectorsToRead);
debugDisplay(1,sectorCount);
debugDisplay(2,readFlag1);
readFlag1 = FS_Read_Sector(&sdFile1Ptr);
pos = sectorCount*512UL;
// Read 512 bytes at a time.
// bank = getBankFromPos(pos);
// addr = getAddrFromPos(pos);
// SpiRamWriteFrom(bank, addr, ram_tiles, 512UL);
// Write one byte at a time.
for(u32 i=0; i<512UL; i+=1){
// WaitVsync(1);
SpiRamWriteU8(
getBankFromPos( pos + i ),
getAddrFromPos( pos + i ),
ram_tiles[i]
);
}
// Check the read. Make sure the SPIRAM values for the sector match the sector read.
for(u32 i=0; i<512UL; i+=1){
u8 check1=ram_tiles[i];
u8 check2=SpiRamReadU8 ( getBankFromPos(pos+i), getAddrFromPos(pos+i) );
if(check1 != check2 ) {
debugDisplay(2,i);
debugDisplay(3,check1);
debugDisplay(4,check2);
errorCrash(ERROR_WHERE_BYTEREADERROR, i);
}
}
nextFlag = FS_Next_Sector(&sdFile1Ptr);
if(nextFlag){ errorCrash(ERROR_WHERE_FS_NEXT_SECTOR, nextFlag); }
sectorCount++;
}
// Repeat until done.
while(sectorsRemaining--);