16/32 Posted June 3, 2016 Share Posted June 3, 2016 Hello Folks, I'm a new member here at AtariAge. My first computer was an 800xl 1985, and i love that little thing since then. Playing games now and then.. Mostly i play from cartidge or sometimes cassette. I've been trying to get an sio2arduino working But i seem to have some problems with the sketch (i found on, https://github.com/whizzosoftware/SIO2Arduino)I also installed sfat library. When i try to verify the sketch i get some error messages. iI seached internet but i diden't found any solution for this. SIO2Arduino:53: error: 'getDeviceStatus' was not declared in this scope DriveAccess driveAccess(getDeviceStatus, readSector, writeSector, format); SIO2Arduino:53: error: 'readSector' was not declared in this scopeDriveAccess driveAccess(getDeviceStatus, readSector, writeSector, format);SIO2Arduino:53: error: 'writeSector' was not declared in this scopeDriveAccess driveAccess(getDeviceStatus, readSector, writeSector, format); SIO2Arduino:53: error: 'format' was not declared in this scope DriveAccess driveAccess(getDeviceStatus, readSector, writeSector, format); SIO2Arduino:54: error: 'getFileList' was not declared in this scopeDriveControl driveControl(getFileList, mountFileIndex, changeDirectory);SIO2Arduino:54: error: 'mountFileIndex' was not declared in this scope DriveControl driveControl(getFileList, mountFileIndex, changeDirectory);SIO2Arduino:54: error: 'changeDirectory' was not declared in this scopeDriveControl driveControl(getFileList, mountFileIndex, changeDirectory);exit status 1'getDeviceStatus' was not declared in this scope Hopefully somebody i'm not the only one who has been seeing this error message before, and knows how to fix this.. thx anyway Quote Link to comment Share on other sites More sharing options...
Justin Payne Posted June 3, 2016 Share Posted June 3, 2016 Hopefully someone with better C++ skilz with fact check me on this but in C/C++, you're supposed to declare your methods before using them. I look at the file SIO2Arduino.ino, where those methods are implemented but there is not declaration. For example, let's take this method (Which is one of the errors) DriveStatus* getDeviceStatus(int deviceId) { return drive1.getStatus(); } Before this, I would expect to see DriveStatus* getDeviceStatus(int deviceId); There are some other header files that might have the declaration in it but I doubt it since you're getting this error. Quote Link to comment Share on other sites More sharing options...
16/32 Posted June 3, 2016 Author Share Posted June 3, 2016 Hi Justin thanks for you're fast response! My knowledge about the aduino is very little.. So i don't now how to declare methods before using them I also tried to copy Drivestatus* getDeviceStatus(int deviceId); line into the sketch, but still get the same error. Probaly i'm doing something wrong, since more people seem to succesfully us sio2arduino.. hope i got this figured out soon. Quote Link to comment Share on other sites More sharing options...
Justin Payne Posted June 3, 2016 Share Posted June 3, 2016 I haven't had a chance to develop on an Arduino so I had too look up what Sketch was. It appears that the code you write for the Arduino is similar to C++. How similar, I don't exactly know so take what I'm saying with a grain of salt but as I mentioned, that error your getting make me think that my solution might resolve it. So, I assume you're trying to compile the application and your getting these errors. Let's look at the first error.... SIO2Arduino:53: error: 'getDeviceStatus' was not declared in this scope DriveAccess driveAccess(getDeviceStatus, readSector, writeSector, format); This error is generated by your compiler. While it's doing it's checking it noticed the method driveAccess is being passed the value returned by the method getDeviceStatus. So,you're trying to call a method BUT you haven't previously declared the method prior to using it. The solution to this is for that method to be declared before this is called. That would look something like... DriveStatus* getDeviceStatus(int deviceId); Now, since someone else wrote this code and you're just trying to compile it to a Sketch, one would think that this issue would have been previously discovered. The only way it wouldn't have is if there is some compiler flag that says "please ignore this issue". I'm not sure why you would want to do other than maybe saving bytes. I'm stabbing in the dark at this point but if you wanted to test it, just add that before that method call "DriveAccess driveAccess(getDeviceStatus, readSector, writeSector, format);". If that error goes away, you know your solution. This is a solution to fixing the code but I really think the developer of the code should do that OR tell you the proper way to compile the app. In C/C++, someone would create a Make file which just builds the app for you. I don't know how all this works in the Arduino IDE.This is just what I think might be the problem. I would need a bit more time to understand this languages syntax and compiler.Does that make sense? Quote Link to comment Share on other sites More sharing options...
Justin Payne Posted June 3, 2016 Share Posted June 3, 2016 Looks like I was right. Here is an example of someone having the same issue. http://forum.arduino.cc/index.php?topic=42835.0 If you're not familiar with C++, I like Derek Banas's tutorials (https://www.youtube.com/user/derekbanas). Quote Link to comment Share on other sites More sharing options...
16/32 Posted June 3, 2016 Author Share Posted June 3, 2016 So i added the line DriveStatus* getDeviceStatus (int deviceId) ;. Now the error 'getDeviceStatus' was not declared in this scope dissapeared But unfortunally i still get all the other error messages.. I was looking on the internet and found someone else with the same problem, he got it fixed with an earlier version Arduino IDE 1.0.1. Offcourse i tried it with the 1.0.1. version, and it looks like the errors are gone.. But now it got the next message: SIO2aduino.cpp in function 'boolean format(int, int)': SIO2arduino:167: error: 'class sdfile' has no member 'getfilename' So i'm still stuck with my duino.. I really appreciate you're help, i really can't figure out this by meself, my knowlegde about arduino's and c++ is as good as nothing.. Quote Link to comment Share on other sites More sharing options...
Justin Payne Posted June 3, 2016 Share Posted June 3, 2016 Good. That's exactly what I expected.Now you're going to kick yourself. All of the errors are the same. It's just the method that is different. All of them were never declared but they're being used. Let's take the next error in the list... SIO2Arduino:53: error: 'readSector' was not declared in this scope DriveAccess driveAccess(getDeviceStatus, readSector, writeSector, format); Looks like readSector is being access prior to being declared. Notice it's the second argument in the driveAccess parameters. You need to do the same thing as before. Here is that readSector method... SectorDataInfo* readSector(int deviceId, unsigned long sector, byte *data) { if (drive1.hasImage()) { return drive1.getSectorData(sector, data); } else { return NULL; } } Right under the declaration you added for the other method, add this one as well. SectorDataInfo* readSector(int deviceId, unsigned long sector, byte *data); Then, all you have to do is just... Continue down that error list looking for methods that are throwing that error Find that method of the same name in the code Copy the first line of the method and paste it under the other method declarations you added previously. For example. SectorDataInfo* readSector(int deviceId, unsigned long sector, byte *data) Add a semicolon to the end. For example. SectorDataInfo* readSector(int deviceId, unsigned long sector, byte *data); After you've finished it for all of them, recompile and hopefully no more errors but let me know if you do. Quote Link to comment Share on other sites More sharing options...
Justin Payne Posted June 3, 2016 Share Posted June 3, 2016 Sry. Read your response too quickly. This is probably a different issue but seema straight forward. I'll look at the code when I get home in a few. Quote Link to comment Share on other sites More sharing options...
Justin Payne Posted June 4, 2016 Share Posted June 4, 2016 After refreshing my memories of C++ and then looking over the code, I think I found the issue. Let's take a look at that error again. SIO2aduino.cpp in function 'boolean format(int, int)': SIO2arduino:167: error: 'class sdfile' has no member 'getfilename' So, this is saying that the function format() is trying to use the function getfilename that should be part of the sdfile class. Here is what that line looks like. file.getFilename(name); Now, you might be wondering why it says, "file" instead of "sdFile". That's because that's "file" is an instance of the class "sdFile". Think of "sdFile" as a template and "file" an instance of it that you can actually use. If you wanted to create another instances of sdFile, you'd just do something like sdFile file2; They actually did this. If you look up near the top you'll see where file is instantiated as well as currDir; SdFile currDir; SdFile file; But I digress. I need to find the sdFile class to see if it has a method called getFilename. The readme states you need to grab that file and add it to your project, That file exists here (https://github.com/greiman/SdFat). I should find that method in one of these two header files. #include <SdFat.h> #include <SdFatUtil.h> I didn't find that function/method in any of those classes. It's possible the method is defined elsewhere (Yes, that's the 'Magic' of C++) but I didn't find it in any other header (.h) file. It's possible I'm missing something so hopefully someone else can confirm this. Anyone with some C++ skills should be able to do this. In any case, if the function/method doesn't exist, you can't use it but it really seems strange that this wouldn't be included in the project since w/o it, you can't compile it. Quote Link to comment Share on other sites More sharing options...
joyfulcoder Posted June 4, 2016 Share Posted June 4, 2016 I recommend fixing the errors and staying with the current version of the Arduino IDE to avoid problems with other projects. I downloaded the latest SIO2Arduino from GitHub and after the following changes I see no errors nor warnings using Arduino 1.6.9: In SIO2Arduino.ino declare these functions after the '#include' and before the Global variables comment. DriveStatus* getDeviceStatus(int deviceId); SectorDataInfo* readSector(int deviceId, unsigned long sector, byte *data); boolean writeSector(int deviceId, unsigned long sector, byte* data, unsigned long length); boolean format(int deviceId, int density); int getFileList(int startIndex, int count, FileEntry *entries); void mountFileIndex(int deviceId, int ix); void changeDirectory(int ix); In sdrive.cpp change the '#import' to '#include' to fix the warnings. 1 Quote Link to comment Share on other sites More sharing options...
JoSch Posted June 4, 2016 Share Posted June 4, 2016 And please create a pull request. Quote Link to comment Share on other sites More sharing options...
Stefan Both Posted June 4, 2016 Share Posted June 4, 2016 (edited) You may check if you installed the # included Libraries correct?! By the way... https://github.com/whizzosoftware/SIO2Arduino/issues/ have you checked that too? Stefan Edited June 4, 2016 by Stefan Both Quote Link to comment Share on other sites More sharing options...
Justin Payne Posted June 4, 2016 Share Posted June 4, 2016 I recommend fixing the errors and staying with the current version of the Arduino IDE to avoid problems with other projects. I downloaded the latest SIO2Arduino from GitHub and after the following changes I see no errors nor warnings using Arduino 1.6.9: In SIO2Arduino.ino declare these functions after the '#include' and before the Global variables comment. DriveStatus* getDeviceStatus(int deviceId); SectorDataInfo* readSector(int deviceId, unsigned long sector, byte *data); boolean writeSector(int deviceId, unsigned long sector, byte* data, unsigned long length); boolean format(int deviceId, int density); int getFileList(int startIndex, int count, FileEntry *entries); void mountFileIndex(int deviceId, int ix); void changeDirectory(int ix); In sdrive.cpp change the '#import' to '#include' to fix the warnings. Hmmm. I must be looking at the wrong project then because I don't see where they're declared here (https://github.com/whizzosoftware/SIO2Arduino/blob/e22262b3254accaef0b399db80a68aae7288a2bd/SIO2Arduino.ino) Quote Link to comment Share on other sites More sharing options...
joyfulcoder Posted June 4, 2016 Share Posted June 4, 2016 Hmmm. I must be looking at the wrong project then because I don't see where they're declared here (https://github.com/whizzosoftware/SIO2Arduino/blob/e22262b3254accaef0b399db80a68aae7288a2bd/SIO2Arduino.ino) We know they are not declared. That is why I describe the changes I had to make after I downloaded it from GitHub. Quote Link to comment Share on other sites More sharing options...
Justin Payne Posted June 4, 2016 Share Posted June 4, 2016 Oh, sry. Misunderstood what u were saying. Quote Link to comment Share on other sites More sharing options...
16/32 Posted June 4, 2016 Author Share Posted June 4, 2016 Hi guys, earlier when i came from work i changed the code too what joyfulcoder suggested.. but it didn't fix the problem! Later this evening my cousin came by, he knows somewhat about arduino.. He understand more about what you guys are talking about, he also tried to fix this, but i still keep getting errors My cousin will try to figure out what goes wrong with this sketch. Otherwise i got to find an other solution than the arduino. Lots of thanks for the many helps. Keep you guys updated! Quote Link to comment Share on other sites More sharing options...
16/32 Posted June 4, 2016 Author Share Posted June 4, 2016 You may check if you installed the # included Libraries correct?! By the way... https://github.com/whizzosoftware/SIO2Arduino/issues/ have you checked that too? Stefan I also found this link where they mentioned this same problem, and tried to install sdfatlib20130629.zip But made no difference Quote Link to comment Share on other sites More sharing options...
Justin Payne Posted June 4, 2016 Share Posted June 4, 2016 We know they are not declared. That is why I describe the changes I had to make after I downloaded it from GitHub. Can't you post the binary for 16/32. That way he doesn't have to deal with the compile issues. Quote Link to comment Share on other sites More sharing options...
electrotrains Posted June 5, 2016 Share Posted June 5, 2016 16/32, I played with SIO2Arduino a couple of years ago, and got it working after a bit of fiddling. Its a great project - well worth the effort to get it working! However it seems to be a bit harder to get it to work with the current IDE than it was. However, If you download version 1.6.5 of the Arduino IDE, and the abcbarryn branch of the SIO2Arduino code, and the current version of sdfat then it seems to compile without errors. Haven't actually wired up my arduino yet to test it. Links are below. https://www.arduino.cc/en/Main/OldSoftwareReleases#previous https://github.com/abcbarryn/SIO2Arduino https://github.com/greiman/SdFat Note that you need to copy the "inner" sdfat directory to your arduino libraries folder. Robin Quote Link to comment Share on other sites More sharing options...
electrotrains Posted June 5, 2016 Share Posted June 5, 2016 (edited) I recommend fixing the errors and staying with the current version of the Arduino IDE to avoid problems with other projects. I downloaded the latest SIO2Arduino from GitHub and after the following changes I see no errors nor warnings using Arduino 1.6.9: In SIO2Arduino.ino declare these functions after the '#include' and before the Global variables comment. DriveStatus* getDeviceStatus(int deviceId); SectorDataInfo* readSector(int deviceId, unsigned long sector, byte *data); boolean writeSector(int deviceId, unsigned long sector, byte* data, unsigned long length); boolean format(int deviceId, int density); int getFileList(int startIndex, int count, FileEntry *entries); void mountFileIndex(int deviceId, int ix); void changeDirectory(int ix); In sdrive.cpp change the '#import' to '#include' to fix the warnings. What version of the sdfat library did you use? I got an error there was no member getFilename in SdFile, in the current version of the library. I also had to add #define USE_SD_VOLUME to config.h The abcbarryn branch fixes these two issues. and there were also errors regarding const char * issues with things like mountFilename(0, "AUTORUN.ATR"); (downgrading to Arduino 1.6.5 fixed these, but I agree it would be best to get it compiling without errors in the current IDE). Edited June 5, 2016 by electrotrains Quote Link to comment Share on other sites More sharing options...
16/32 Posted June 5, 2016 Author Share Posted June 5, 2016 (edited) Hello friends, It's getting better at the moment.. I tried what Elektotrains suggested, so in installed arduino 1.6.5 used the abcbarryn branch of the SIO2Arduino code and tried the greinman sdfat. also changed the following: DriveStatus* getDeviceStatus(int deviceId); SectorDataInfo* readSector(int deviceId, unsigned long sector, byte *data); boolean writeSector(int deviceId, unsigned long sector, byte* data, unsigned long length); boolean format(int deviceId, int density); int getFileList(int startIndex, int count, FileEntry *entries); void mountFileIndex(int deviceId, int ix); void changeDirectory(int ix); In sdrive.cpp change the '#import' to '#include' to fix the warnings. This changed allot, because i only get one error now.. Now i get: fatal error: SD.h: No such file or directory #include <SD.h> error compiling for board/arduino uno. Sorry for my trouble! Edited June 5, 2016 by 16/32 Quote Link to comment Share on other sites More sharing options...
electrotrains Posted June 5, 2016 Share Posted June 5, 2016 16/32, You shouldn't have needed to fix the function declarations, or the #import stuff - the abcbarryn branch verifyied/compiled without any changes for me. The SD.h no such file error sounds like you've got the SD Fat library installed incorrectly. Download the zip file from github, extract it, then find the INNER sdfat directory (the one with the .h and .cpp files in it) and copy that to your arduino libraries folder. Robin Quote Link to comment Share on other sites More sharing options...
Stefan Both Posted June 5, 2016 Share Posted June 5, 2016 And after that, restart your arduino ide! As i already mentioned, all those " not declared in this function" sounds like a missing #include file (or at least a wrong version). Stefan Quote Link to comment Share on other sites More sharing options...
joyfulcoder Posted June 5, 2016 Share Posted June 5, 2016 What version of the sdfat library did you use? I got an error there was no member getFilename in SdFile, in the current version of the library. I also had to add #define USE_SD_VOLUME to config.h The abcbarryn branch fixes these two issues. and there were also errors regarding const char * issues with things like mountFilename(0, "AUTORUN.ATR"); (downgrading to Arduino 1.6.5 fixed these, but I agree it would be best to get it compiling without errors in the current IDE). I checked the sdfat lib version I had and it was "unknown" but different than GitHub. After downloading sdfat and the abcbarryn branch of SIO2Arduino I still needed to add the function declarations. The mountFilename function needs to be changed to "const char *name" to fix that error and then all compiled fine with Arduino 1.6.9. Quote Link to comment Share on other sites More sharing options...
ricortes Posted June 5, 2016 Share Posted June 5, 2016 Just an OP: Anyone that develops on the Arduino really has to practice defensive coding. By that I mean it seems like every update of the development software breaks previously working software. I would guess close to 1/3 of the software out there that was developed using earlier versions of the IDE no longer work. By defensive programming I mean make sure the compiler version that your code compiles under is in the listing, code using C vs. C++, include any modifications to the libraries with the code. AVR is a great processor, C and C++ are great languages, Arduino is great hardware and reasonably priced, but the crew in charge of the IDE need some sensitivity training. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.