mirror of
https://github.com/libretro/Mu.git
synced 2026-09-23 07:05:37 +00:00
Add debug functions for Cyclone
This commit is contained in:
2
bugs/regressions.txt
Normal file
2
bugs/regressions.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
RetroArch port crashes on exit
|
||||
Endian compatibility is broken
|
||||
@@ -24,7 +24,7 @@ RxOverflow on SPI1, don't know if back or front of FIFO is overwritten on overfl
|
||||
ICR POL(1,2,3,6) may flip the pin value as well as the interrupt, POL5 does not flip the INT5 pin though, this was confirmed with a hardware test(it doesnt seem to but there is instability on the pin when the SD card is plugged in, this may have to do with card detect also being a data line on the SD pinout)
|
||||
edge triggered INT* don't clear on write to ISR when masked in IMR(at least that seems to be the reason)
|
||||
if a sound interrupt is triggered while the button interrupt is disabled the button interrupt will still trigger(in galax game)
|
||||
PWM1 output value is not a direct range cast of 0<->255 to 0<->32767, its additive, see properPwmSineWave.png
|
||||
Cyclone CPU emulator is not working
|
||||
|
||||
Debug tools:
|
||||
ADS7846 channels can't be read in single reference mode in hwTestSuite
|
||||
@@ -48,6 +48,7 @@ in the edge case that SPICLK2 is disabled while using ADS7846 and a 1 was the la
|
||||
|
||||
|
||||
Fixed:
|
||||
PWM1 output value is not a direct range cast of 0<->255 to 0<->32767, its additive, see properPwmSineWave.png
|
||||
inductor dosent properly drain when PWM1 gets disabled
|
||||
PWM1 FIFOAV is always set true
|
||||
may need to force sound generation until buffer is adequately filled when sound is on(not possible, INT_PWM1 is masked)
|
||||
|
||||
@@ -363,7 +363,7 @@ bool retro_load_game(const struct retro_game_info *info){
|
||||
if(saveRamFile){
|
||||
if(vfs_interface->size(saveRamFile) == emulatorGetRamSize()){
|
||||
vfs_interface->read(saveRamFile, palmRam, emulatorGetRamSize());
|
||||
swap16_buffer_if_little(palmRam, emulatorGetRamSize() / 2);
|
||||
swap16_buffer_if_little(palmRam, emulatorGetRamSize() / sizeof(uint16_t));
|
||||
}
|
||||
vfs_interface->close(saveRamFile);
|
||||
}
|
||||
@@ -395,7 +395,7 @@ void retro_unload_game(void){
|
||||
saveRamFile = vfs_interface->open(saveRamPath, RETRO_VFS_FILE_ACCESS_WRITE, RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
|
||||
if(saveRamFile){
|
||||
swap16_buffer_if_little(palmRam, emulatorGetRamSize() / 2);//this will no longer be used, so its ok to destroy it when swapping
|
||||
swap16_buffer_if_little(palmRam, emulatorGetRamSize() / sizeof(uint16_t));//this will no longer be used, so its ok to destroy it when swapping
|
||||
vfs_interface->write(saveRamFile, palmRam, emulatorGetRamSize());
|
||||
vfs_interface->close(saveRamFile);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ android{
|
||||
QMAKE_CXXFLAGS += -fopenmp
|
||||
QMAKE_LFLAGS += -fopenmp
|
||||
DEFINES += EMU_MULTITHREADED
|
||||
# CONFIG += optimize_for_arm # for now, later this will check if building for ARM
|
||||
CONFIG += optimize_for_arm # for now, later this will check if building for ARM
|
||||
}
|
||||
|
||||
ios{
|
||||
@@ -61,14 +61,17 @@ ios{
|
||||
|
||||
|
||||
CONFIG(debug, debug|release){
|
||||
# debug build, be accurate and add logging
|
||||
# debug build, be accurate, fail hard, and add logging
|
||||
# DEFINES += EMU_DEBUG EMU_CUSTOM_DEBUG_LOG_HANDLER
|
||||
# DEFINES += EMU_SANDBOX
|
||||
# DEFINES += EMU_SANDBOX_OPCODE_LEVEL_DEBUG
|
||||
# DEFINES += EMU_SANDBOX_LOG_APIS
|
||||
QMAKE_CFLAGS += -fstack-protector-strong -fsanitize=address,undefined -Werror=array-bounds
|
||||
QMAKE_CXXFLAGS += -fstack-protector-strong -fsanitize=address,undefined -Werror=array-bounds
|
||||
QMAKE_LFLAGS += -fsanitize=address,undefined
|
||||
macx{
|
||||
# -fsanitize=undefined,leak
|
||||
QMAKE_CFLAGS += -fstack-protector-strong -fsanitize=address -Werror=array-bounds
|
||||
QMAKE_CXXFLAGS += -fstack-protector-strong -fsanitize=address -Werror=array-bounds
|
||||
QMAKE_LFLAGS += -fsanitize=address
|
||||
}
|
||||
}else{
|
||||
# release build, go fast
|
||||
DEFINES += EMU_NO_SAFETY
|
||||
|
||||
@@ -58,10 +58,10 @@ uint32_t emulatorInit(buffer_t palmRomDump, buffer_t palmBootDump, uint32_t spec
|
||||
if(!palmRomDump.data)
|
||||
return EMU_ERROR_INVALID_PARAMETER;
|
||||
|
||||
//allocate the buffers
|
||||
palmRam = malloc((specialFeatures & FEATURE_RAM_HUGE) ? SUPERMASSIVE_RAM_SIZE : RAM_SIZE);
|
||||
palmRom = malloc(ROM_SIZE);
|
||||
palmReg = malloc(REG_SIZE);
|
||||
//allocate the buffers, add 4 to memory regions to prevent SIGSEGV from accessing off the end
|
||||
palmRam = malloc(((specialFeatures & FEATURE_RAM_HUGE) ? SUPERMASSIVE_RAM_SIZE : RAM_SIZE) + 4);
|
||||
palmRom = malloc(ROM_SIZE + 4);
|
||||
palmReg = malloc(REG_SIZE + 4);
|
||||
palmAudio = malloc(AUDIO_SAMPLES_PER_FRAME * 2 * sizeof(int16_t));
|
||||
palmAudioResampler = blip_new(AUDIO_SAMPLES_PER_FRAME * 2);//have more than one frame of samples in case its written to at the end of the frame
|
||||
if(specialFeatures & FEATURE_320x320)
|
||||
@@ -69,18 +69,12 @@ uint32_t emulatorInit(buffer_t palmRomDump, buffer_t palmBootDump, uint32_t spec
|
||||
else
|
||||
palmExtendedFramebuffer = NULL;
|
||||
if(!palmRam || !palmRom || !palmReg || !palmAudio || !palmAudioResampler || (!palmExtendedFramebuffer && (specialFeatures & FEATURE_320x320))){
|
||||
if(palmRam)
|
||||
free(palmRam);
|
||||
if(palmRom)
|
||||
free(palmRom);
|
||||
if(palmReg)
|
||||
free(palmReg);
|
||||
if(palmAudio)
|
||||
free(palmAudio);
|
||||
if(palmAudioResampler)
|
||||
blip_delete(palmAudioResampler);
|
||||
if(palmExtendedFramebuffer)
|
||||
free(palmExtendedFramebuffer);
|
||||
free(palmRam);
|
||||
free(palmRom);
|
||||
free(palmReg);
|
||||
free(palmAudio);
|
||||
blip_delete(palmAudioResampler);
|
||||
free(palmExtendedFramebuffer);
|
||||
return EMU_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
@@ -144,10 +138,8 @@ void emulatorExit(){
|
||||
free(palmReg);
|
||||
free(palmAudio);
|
||||
blip_delete(palmAudioResampler);
|
||||
if(palmSpecialFeatures & FEATURE_320x320)
|
||||
free(palmExtendedFramebuffer);
|
||||
if(palmSdCard.flashChip.data)
|
||||
free(palmSdCard.flashChip.data);
|
||||
free(palmExtendedFramebuffer);
|
||||
free(palmSdCard.flashChip.data);
|
||||
emulatorInitialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ typedef struct{
|
||||
#define AUDIO_WAIT_FOR_SAMPLE INT32_MIN
|
||||
|
||||
//emulator data, some are GUI interface variables, some should be left alone
|
||||
extern uint8_t* palmRam;//dont touch
|
||||
extern uint8_t* palmRam;//access allowed to read save RAM without allocating a giant buffer, but endianness must be taken into account
|
||||
extern uint8_t* palmRom;//dont touch
|
||||
extern uint8_t* palmReg;//dont touch
|
||||
extern input_t palmInput;//write allowed
|
||||
|
||||
@@ -211,7 +211,14 @@ uint32_t flx68000GetRegister(uint8_t reg){
|
||||
*/
|
||||
|
||||
#if defined(EMU_OPTIMIZE_FOR_ARM)
|
||||
//debug not supported on embedded devices yet
|
||||
if(reg < 8)
|
||||
return cycloneCpu.d[reg];
|
||||
else if(reg < 16)
|
||||
return cycloneCpu.a[reg - 8];
|
||||
else if(reg == 16)
|
||||
return cycloneCpu.pc;
|
||||
else if(reg == 17)
|
||||
return CycloneGetSr(&cycloneCpu);
|
||||
#else
|
||||
return m68k_get_reg(NULL, reg);
|
||||
#endif
|
||||
@@ -219,7 +226,7 @@ uint32_t flx68000GetRegister(uint8_t reg){
|
||||
|
||||
uint32_t flx68000GetPc(){
|
||||
#if defined(EMU_OPTIMIZE_FOR_ARM)
|
||||
//debug not supported on embedded devices yet
|
||||
return cycloneCpu.prev_pc;
|
||||
#else
|
||||
return m68k_get_reg(NULL, M68K_REG_PPC);
|
||||
#endif
|
||||
@@ -229,7 +236,25 @@ uint64_t flx68000ReadArbitraryMemory(uint32_t address, uint8_t size){
|
||||
uint64_t data = UINT64_MAX;//invalid access
|
||||
|
||||
#if defined(EMU_OPTIMIZE_FOR_ARM)
|
||||
//debug not supported on embedded devices yet
|
||||
//until SPI and UART destructive reads are implemented all reads to mapped addresses are safe, SPI is now implemented, this needs to be fixed
|
||||
if(bankType[START_BANK(address)] != CHIP_NONE){
|
||||
uint16_t m68kSr = CycloneGetSr(&cycloneCpu);
|
||||
CycloneSetSr(&cycloneCpu, m68kSr | 0x2000);//prevent privilege violations
|
||||
switch(size){
|
||||
case 8:
|
||||
data = m68k_read_memory_8(address);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
data = m68k_read_memory_16(address);
|
||||
break;
|
||||
|
||||
case 32:
|
||||
data = m68k_read_memory_32(address);
|
||||
break;
|
||||
}
|
||||
CycloneSetSr(&cycloneCpu, m68kSr);
|
||||
}
|
||||
#else
|
||||
//until SPI and UART destructive reads are implemented all reads to mapped addresses are safe, SPI is now implemented, this needs to be fixed
|
||||
if(bankType[START_BANK(address)] != CHIP_NONE){
|
||||
|
||||
@@ -283,6 +283,7 @@ void m68k_write_memory_16(unsigned int address, unsigned short value){
|
||||
break;
|
||||
|
||||
case CHIP_DX_RAM:
|
||||
printf("Ram Write 16, PC:0x%08X/n", flx68000GetPc());
|
||||
ramWrite16(address, value);
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user