diff --git a/radio/src/targets/simu/simpgmspace.cpp b/radio/src/targets/simu/simpgmspace.cpp index 86594f80c..0c98ac870 100644 --- a/radio/src/targets/simu/simpgmspace.cpp +++ b/radio/src/targets/simu/simpgmspace.cpp @@ -24,7 +24,7 @@ #include #include -#if !defined _MSC_VER +#if !defined _MSC_VER || defined __GNUC__ #include #endif @@ -34,6 +34,7 @@ #if defined(SIMU_AUDIO) && defined(CPUARM) #include + #undef main #endif #if defined(TRACE_SIMPGMSPACE) @@ -43,6 +44,10 @@ #define TRACE_SIMPGMSPACE(...) #endif +#if defined(SDCARD) && !defined(SKIP_FATFS_DECLARATION) && !defined(SIMU_DISKIO) + #define SIMU_USE_SDCARD +#endif + uint8_t MCUCSR, MCUSR, MCUCR; volatile uint8_t pina=0xff, pinb=0xff, pinc=0xff, pind, pine=0xff, pinf=0xff, ping=0xff, pinh=0xff, pinj=0, pinl=0; uint8_t portb, portc, porth=0, dummyport; @@ -73,7 +78,7 @@ Dacc dacc; Adc Adc0; #endif -#if defined(SDCARD) && !defined(SKIP_FATFS_DECLARATION) +#if defined(SIMU_USE_SDCARD) char simuSdDirectory[1024] = ""; #endif @@ -308,9 +313,9 @@ void StartSimu(bool tests) main_thread_running = (tests ? 1 : 2); // TODO rename to simu_run_mode with #define -#if defined(SDCARD) +#if defined(SIMU_USE_SDCARD) if (strlen(simuSdDirectory) == 0) { - getcwd(simuSdDirectory, 1024); + f_getcwd(simuSdDirectory, 1024); } #endif @@ -518,7 +523,7 @@ uint16_t stackAvailable() return 500; } -#if defined(SDCARD) && !defined(SKIP_FATFS_DECLARATION) && !defined(SIMU_DISKIO) +#if defined(SIMU_USE_SDCARD) #if defined(_MSC_VER) || !defined(__GNUC__) #include #include @@ -570,7 +575,7 @@ char *findTrueFileName(const char *path) else { //find file //add to map -#if defined WIN32 || !defined __GNUC__ +#if defined _MSC_VER || !defined __GNUC__ char drive[_MAX_DRIVE]; char dir[_MAX_DIR]; char fname[_MAX_FNAME]; @@ -608,7 +613,7 @@ char *findTrueFileName(const char *path) for (;;) { struct simu::dirent * res = simu::readdir(dir); if (res == 0) break; -#if defined(__APPLE__) || defined(__FreeBSD__) +#if defined(WIN32) || defined(__APPLE__) || defined(__FreeBSD__) if ((res->d_type == DT_REG) || (res->d_type == DT_LNK)) { #else if ((res->d_type == simu::DT_REG) || (res->d_type == simu::DT_LNK)) { @@ -960,7 +965,7 @@ int32_t Card_state = SD_ST_MOUNTED; uint32_t Card_CSD[4]; // TODO elsewhere #endif -#endif // #if defined(SDCARD) && !defined(SKIP_FATFS_DECLARATION) && !defined(SIMU_DISKIO) +#endif // #if defined(SIMU_USE_SDCARD) #if defined(SIMU_DISKIO) diff --git a/radio/src/targets/simu/simpgmspace.h b/radio/src/targets/simu/simpgmspace.h index 76f20e8d6..f4352c0c1 100644 --- a/radio/src/targets/simu/simpgmspace.h +++ b/radio/src/targets/simu/simpgmspace.h @@ -38,7 +38,7 @@ extern char * main_thread_error; #include #include #include -#if defined(WIN32) || !defined(__GNUC__) +#if defined(_MSC_VER) || !defined(__GNUC__) #define write_backtrace(output) #else #include @@ -339,7 +339,7 @@ extern void rxPdcUsart( void (*pChProcess)(uint8_t x) ); #define ISR(x, ...) void x() -#if !defined(WIN32) && defined(__GNUC__) +#if !defined(_MSC_VER) && defined(__GNUC__) #define asm(...) #endif